org.apache.commons.math.analysis
Class RiddersSolver

java.lang.Object
  extended by org.apache.commons.math.analysis.UnivariateRealSolverImpl
      extended by org.apache.commons.math.analysis.RiddersSolver
All Implemented Interfaces:
java.io.Serializable, UnivariateRealSolver

public class RiddersSolver
extends UnivariateRealSolverImpl

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: 620312 $ $Date: 2008-02-10 12:28:59 -0700 (Sun, 10 Feb 2008) $
See Also:
Serialized Form

Field Summary
private static long serialVersionUID
          serializable version identifier
 
Fields inherited from class org.apache.commons.math.analysis.UnivariateRealSolverImpl
absoluteAccuracy, defaultAbsoluteAccuracy, defaultFunctionValueAccuracy, defaultMaximalIterationCount, defaultRelativeAccuracy, f, functionValueAccuracy, iterationCount, maximalIterationCount, relativeAccuracy, result, resultComputed
 
Constructor Summary
RiddersSolver(UnivariateRealFunction f)
          Construct a solver for the given function.
 
Method Summary
 double solve(double min, double max)
          Find a root in the given interval.
 double solve(double min, double max, double initial)
          Find a root in the given interval with initial value.
 
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
 

Field Detail

serialVersionUID

private static final long serialVersionUID
serializable version identifier

See Also:
Constant Field Values
Constructor Detail

RiddersSolver

public RiddersSolver(UnivariateRealFunction f)
Construct a solver for the given function.

Parameters:
f - function to solve
Method Detail

solve

public double solve(double min,
                    double max,
                    double initial)
             throws MaxIterationsExceededException,
                    FunctionEvaluationException
Find a root in the given interval with initial value.

Requires bracketing condition.

Parameters:
min - the lower bound for the interval
max - the upper bound for the interval
initial - the start value to use
Returns:
the point at which the function value is zero
Throws:
MaxIterationsExceededException - if the maximum iteration count is exceeded
FunctionEvaluationException - if an error occurs evaluating the function
java.lang.IllegalArgumentException - if any parameters are invalid

solve

public double solve(double min,
                    double max)
             throws MaxIterationsExceededException,
                    FunctionEvaluationException
Find a root in the given interval.

Requires bracketing condition.

Parameters:
min - the lower bound for the interval
max - the upper bound for the interval
Returns:
the point at which the function value is zero
Throws:
MaxIterationsExceededException - if the maximum iteration count is exceeded
FunctionEvaluationException - if an error occurs evaluating the function
java.lang.IllegalArgumentException - if any parameters are invalid