org.spaceroots.mantissa.roots
Class BrentSolver
- java.lang.Object
-
- org.spaceroots.mantissa.roots.BrentSolver
-
- All Implemented Interfaces:
- RootsFinder
public class BrentSolver extends java.lang.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).
-
-
Constructor Summary
Constructors Constructor and Description BrentSolver()Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanfindRoot(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.doublegetRoot()Get the abscissa of the root.
-
-
-
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:
findRootin interfaceRootsFinder- Parameters:
function- function for which a root should be foundchecker- checker for the convergence of the functionmaxIter- maximal number of iteration allowedx0- abscissa of the lower bound of the intervalf0- value of the function the lower bound of the intervalx1- abscissa of the higher bound of the intervalf1- 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:
getRootin interfaceRootsFinder- Returns:
- abscissa of the root
-
-
DataMelt 3.0 © DataMelt by jWork.ORG