R: Minimum Finding

fminsearch {pracma} | R Documentation

## Minimum Finding

### Description

Find minimum of unconstrained multivariable function.

### Usage

    fminsearch(f, x0, ..., minimize = TRUE, dfree = TRUE,
               maxiter = 1000, tol = .Machine$double.eps^(2/3))

### Arguments

`f` | function whose minimum or maximum is to be found.
`x0` | point considered near to the optimum.
`minimize` | logical; shall a minimum or a maximum be found.
`dfree` | logical; apply derivative-free optimization or not.
`maxiter` | maximal number of iterations
`tol` | relative tolerance.
`...` | additional variables to be passed to the function.

### Details

`fminsearch` finds the minimum of a nonlinear scalar multivariable function, starting at an initial estimate and returning a value x that is a local minimizer of the function.

With `minimize=FALSE` it seaches for a maximum. `dfree=TRUE` applies Nelder.Mead, else Fletcher-Powell, calculating the derivatives numerically.

This is generally referred to as unconstrained nonlinear optimization. `fminsearch` may only give local solutions.

### Value

List with

`xopt` | location of the location of minimum resp. maximum.
`fval` | function value at the optimum.
`niter` | number of iterations.

### Note

`fminbnd` mimics the Matlab function of the same name.

### References

Nocedal, J., and S. Wright (2006). Numerical Optimization. Second Edition, Springer-Verlag, New York.

### See Also

`optim`

### Examples

    # Rosenbrock function
    rosena <- function(x, a) 100*(x[2]-x[1]^2)^2 + (a-x[1])^2  # min: (a, a^2)

    fminsearch(rosena, c(-1.2, 1), a = sqrt(2))
    # x = (1.414214 2.000010) , fval = 1.239435e-11

    fminsearch(rosena, c(-1.2, 1), dfree=FALSE, a = sqrt(2))
    # x = (1.414214 2.000000) , fval = 3.844519e-26

[Package pracma version 2.0.4 Index]