C# Class Accord.Math.Optimization.BrentSearch

Brent's root finding and minimization algorithms.

In numerical analysis, Brent's method is a complicated but popular root-finding algorithm combining the bisection method, the secant method and inverse quadratic interpolation. It has the reliability of bisection but it can be as quick as some of the less reliable methods. The idea is to use the secant method or inverse quadratic interpolation if possible, because they converge faster, but to fall back to the more robust bisection method if necessary. Brent's method is due to Richard Brent (1973) and builds on an earlier algorithm of Theodorus Dekker (1969).

The algorithms implemented in this class are based on the original C source code available in Netlib (http://www.netlib.org/c/brent.shar) by Oleg Keselyov, 1991.

References: R.P. Brent (1973). Algorithms for Minimization without Derivatives, Chapter 4. Prentice-Hall, Englewood Cliffs, NJ. ISBN 0-13-022335-2. Wikipedia contributors. "Brent's method." Wikipedia, The Free Encyclopedia. Wikipedia, The Free Encyclopedia, 11 May. 2012. Web. 22 Jun. 2012.

Show file Open project: accord-net/framework Class Usage Examples

Private Properties

Property Type Description

Public Methods

Method Description
BrentSearch ( double>.Func function, double a, double b ) : System

Constructs a new Brent search algorithm.

Find ( double value ) : bool

Attempts to find a value in the interval [a;b]

Find ( double>.Func function, double value, double lowerBound, double upperBound, double tol = 1e-6 ) : double

Finds a value of a function in the interval [a;b]

FindRoot ( ) : bool

Attempts to find a root in the interval [a;b]

FindRoot ( double>.Func function, double lowerBound, double upperBound, double tol = 1e-6 ) : double

Finds the root of a function in the interval [a;b]

Maximize ( ) : bool

Finds the maximum of the function in the interval [a;b]

Maximize ( double>.Func function, double lowerBound, double upperBound, double tol = 1e-6 ) : double

Finds the maximum of a function in the interval [a;b]

Minimize ( ) : bool

Finds the minimum of the function in the interval [a;b]

Minimize ( double>.Func function, double lowerBound, double upperBound, double tol = 1e-6 ) : double

Finds the minimum of a function in the interval [a;b]

Method Details

BrentSearch() public method

Constructs a new Brent search algorithm.
public BrentSearch ( double>.Func function, double a, double b ) : System
function double>.Func The function to be searched.
a double Start of search region.
b double End of search region.
return System

Find() public method

Attempts to find a value in the interval [a;b]
public Find ( double value ) : bool
value double
return bool

Find() public static method

Finds a value of a function in the interval [a;b]
public static Find ( double>.Func function, double value, double lowerBound, double upperBound, double tol = 1e-6 ) : double
function double>.Func The function to have its root computed.
value double The value to be looked for in the function.
lowerBound double Start of search region.
upperBound double End of search region.
tol double The tolerance for determining the solution.
return double

FindRoot() public method

Attempts to find a root in the interval [a;b]
public FindRoot ( ) : bool
return bool

FindRoot() public static method

Finds the root of a function in the interval [a;b]
public static FindRoot ( double>.Func function, double lowerBound, double upperBound, double tol = 1e-6 ) : double
function double>.Func The function to have its root computed.
lowerBound double Start of search region.
upperBound double End of search region.
tol double The tolerance for determining the solution.
return double

Maximize() public method

Finds the maximum of the function in the interval [a;b]
public Maximize ( ) : bool
return bool

Maximize() public static method

Finds the maximum of a function in the interval [a;b]
public static Maximize ( double>.Func function, double lowerBound, double upperBound, double tol = 1e-6 ) : double
function double>.Func The function to be maximized.
lowerBound double Start of search region.
upperBound double End of search region.
tol double The tolerance for determining the solution.
return double

Minimize() public method

Finds the minimum of the function in the interval [a;b]
public Minimize ( ) : bool
return bool

Minimize() public static method

Finds the minimum of a function in the interval [a;b]
public static Minimize ( double>.Func function, double lowerBound, double upperBound, double tol = 1e-6 ) : double
function double>.Func The function to be minimized.
lowerBound double Start of search region.
upperBound double End of search region.
tol double The tolerance for determining the solution.
return double