org.spaceroots.mantissa.roots
Class BrentSolver

java.lang.Object
  extended byorg.spaceroots.mantissa.roots.BrentSolver
All Implemented Interfaces:
RootsFinder

public class BrentSolver
extends Object
implements RootsFinder

This class implements the Brent algorithm to compute the roots of a function in an interval. This class is basically a translation in Java of a fortran implementation found at netlib (zeroin.f).

Version:
$Id: BrentSolver.java 1499 2003-03-29 12:50:08Z luc $
Author:
L. Maisonobe

Constructor Summary
BrentSolver()
          Simple constructor.
 
Method Summary
 boolean findRoot(ComputableFunction function, ConvergenceChecker checker, int maxIter, double x0, double f0, double x1, double f1)
          Solve a function in a given interval known to contain a root.
 double getRoot()
          Get the abscissa of the root.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BrentSolver

public BrentSolver()
Simple constructor. Build a Brent solver

Method Detail

findRoot

public boolean findRoot(ComputableFunction function,
                        ConvergenceChecker checker,
                        int maxIter,
                        double x0,
                        double f0,
                        double x1,
                        double f1)
                 throws FunctionException
Solve a function in a given interval known to contain a root.

Specified by:
findRoot in interface RootsFinder
Parameters:
function - function for which a root should be found
checker - checker for the convergence of the function
maxIter - maximal number of iteration allowed
x0 - abscissa of the lower bound of the interval
f0 - value of the function the lower bound of the interval
x1 - abscissa of the higher bound of the interval
f1 - value of the function the higher bound of the interval
Returns:
true if a root has been found in the given interval
Throws:
FunctionException

getRoot

public double getRoot()
Get the abscissa of the root.

Specified by:
getRoot in interface RootsFinder
Returns:
abscissa of the root


Copyright © 2001-2007 Luc Maisonobe. All Rights Reserved.