## Class BracketRoot

• public class BracketRoot
extends Object
Class that brackets single root of a function. For a 1-D function (Function) $f(x)$, initial values for the interval, $x_1$ and $x_2$, are supplied.

A root is assumed to be bracketed if $f(x_1)f(x_2) < 0$. If this condition is not satisfied, then either $|f(x_1)| < |f(x_2)|$, in which case the lower value $x_1$ is shifted in the negative $x$ direction, or the upper value $x_2$ is shifted in the positive $x$ direction. The amount by which to shift is the difference between the two $x$ values multiplied by a constant ratio (1.6). If a root is not bracketed after 50 attempts, an exception is thrown.

• ### Constructor Summary

Constructors
Constructor Description
BracketRoot()
• ### Method Summary

All Methods
Modifier and Type Method Description
double[] getBracketedPoints​(Function<Double,​Double> f, double xLower, double xUpper)
Gets the bracketed roots.
double[] getBracketedPoints​(Function<Double,​Double> f, double xLower, double xUpper, double minX, double maxX)
Gets the bracketed roots.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### BracketRoot

public BracketRoot()
• ### Method Detail

• #### getBracketedPoints

public double[] getBracketedPoints​(Function<Double,​Double> f,
double xLower,
double xUpper)
Gets the bracketed roots.
Parameters:
f - The function, not null
xLower - Initial value of lower bracket
xUpper - Initial value of upper bracket
Returns:
The bracketed points as an array, where the first element is the lower bracket and the second the upper bracket.
Throws:
MathException - If a root is not bracketed in 50 attempts.
• #### getBracketedPoints

public double[] getBracketedPoints​(Function<Double,​Double> f,
double xLower,
double xUpper,
double minX,
double maxX)
Gets the bracketed roots.
Parameters:
f - The function, not null
xLower - Initial value of lower bracket
xUpper - Initial value of upper bracket
minX - the minimum x
maxX - the maximum x
Returns:
The bracketed points as an array, where the first element is the lower bracket and the second the upper bracket.
Throws:
MathException - If a root is not bracketed in 50 attempts.