public class BisectionRoot extends Object implements Uniroot
| Constructor and Description |
|---|
BisectionRoot()
Create an instance with
Constants.EPSILON as the tolerance and
Integer.MAX_VALUE as the maximum number of iterations. |
BisectionRoot(double tol,
int maxIterations)
Create an instance with the tolerance for convergence and the maximum number of iterations.
|
| Modifier and Type | Method and Description |
|---|---|
double |
solve(UnivariateRealFunction f,
double lower,
double upper,
double... guess)
Search for a root, x, in the interval [lower, upper] such that f(x) = 0.
|
public BisectionRoot()
Constants.EPSILON as the tolerance and
Integer.MAX_VALUE as the maximum number of iterations.public BisectionRoot(double tol,
int maxIterations)
tol - the tolerancemaxIterations - the maximum number of iterationspublic double solve(UnivariateRealFunction f, double lower, double upper, double... guess) throws NoRootFoundException
Unirootsolve in interface Unirootf - a univariate functionlower - the lower bound of the bracketing intervalupper - the upper bound of the bracketing intervalguess - an initial guess of the root within [lower, upper].
Note that guess is a double[].
This signature allows multiple initial guesses for certain types of uniroot algorithms, e.g., Brent's algorithm.NoRootFoundException - when the search fails to find a rootCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.