|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.analysis.UnivariateRealSolverImpl
Provide a default implementation for several functions useful to generic solvers.
Field Summary | |
protected double |
absoluteAccuracy
Maximum absolute error. |
protected double |
defaultAbsoluteAccuracy
Default maximum absolute error. |
protected double |
defaultFunctionValueAccuracy
Default maximum error of function. |
protected int |
defaultMaximalIterationCount
Default maximum number of iterations. |
protected double |
defaultRelativeAccuracy
Default maximum relative error. |
protected UnivariateRealFunction |
f
The function to solve. |
protected double |
functionValueAccuracy
Maximum error of function. |
protected int |
iterationCount
The last iteration count. |
protected int |
maximalIterationCount
Maximum number of iterations. |
protected double |
relativeAccuracy
Maximum relative error. |
protected double |
result
The last computed root. |
protected boolean |
resultComputed
Indicates where a root has been computed. |
(package private) static long |
serialVersionUID
Serializable version identifier |
Constructor Summary | |
protected |
UnivariateRealSolverImpl(UnivariateRealFunction f,
int defaultMaximalIterationCount,
double defaultAbsoluteAccuracy)
Construct a solver with given iteration count and accuracy. |
Method Summary | |
protected void |
clearResult()
Convenience function for implementations. |
double |
getAbsoluteAccuracy()
Get the actual absolute accuracy. |
double |
getFunctionValueAccuracy()
Get the actual function value accuracy. |
int |
getIterationCount()
Access the last iteration count. |
int |
getMaximalIterationCount()
Get the upper limit for the number of iterations. |
double |
getRelativeAccuracy()
Get the actual relative accuracy. |
double |
getResult()
Access the last computed root. |
protected boolean |
isBracketing(double lower,
double upper,
UnivariateRealFunction f)
Returns true iff the function takes opposite signs at the endpoints. |
protected boolean |
isSequence(double start,
double mid,
double end)
Returns true if the arguments form a (strictly) increasing sequence |
void |
resetAbsoluteAccuracy()
Reset the absolute accuracy to the default. |
void |
resetFunctionValueAccuracy()
Reset the actual function accuracy to the default. |
void |
resetMaximalIterationCount()
Reset the upper limit for the number of iterations to the default. |
void |
resetRelativeAccuracy()
Reset the relative accuracy to the default. |
void |
setAbsoluteAccuracy(double accuracy)
Set the absolute accuracy. |
void |
setFunctionValueAccuracy(double accuracy)
Set the function value accuracy. |
void |
setMaximalIterationCount(int count)
Set the upper limit for the number of iterations. |
void |
setRelativeAccuracy(double accuracy)
Set the relative accuracy. |
protected void |
setResult(double result,
int iterationCount)
Convenience function for implementations. |
protected void |
verifyBracketing(double lower,
double upper,
UnivariateRealFunction f)
Verifies that the endpoints specify an interval and the function takes opposite signs at the enpoints, throws IllegalArgumentException if not |
protected void |
verifyInterval(double lower,
double upper)
Verifies that the endpoints specify an interval, throws IllegalArgumentException if not |
protected void |
verifySequence(double lower,
double initial,
double upper)
Verifies that lower < initial < upper
throws IllegalArgumentException if not |
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.analysis.UnivariateRealSolver |
solve, solve |
Field Detail |
static final long serialVersionUID
protected double absoluteAccuracy
protected double relativeAccuracy
protected double functionValueAccuracy
protected int maximalIterationCount
protected double defaultAbsoluteAccuracy
protected double defaultRelativeAccuracy
protected double defaultFunctionValueAccuracy
protected int defaultMaximalIterationCount
protected boolean resultComputed
protected double result
protected int iterationCount
protected UnivariateRealFunction f
Constructor Detail |
protected UnivariateRealSolverImpl(UnivariateRealFunction f, int defaultMaximalIterationCount, double defaultAbsoluteAccuracy)
f
- the function to solve.defaultAbsoluteAccuracy
- maximum absolute errordefaultMaximalIterationCount
- maximum number of iterations
IllegalArgumentException
- if f is null or the
defaultAbsoluteAccuracy is not validMethod Detail |
public double getResult()
getResult
in interface UnivariateRealSolver
IllegalStateException
- if no root has been computedpublic int getIterationCount()
getIterationCount
in interface UnivariateRealSolver
IllegalStateException
- if no root has been computedprotected final void setResult(double result, int iterationCount)
result
- the result to setiterationCount
- the iteration count to setprotected final void clearResult()
public void setAbsoluteAccuracy(double accuracy)
setAbsoluteAccuracy
in interface UnivariateRealSolver
accuracy
- the accuracy.
IllegalArgumentException
- if the accuracy can't be achieved by
the solver or is otherwise deemed unreasonable.public double getAbsoluteAccuracy()
getAbsoluteAccuracy
in interface UnivariateRealSolver
public void resetAbsoluteAccuracy()
resetAbsoluteAccuracy
in interface UnivariateRealSolver
public void setMaximalIterationCount(int count)
setMaximalIterationCount
in interface UnivariateRealSolver
count
- maximum number of iterationspublic int getMaximalIterationCount()
getMaximalIterationCount
in interface UnivariateRealSolver
public void resetMaximalIterationCount()
resetMaximalIterationCount
in interface UnivariateRealSolver
UnivariateRealSolver.setMaximalIterationCount(int)
public void setRelativeAccuracy(double accuracy)
setRelativeAccuracy
in interface UnivariateRealSolver
accuracy
- the relative accuracy.
IllegalArgumentException
- if the accuracy can't be achieved by
the solver or is otherwise deemed unreasonable.public double getRelativeAccuracy()
getRelativeAccuracy
in interface UnivariateRealSolver
public void resetRelativeAccuracy()
resetRelativeAccuracy
in interface UnivariateRealSolver
public void setFunctionValueAccuracy(double accuracy)
setFunctionValueAccuracy
in interface UnivariateRealSolver
accuracy
- the accuracy.
IllegalArgumentException
- if the accuracy can't be achieved by
the solver or is otherwise deemed unreasonable.public double getFunctionValueAccuracy()
getFunctionValueAccuracy
in interface UnivariateRealSolver
public void resetFunctionValueAccuracy()
resetFunctionValueAccuracy
in interface UnivariateRealSolver
protected boolean isBracketing(double lower, double upper, UnivariateRealFunction f) throws FunctionEvaluationException
lower
- the lower endpointupper
- the upper endpointf
- the function
FunctionEvaluationException
- if an error occurs evaluating the
function at the endpointsprotected boolean isSequence(double start, double mid, double end)
start
- first numbermid
- second numberend
- third number
protected void verifyInterval(double lower, double upper)
lower
- lower endpointupper
- upper endpoint
IllegalArgumentException
protected void verifySequence(double lower, double initial, double upper)
lower < initial < upper
throws IllegalArgumentException if not
lower
- lower endpointinitial
- initial valueupper
- upper endpoint
IllegalArgumentException
protected void verifyBracketing(double lower, double upper, UnivariateRealFunction f) throws FunctionEvaluationException
lower
- lower endpointupper
- upper endpointf
- function
IllegalArgumentException
FunctionEvaluationException
- if an error occurs evaluating the
function at the endpoints
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |