@Status(stage=PRODUCTION, unitTests=COMPLETE) @Review(by="Kees Schotanus", at="2009-09-28") public final class Bisection extends AbstractRootFinder implements RootFinderStrategy
Constructor and Description |
---|
Bisection(double accuracy)
Creates this Bisection root finder using the supplied accuracy.
|
Bisection(int iterations)
Creates this Bisection root finder using the supplied number of
iterations.
|
Modifier and Type | Method and Description |
---|---|
double |
findRoot(SingleParameterFunction function,
double left,
double right)
Finds a root of the supplied function within the supplied interval [left,
right] using the Bisection method.
|
getAccuracy, getInterval, getIterations, setAccuracy, setInterval, setIterations
public Bisection(int iterations)
iterations
- The maximum number of iterations to find a root.IllegalArgumentException
- When the supplied iterations <= 0.public Bisection(double accuracy)
accuracy
- The accuracy of the found root.IllegalArgumentException
- When the supplied accuracy <= 0.public double findRoot(SingleParameterFunction function, double left, double right)
findRoot
in interface RootFinderStrategy
function
- The function for which a root should be found.left
- x value of the left side of the interval.
right
- x value of the right side of the interval.
IllegalArgumentException
- When left equals right or when both
function(left) and function(right) are of equal sign or when either
function(left) or function(right) is "Not a Number".NullPointerException
- when the supplied function is null.Copyright © 2008–2018. All rights reserved.