public class BisectionSingleRootFinder extends RealSingleRootFinder
If a root of a function $f(x)$ is bounded by two values $x_1$ and $x_2$, then $f(x_1)f(x_2) < 0$. The function is evaluated at the midpoint of these values and the bound that gives the same sign in the function evaluation is replaced. The bisection is stopped when the change in the value of $x$ is below the accuracy, or the evaluation of the function at $x$ is zero.
| Constructor and Description |
|---|
BisectionSingleRootFinder()
Creates an instance.
|
BisectionSingleRootFinder(double accuracy)
Creates an instance.
|
| Modifier and Type | Method and Description |
|---|---|
Double |
getRoot(Function<Double,Double> function,
Double x1,
Double x2) |
checkInputs, checkInputs, getRootpublic BisectionSingleRootFinder()
public BisectionSingleRootFinder(double accuracy)
accuracy - The required accuracy of the $x$-position of the rootpublic Double getRoot(Function<Double,Double> function, Double x1, Double x2)
getRoot in class RealSingleRootFinderMathException - If the root is not found to the required accuracy in 100 attemptsCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.