SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.analysis.uniroot
Class Brent

java.lang.Object
  extended by com.numericalmethod.suanshu.analysis.uniroot.Uniroot
      extended by com.numericalmethod.suanshu.analysis.uniroot.Brent

public class Brent
extends Uniroot

Brent's root-finding algorithm combines superlinear convergence with reliability of bisection. It uses the secant method or inverse quadratic interpolation whenever possible because they converge faster, but falls back to the more robust bisection method if necessary.

Brent's algorithm does not need the derivatives of the function.

Brent's algorithm is the preferred method of choice.

See Also:
Wikipedia: Brent's method

Nested Class Summary
 
Nested classes/interfaces inherited from class com.numericalmethod.suanshu.analysis.uniroot.Uniroot
Uniroot.NoRootFoundException
 
Field Summary
 
Fields inherited from class com.numericalmethod.suanshu.analysis.uniroot.Uniroot
f, tol
 
Constructor Summary
Brent(UnivariateRealFunction f, double tol)
          Construct an instance of Brent's root finding algorithm.
 
Method Summary
 double solve(int maxIterations, double lower, double upper, double... guess)
          The implementation of a specific uniroot finding algorithm.
 
Methods inherited from class com.numericalmethod.suanshu.analysis.uniroot.Uniroot
solve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Brent

public Brent(UnivariateRealFunction f,
             double tol)
Construct an instance of Brent's root finding algorithm.

Parameters:
f - the function to solve
tol - the convergence tolerance
Method Detail

solve

public double solve(int maxIterations,
                    double lower,
                    double upper,
                    double... guess)
The implementation of a specific uniroot finding algorithm. Note: it is important that [lower, upper] must bracket the root.

Specified by:
solve in class Uniroot
Parameters:
maxIterations - the maximum number of iterations
lower - lower bound for the root
upper - upper bound for the root
guess - not used
Returns:
the root an (approximate) root

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.