iconEuler Reference

Extreama of Functions

Minimization and maximization routines in one or more dimensions, which do not use the derivative.

Euler has the golden ration bisection algorithm for functions of one variable, and the Nelder-Mead algorithm for functions of several variables.

Golden Cut

function fmin (f:string, a:real scalar, b:real scalar)

  Compute the minimum of the convex function f in [a,b].
  
  Uses the golden cut method, starting with the interval [a,b]. The
  method takes about 60*(b-a) function evalations for full accuracy.
  
  f is either an expression in x, or a function of x. Additional
  parameters are passed to a function f.
  
  You can specify an epsilon eps with eps=... as last parameter.
  
  See: 
fmax (Extreama of Functions)
function fmax (f:string, a:real scalar, b:real scalar)

  Compute the maximum of the concave function f in [a,b].
  
  Uses the golden cut method, starting with the interval [a,b]. The
  method takes about 60*(b-a) function evalations for full accuracy.
  
  f is either an expression in x, or a function of x. Additional
  parameters after a semicolon are passed to a function f.
  
  You can specify an epsilon eps with eps=... as last parameter.
  
  See: 
fmin (Extreama of Functions)
function fextrema (f:string, a:real scalar, b:real scalar, n:integer=100)

  Find all internal extrema of f in [a,b].
  
  f may be an expression in x or a function. Additional
  parameters after a semicolon are passed to a function f.
  
  You can specify an epsilon eps with eps=... as last parameter.
  
  Returns {minima,maxima} (vectors, possibly of length 0)
  
  See: 
fmax (Extreama of Functions),
fmin (Extreama of Functions)

Brent and Nelder-Mead

function brentmin (f:string, a:real scalar, d=0.1, eps=epsilon())

  Compute the minimum of f around a with Brent's method.
  
  d is an initial step size to look for a starting interval.
  eps is the final accuracy.
  
  Returns the point of minimal value.
  
  f is an expression in x, or a function in f. Additional parameters
  after a semicolon are passed to a function f.
  
  Return the point of minimum.
  
  See: 
fmin (Extreama of Functions),
fmax (Extreama of Functions)
function neldermin (f:string, v:real, d=0.1, eps=epsilon(), tries=2)

  Compute the minimum of f around v with the Nelder-Mead method.
  
  The Nelder-Mead method is a stable, but slow method to search for a
  local minimum of a function without using any derivative. It should
  not be used for high dimensions. Of course, it can also be applied
  to solve a system equations by minimizing the norm of the errors.
  
  f must be function of a row or column vector x, returning a real
  value. Addditional parameters after the semicolon are passed to f.
  f can also be an expression depending on a vector x.
  
  d is an optional initial step size for a starting simplex.
  eps is the final accuracy.
  
  f : function f(v) (v : 1xn or nx1, result: scalar)
  v : start point for the search (1xn or nx1)
  d : optional size of start simplex
  eps : optional accuracy
  tries : number of restarts of the algorithm
  
  Return the point of minimum (1xn vector).
  
  See: 
nelder (Euler Core)

Nelder-Mead

function nelder (f:string, v:real, d=0.1, eps=epsilon())

  Compute the minimum of f around v with the Nelder-Mead method.
  
  Alias to neldermin.
  
  See: 
neldermin (Extreama of Functions)

Documentation Homepage