public class BrentRoot extends Object implements Uniroot
NewtonRoot and HalleyRoot, it does not need the derivatives of the function.
Brent's algorithm is the preferred method of choice for root-finding.| Constructor and Description |
|---|
BrentRoot(double tol,
int maxIterations)
Construct an instance of Brent's root finding algorithm.
|
| Modifier and Type | Method and Description |
|---|---|
double |
solve(UnivariateRealFunction f,
double lower,
double upper) |
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 BrentRoot(double tol,
int maxIterations)
tol - the convergence tolerancemaxIterations - the maximum number of iterationspublic double solve(UnivariateRealFunction f, double lower, double upper, double... guess)
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.public double solve(UnivariateRealFunction f, double lower, double upper)
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.