maxLik is a statistical package for maximum likelihood estimation. For example, the max of can be found like the below using newton raphson method.
> x <- seq(0, 7, .01) > f <- function(x) { -1 * (x-2) * (x-5) } > plot(x, f(x), type="l") > abline(a=0, b=0) > m <- maxNR(f, start=-5, print.level=2) ----- Initial parameters: ----- fcn value: -70 parameter initial gradient free [1,] -5 17 1 Condition number of the (active) hessian: 1 -----Iteration 1 ----- -----Iteration 2 ----- -----Iteration 3 ----- -------------- gradient close to zero 3 iterations estimate: 3.5 Function value: 2.25 > summary(m) -------------------------------------------- Newton-Raphson maximisation Number of iterations: 3 Return code: 1 gradient close to zero Function value: 2.25 Estimates: estimate gradient [1,] 3.5 8.881784e-10 --------------------------------------------
Estimate was 3.5, and this is correct because .
Optimization and Mathematical Programming has list of packages for optimization.