Add momentum-based gradient descent

Document xtol, ftol and grtol
Fix bug in Nelder-Mead