Class RiddersSolver
java.lang.Object
org.apache.commons.math.ConvergingAlgorithmImpl
org.apache.commons.math.analysis.solvers.UnivariateRealSolverImpl
org.apache.commons.math.analysis.solvers.RiddersSolver
- All Implemented Interfaces:
UnivariateRealSolver
,ConvergingAlgorithm
Implements the
Ridders' Method for root finding of real univariate functions. For
reference, see C. Ridders, A new algorithm for computing a single root
of a real continuous function , IEEE Transactions on Circuits and
Systems, 26 (1979), 979 - 980.
The function should be continuous but not necessarily smooth.
- Since:
- 1.2
- Version:
- $Revision: 1070725 $ $Date: 2011-02-15 02:31:12 +0100 (mar. 15 févr. 2011) $
-
Field Summary
Fields inherited from class org.apache.commons.math.analysis.solvers.UnivariateRealSolverImpl
defaultFunctionValueAccuracy, f, functionValue, functionValueAccuracy, result, resultComputed
Fields inherited from class org.apache.commons.math.ConvergingAlgorithmImpl
absoluteAccuracy, defaultAbsoluteAccuracy, defaultMaximalIterationCount, defaultRelativeAccuracy, iterationCount, maximalIterationCount, relativeAccuracy
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.in 2.2Deprecated.as of 2.0 the function to solve is passed as an argument to thesolve(UnivariateRealFunction, double, double)
orUnivariateRealSolver.solve(UnivariateRealFunction, double, double, double)
method. -
Method Summary
Modifier and TypeMethodDescriptiondouble
solve
(double min, double max) Deprecated.double
solve
(double min, double max, double initial) Deprecated.double
solve
(int maxEval, UnivariateRealFunction f, double min, double max) Find a root in the given interval.double
solve
(int maxEval, UnivariateRealFunction f, double min, double max, double initial) Find a root in the given interval with initial value.double
solve
(UnivariateRealFunction f, double min, double max) Deprecated.in 2.2 (to be removed in 3.0).double
solve
(UnivariateRealFunction f, double min, double max, double initial) Deprecated.in 2.2 (to be removed in 3.0).Methods inherited from class org.apache.commons.math.analysis.solvers.UnivariateRealSolverImpl
checkResultComputed, clearResult, getFunctionValue, getFunctionValueAccuracy, getResult, isBracketing, isSequence, resetFunctionValueAccuracy, setFunctionValueAccuracy, setResult, setResult, verifyBracketing, verifyInterval, verifySequence
Methods inherited from class org.apache.commons.math.ConvergingAlgorithmImpl
getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, incrementIterationsCounter, resetAbsoluteAccuracy, resetIterationsCounter, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.commons.math.ConvergingAlgorithm
getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, resetAbsoluteAccuracy, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy
-
Constructor Details
-
RiddersSolver
Deprecated.as of 2.0 the function to solve is passed as an argument to thesolve(UnivariateRealFunction, double, double)
orUnivariateRealSolver.solve(UnivariateRealFunction, double, double, double)
method.Construct a solver for the given function.- Parameters:
f
- function to solve
-
RiddersSolver
Deprecated.in 2.2Construct a solver.
-
-
Method Details
-
solve
@Deprecated public double solve(double min, double max) throws ConvergenceException, FunctionEvaluationException Deprecated.Solve for a zero root in the given interval.A solver may require that the interval brackets a single zero root. Solvers that do require bracketing should be able to handle the case where one of the endpoints is itself a root.
- Parameters:
min
- the lower bound for the interval.max
- the upper bound for the interval.- Returns:
- a value where the function is zero
- Throws:
ConvergenceException
- if the maximum iteration count is exceeded or the solver detects convergence problems otherwise.FunctionEvaluationException
- if an error occurs evaluating the function
-
solve
@Deprecated public double solve(double min, double max, double initial) throws ConvergenceException, FunctionEvaluationException Deprecated.Solve for a zero in the given interval, start at startValue.A solver may require that the interval brackets a single zero root. Solvers that do require bracketing should be able to handle the case where one of the endpoints is itself a root.
- Parameters:
min
- the lower bound for the interval.max
- the upper bound for the interval.initial
- the start value to use- Returns:
- a value where the function is zero
- Throws:
ConvergenceException
- if the maximum iteration count is exceeded or the solver detects convergence problems otherwise.FunctionEvaluationException
- if an error occurs evaluating the function
-
solve
public double solve(int maxEval, UnivariateRealFunction f, double min, double max, double initial) throws MaxIterationsExceededException, FunctionEvaluationException Find a root in the given interval with initial value.Requires bracketing condition.
- Overrides:
solve
in classUnivariateRealSolverImpl
- Parameters:
f
- the function to solvemin
- the lower bound for the intervalmax
- the upper bound for the intervalinitial
- the start value to usemaxEval
- Maximum number of evaluations.- Returns:
- the point at which the function value is zero
- Throws:
MaxIterationsExceededException
- if the maximum iteration count is exceededFunctionEvaluationException
- if an error occurs evaluating the functionIllegalArgumentException
- if any parameters are invalid
-
solve
@Deprecated public double solve(UnivariateRealFunction f, double min, double max, double initial) throws MaxIterationsExceededException, FunctionEvaluationException Deprecated.in 2.2 (to be removed in 3.0).Find a root in the given interval with initial value.Requires bracketing condition.
- Parameters:
f
- the function to solvemin
- the lower bound for the intervalmax
- the upper bound for the intervalinitial
- the start value to use- Returns:
- the point at which the function value is zero
- Throws:
MaxIterationsExceededException
- if the maximum iteration count is exceededFunctionEvaluationException
- if an error occurs evaluating the functionIllegalArgumentException
- if any parameters are invalid
-
solve
public double solve(int maxEval, UnivariateRealFunction f, double min, double max) throws MaxIterationsExceededException, FunctionEvaluationException Find a root in the given interval.Requires bracketing condition.
- Overrides:
solve
in classUnivariateRealSolverImpl
- Parameters:
f
- the function to solvemin
- the lower bound for the intervalmax
- the upper bound for the intervalmaxEval
- Maximum number of evaluations.- Returns:
- the point at which the function value is zero
- Throws:
MaxIterationsExceededException
- if the maximum iteration count is exceededFunctionEvaluationException
- if an error occurs evaluating the functionIllegalArgumentException
- if any parameters are invalid
-
solve
@Deprecated public double solve(UnivariateRealFunction f, double min, double max) throws MaxIterationsExceededException, FunctionEvaluationException Deprecated.in 2.2 (to be removed in 3.0).Find a root in the given interval.Requires bracketing condition.
- Parameters:
f
- the function to solvemin
- the lower bound for the intervalmax
- the upper bound for the interval- Returns:
- the point at which the function value is zero
- Throws:
MaxIterationsExceededException
- if the maximum iteration count is exceededFunctionEvaluationException
- if an error occurs evaluating the functionIllegalArgumentException
- if any parameters are invalid
-