|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.analysis.uniroot.Uniroot
public abstract class Uniroot
One dimensional root (zero) finding algorithm for univariate function. All uniroot implementations extends this class.
A root-finding algorithm is a numerical algorithm for finding a value x
such that f(x) = 0, for a given function f.
Such an x is called a root of the function f.
| Nested Class Summary | |
|---|---|
static class |
Uniroot.NoRootFoundException
Exception thrown when it fails to find a root. |
| Field Summary | |
|---|---|
UnivariateRealFunction |
f
the univariate function to be solved for 0, f |
double |
tol
the convergence criterion such that the search succeeds when |f(x)| < tol |
| Constructor Summary | |
|---|---|
Uniroot(UnivariateRealFunction f,
double tol)
Construct a uniroot solver. |
|
| Method Summary | |
|---|---|
abstract double |
solve(int maxIterations,
double lower,
double upper,
double... guess)
The implementation of a specific uniroot finding algorithm. |
double |
solve(int maxIterations,
double lower,
double upper,
double guess)
Search for a root in the interval [lower, upper]
for the maximum number of maxIterations. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final UnivariateRealFunction f
f
public final double tol
|f(x)| < tol
| Constructor Detail |
|---|
public Uniroot(UnivariateRealFunction f,
double tol)
f - a univariate functiontol - the convergence tolerance| Method Detail |
|---|
public double solve(int maxIterations,
double lower,
double upper,
double guess)
throws Uniroot.NoRootFoundException
[lower, upper]
for the maximum number of maxIterations.
If the search fails, it throws a Uniroot.NoRootFoundException exception.
lower - the lower bound for the rootupper - the upper bound for the rootmaxIterations - the maximum number of iterations to repeat the procedureguess - an initial guess
Uniroot.NoRootFoundException
public abstract double solve(int maxIterations,
double lower,
double upper,
double... guess)
maxIterations - the maximum number of iterationslower - the lower bound of the bracketing intervalupper - the upper bound of the bracketing intervalguess - an initial guess of the root. It should lie between [lower, upper].
Note that guess is a double[] array.
This signature allows multiple initial guesses for certain types of uniroot algorithms, e.g., Brent's algorithm.
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||