Brent Root Finder

The net.sf.doodleproject.numerics4j.root.BrentRootFinder class provides an implementation of Brent's method. Brent's method is a solid, general purpose root finding method. Its is a combination of other root finding methods that offers guaranteed convergance such as found with the bisection method but boasts a superior rate of convergence.

Finding roots using Brent's method involves creating a BrentRootFinder object for a particular net.sf.doodleproject.numerics4j.function.Function object. Once, the root finder is created, roots can be evaluated by calling the findRoot method providing a bracketting interval. Here is an example of finding roots for sine:

Function sine = new Function() {
    public double evaluate(double x) {
        return Math.sin(x);
    }
};

BrentRootFinder bisection = new BrentRootFinder(sine);

// find the root between 3 and 4.
double pi = brent.findRoot(3.0, 4.0);

// find the root between -1 and 1.
double zero = brent.findRoot(-1.0, 1.0);