public class NewtonRoot extends Object implements Uniroot
| Constructor and Description |
|---|
NewtonRoot(double tol,
int maxIterations)
Constructs an instance of Newton'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_,
double guess)
Searches for a root, x, in the interval [lower, upper] such
that f(x) = 0.
|
public NewtonRoot(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_, double guess) throws NoRootFoundException
f - a univariate functiondf_ - the first 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.