3
An alternative (and easier) function is
optimise
but this does not compute the Hessian matrix.