Learn R Programming

pracma (version 0.8.1)

fminbnd: Minimum Finding

Description

Find minimum of single-variable function on fixed interval.

Usage

fminbnd(f, x1, x2, ..., minimize = TRUE, tol = .Machine$double.eps^(2/3))

Arguments

f
function whose minimum or maximum is to be found.
x1, x2
endpoints of the interval to be searched.
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

fminbnd finds the minimum of a function of one variable within a fixed interval. The Matlab version is based on golden section search and parabolic interpolation.

fminbnd may only give local solutions. fminbnd never evaluates f at the endpoints.

References

Quarteroni, A., R. Sacco, and F. Saleri (2007). Numerical Mathematics. Second Edition, Springer-Verlag, Berlin Heidelberg.

See Also

fibsearch, golden_ratio

Examples

Run this code
fminbnd(cos, 3, 4)          # x = 3.141593  , fval = -1
f <- function(x) x^3-2*x-5
fminbnd(f, 0, 2)            # x = 0.8164966 , fval = -6.088662

Run the code above in your browser using DataLab