|
|||||||||
PREV CLASS NEXT CLASS | All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.analysis.UnivariateRealSolverImpl
org.apache.commons.math.analysis.SecantSolver
public class SecantSolver
Implements a modified version of the secant method for approximating a zero of a real univariate function.
The algorithm is modified to maintain bracketing of a root by successive approximations. Because of forced bracketing, convergence may be slower than the unrestricted secant algorithm. However, this implementation should in general outperform the regula falsi method.
The function is assumed to be continuous but not necessarily smooth.
Constructor Summary | |
---|---|
SecantSolver(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. |
Methods inherited from class org.apache.commons.math.analysis.UnivariateRealSolverImpl |
---|
getAbsoluteAccuracy, getFunctionValueAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, getResult, resetAbsoluteAccuracy, resetFunctionValueAccuracy, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setFunctionValueAccuracy, setMaximalIterationCount, setRelativeAccuracy |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SecantSolver(UnivariateRealFunction f)
f
- function to solve.Method Detail |
---|
public double solve(double min, double max, double initial) throws ConvergenceException, FunctionEvaluationException
solve
in interface UnivariateRealSolver
min
- the lower bound for the intervalmax
- the upper bound for the intervalinitial
- the start value to use (ignored)
ConvergenceException
- 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 oppositespublic double solve(double min, double max) throws ConvergenceException, FunctionEvaluationException
solve
in interface UnivariateRealSolver
min
- the lower bound for the interval.max
- the upper bound for the interval.
ConvergenceException
- 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 | All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |