public class HalleyRoot extends Object implements Uniroot
| Constructor and Description |
|---|
HalleyRoot(double tol,
int maxIterations)
Construct an instance of Halley's root finding algorithm.
|
| Modifier and Type | Method and Description |
|---|---|
double |
solve(UnivariateRealFunction f,
double guess) |
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.
|
double |
solve(UnivariateRealFunction f,
UnivariateRealFunction df,
UnivariateRealFunction d2f,
double guess)
Search for a root, x, in the interval [lower, upper] such that f(x) = 0.
|
public HalleyRoot(double tol,
int maxIterations)
tol - the convergence 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 rootpublic double solve(UnivariateRealFunction f, double guess) throws NoRootFoundException
NoRootFoundExceptionpublic double solve(UnivariateRealFunction f, UnivariateRealFunction df, UnivariateRealFunction d2f, double guess) throws NoRootFoundException
f - a univariate functiondf - the first order derivatived2f - the second order derivativeguess - an initial guess of the root within [lower, upper]NoRootFoundException - when the search fails to find a rootCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.