jhplot.math.num.root
Class Bracket
- java.lang.Object
-
- jhplot.math.num.root.Bracket
-
public class Bracket extends java.lang.Object
Simple root bracketing routine. Starting with an initial point, a closed interval can be created known to contain at least one root for a function.
-
-
Constructor Summary
Constructors Constructor and Description Bracket(Function f)
Create a root bracketer for the given function.Bracket(Function f, int iterations)
Create a root bracketer for the given function.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description double[]
bracketOut(double lower, double initial, double upper)
Bracket a root for the target function by creating and continuously expanding an interval around the initial point until the interval is known to contain at least one root.Function
getFunction()
Access the target function.int
getMaximumIterations()
Access the maximum number of iterations.void
setFunction(Function f)
Modify the target function.void
setMaximumIterations(int iterations)
Modify the maximum number of iterations.
-
-
-
Constructor Detail
-
Bracket
public Bracket(Function f)
Create a root bracketer for the given function.- Parameters:
f
- the target function.
-
Bracket
public Bracket(Function f, int iterations)
Create a root bracketer for the given function.- Parameters:
f
- the target function.iterations
- maximum number of iterations.
-
-
Method Detail
-
bracketOut
public double[] bracketOut(double lower, double initial, double upper) throws NumericException
Bracket a root for the target function by creating and continuously expanding an interval around the initial point until the interval is known to contain at least one root. An interval is determined to contain at least one root when the function evaluation at the inteval endpoints are oppisite signs.- Parameters:
lower
- the lowest possible lower bound for the bracketting interval. The lower bound for the returned interval will never be smaller than lower.initial
- the start point used to create the bracketting interval.upper
- the largest possible upper bound for the bracketting interval. The upper bound for the returned interval will never be larger than upper.- Returns:
- a two element array containing the lower and upper bounds of the bracketting interval.
- Throws:
NumericException
- if a root could not be bracketed.
-
getFunction
public Function getFunction()
Access the target function.- Returns:
- the target function.
-
getMaximumIterations
public int getMaximumIterations()
Access the maximum number of iterations.- Returns:
- the maximum number of iterations.
-
setFunction
public void setFunction(Function f)
Modify the target function.- Parameters:
f
- the new target function.
-
setMaximumIterations
public void setMaximumIterations(int iterations)
Modify the maximum number of iterations.- Parameters:
iterations
- the new maximum number of iterations.
-
-
DMelt 3.0 © DataMelt by jWork.ORG