org.apache.commons.math.analysis
Class NewtonSolver
java.lang.Object
org.apache.commons.math.analysis.UnivariateRealSolverImpl
org.apache.commons.math.analysis.NewtonSolver
- All Implemented Interfaces:
- Serializable, UnivariateRealSolver
- public class NewtonSolver
- extends UnivariateRealSolverImpl
Implements
Newton's Method for finding zeros of real univariate functions.
The function should be continuous but not necessarily smooth.
- Version:
- $Revision: 348791 $ $Date: 2005-11-24 12:50:36 -0700 (Thu, 24 Nov 2005) $
- See Also:
- Serialized Form
| Fields inherited from class org.apache.commons.math.analysis.UnivariateRealSolverImpl |
absoluteAccuracy, defaultAbsoluteAccuracy, defaultFunctionValueAccuracy, defaultMaximalIterationCount, defaultRelativeAccuracy, f, functionValueAccuracy, iterationCount, maximalIterationCount, relativeAccuracy, result, resultComputed |
|
Method Summary |
double |
solve(double min,
double max)
Find a zero near the midpoint of min and max. |
double |
solve(double min,
double max,
double startValue)
Find a zero near the value startValue. |
| 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 |
NewtonSolver
public NewtonSolver(DifferentiableUnivariateRealFunction f)
- Construct a solver for the given function.
- Parameters:
f - function to solve.
solve
public double solve(double min,
double max)
throws ConvergenceException,
FunctionEvaluationException
- Find a zero near the midpoint of
min and max.
- Parameters:
min - the lower bound for the intervalmax - the upper bound for the interval
- Returns:
- the value where the function is zero
- Throws:
ConvergenceException - if the maximum iteration count is exceeded
FunctionEvaluationException - if an error occurs evaluating the
function or derivative
IllegalArgumentException - if min is not less than max
solve
public double solve(double min,
double max,
double startValue)
throws ConvergenceException,
FunctionEvaluationException
- Find a zero near the value
startValue.
- Parameters:
min - the lower bound for the interval (ignored).max - the upper bound for the interval (ignored).startValue - the start value to use.
- Returns:
- the value where the function is zero
- Throws:
ConvergenceException - if the maximum iteration count is exceeded
FunctionEvaluationException - if an error occurs evaluating the
function or derivative
IllegalArgumentException - if startValue is not between min and max
Copyright © 2003-2005 The Apache Software Foundation. All Rights Reserved.