|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.analysis.UnivariateRealSolverImpl
org.apache.commons.math.analysis.BrentSolver
public class BrentSolver
Implements the Brent algorithm for finding zeros of real univariate functions.
The function should be continuous but not necessarily smooth.
Field Summary |
---|
Fields inherited from class org.apache.commons.math.analysis.UnivariateRealSolverImpl |
---|
absoluteAccuracy, defaultAbsoluteAccuracy, defaultFunctionValueAccuracy, defaultMaximalIterationCount, defaultRelativeAccuracy, f, functionValueAccuracy, iterationCount, maximalIterationCount, relativeAccuracy, result, resultComputed |
Constructor Summary | |
---|---|
BrentSolver(UnivariateRealFunction f)
Construct a solver for the given function. |
Method Summary | |
---|---|
double |
solve(double min,
double max)
Find a zero in the given interval. |
double |
solve(double min,
double max,
double initial)
Find a zero in the given interval with an initial guess. |
Methods inherited from class org.apache.commons.math.analysis.UnivariateRealSolverImpl |
---|
clearResult, getAbsoluteAccuracy, getFunctionValueAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, getResult, isBracketing, isSequence, resetAbsoluteAccuracy, resetFunctionValueAccuracy, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setFunctionValueAccuracy, setMaximalIterationCount, setRelativeAccuracy, setResult, verifyBracketing, verifyInterval, verifySequence |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BrentSolver(UnivariateRealFunction f)
f
- function to solve.Method Detail |
---|
public double solve(double min, double max, double initial) throws MaxIterationsExceededException, FunctionEvaluationException
Throws IllegalArgumentException
if the values of the
function at the three points have the same sign (note that it is
allowed to have endpoints with the same sign if the initial point has
opposite sign function-wise).
min
- the lower bound for the interval.max
- the upper bound for the interval.initial
- the start value to use (must be set to min if no
initial point is known).
MaxIterationsExceededException
- the maximum iteration count
is exceeded
FunctionEvaluationException
- if an error occurs evaluating
the function
java.lang.IllegalArgumentException
- if initial is not between min and max
(even if it is a root)public double solve(double min, double max) throws MaxIterationsExceededException, FunctionEvaluationException
Requires that the values of the function at the endpoints have opposite
signs. An IllegalArgumentException
is thrown if this is not
the case.
min
- the lower bound for the interval.max
- the upper bound for the interval.
MaxIterationsExceededException
- if the maximum iteration count is exceeded
FunctionEvaluationException
- if an error occurs evaluating the
function
java.lang.IllegalArgumentException
- if min is not less than max or the
signs of the values of the function at the endpoints are not opposites
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |