nlmin
and nlmax
are thin wrappers around nlm
, a non-linear minimizer.
nlmax
avoids the necessity of modifying the function to construct a minimization problem
from a problem that is naturally a maximization problem.
The summary
method for the resulting objects provides output that is easier
for humnans to read.
Examples
summary( nlmax( function(x) 5 - 3*x - 5*x^2, p=0 ) )
#>
#> Maximum: 5.4500
#> Estimate:-0.3000005
#> Gradient:-8.881784e-10
#> Iterations: 1
#>
#> Relative gradient is close to zero, current iterate is probably an
#> approximate solution.[Code=1]