Learn R Programming

pracma (version 0.7.5)

fminsearch: Minimum Finding

Description

Find minimum of unconstrained multivariable function.

Usage

fminsearch(f, x0, ..., minimize = TRUE, 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.
tol
relative tolerance.
...
additional variables to be passed to the function.

Value

  • List with
  • xlocation of the location of minimum resp. maximum.
  • fvalfunction value at the optimum.

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. This is generally referred to as unconstrained nonlinear optimization. fminsearch may only give local solutions.

References

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

See Also

optim

Examples

Run this code
# 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.414218 2.000013) , fval = 4.115895e-11

Run the code above in your browser using DataLab