|
||||||||||
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.NewtonSolver
public class NewtonSolver
Implements Newton's Method for finding zeros of real univariate functions.
The function should be continuous but not necessarily smooth.
Field Summary | |
---|---|
private UnivariateRealFunction |
derivative
The first derivative of the target function. |
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 | |
---|---|
NewtonSolver(DifferentiableUnivariateRealFunction f)
Construct a solver for the given function. |
Method Summary | |
---|---|
private void |
readObject(java.io.ObjectInputStream in)
Custom deserialization to initialize transient deriviate field. |
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 |
Field Detail |
---|
private static final long serialVersionUID
private transient UnivariateRealFunction derivative
Constructor Detail |
---|
public NewtonSolver(DifferentiableUnivariateRealFunction f)
f
- function to solve.Method Detail |
---|
public double solve(double min, double max) throws MaxIterationsExceededException, FunctionEvaluationException
min
and max
.
min
- the lower bound for the intervalmax
- the upper bound for the interval
MaxIterationsExceededException
- if the maximum iteration count is exceeded
FunctionEvaluationException
- if an error occurs evaluating the
function or derivative
java.lang.IllegalArgumentException
- if min is not less than maxpublic double solve(double min, double max, double startValue) throws MaxIterationsExceededException, FunctionEvaluationException
startValue
.
min
- the lower bound for the interval (ignored).max
- the upper bound for the interval (ignored).startValue
- the start value to use.
MaxIterationsExceededException
- if the maximum iteration count is exceeded
FunctionEvaluationException
- if an error occurs evaluating the
function or derivative
java.lang.IllegalArgumentException
- if startValue is not between min and maxprivate void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- serialized object input stream
java.io.IOException
- if IO error occurs
java.lang.ClassNotFoundException
- if instantiation error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |