org.apache.commons.math.analysis.solvers
@Deprecated public abstract class UnivariateRealSolverImpl extends ConvergingAlgorithmImpl implements UnivariateRealSolver
Modifier and Type | Field and Description |
---|---|
protected double |
defaultFunctionValueAccuracy
Deprecated.
Default maximum error of function.
|
protected UnivariateRealFunction |
f
Deprecated.
as of 2.0 the function to solve is passed as an argument
to the
UnivariateRealSolver.solve(UnivariateRealFunction, double, double) or
UnivariateRealSolver.solve(UnivariateRealFunction, double, double, double)
method. |
protected double |
functionValue
Deprecated.
Value of the function at the last computed result.
|
protected double |
functionValueAccuracy
Deprecated.
Maximum error of function.
|
protected double |
result
Deprecated.
The last computed root.
|
protected boolean |
resultComputed
Deprecated.
Indicates where a root has been computed.
|
absoluteAccuracy, defaultAbsoluteAccuracy, defaultMaximalIterationCount, defaultRelativeAccuracy, iterationCount, maximalIterationCount, relativeAccuracy
Modifier | Constructor and Description |
---|---|
protected |
UnivariateRealSolverImpl(int defaultMaximalIterationCount,
double defaultAbsoluteAccuracy)
Deprecated.
Construct a solver with given iteration count and accuracy.
|
protected |
UnivariateRealSolverImpl(UnivariateRealFunction f,
int defaultMaximalIterationCount,
double defaultAbsoluteAccuracy)
Deprecated.
as of 2.0 the function to solve is passed as an argument
to the
UnivariateRealSolver.solve(UnivariateRealFunction, double, double) or
UnivariateRealSolver.solve(UnivariateRealFunction, double, double, double)
method. |
Modifier and Type | Method and Description |
---|---|
protected void |
checkResultComputed()
Deprecated.
Check if a result has been computed.
|
protected void |
clearResult()
Deprecated.
Convenience function for implementations.
|
double |
getFunctionValue()
Deprecated.
Get the result of the last run of the solver.
|
double |
getFunctionValueAccuracy()
Deprecated.
Get the actual function value accuracy.
|
double |
getResult()
Deprecated.
Get the result of the last run of the solver.
|
protected boolean |
isBracketing(double lower,
double upper,
UnivariateRealFunction function)
Deprecated.
Returns true iff the function takes opposite signs at the endpoints.
|
protected boolean |
isSequence(double start,
double mid,
double end)
Deprecated.
Returns true if the arguments form a (strictly) increasing sequence
|
void |
resetFunctionValueAccuracy()
Deprecated.
Reset the actual function accuracy to the default.
|
void |
setFunctionValueAccuracy(double accuracy)
Deprecated.
Set the function value accuracy.
|
protected void |
setResult(double x,
double fx,
int iterationCount)
Deprecated.
Convenience function for implementations.
|
protected void |
setResult(double newResult,
int iterationCount)
Deprecated.
Convenience function for implementations.
|
double |
solve(int maxEval,
UnivariateRealFunction function,
double min,
double max)
Deprecated.
Solve for a zero root in the given interval.
|
double |
solve(int maxEval,
UnivariateRealFunction function,
double min,
double max,
double startValue)
Deprecated.
Solve for a zero in the given interval, start at startValue.
|
protected void |
verifyBracketing(double lower,
double upper,
UnivariateRealFunction function)
Deprecated.
Verifies that the endpoints specify an interval and the function takes
opposite signs at the endpoints, throws IllegalArgumentException if not
|
protected void |
verifyInterval(double lower,
double upper)
Deprecated.
Verifies that the endpoints specify an interval,
throws IllegalArgumentException if not
|
protected void |
verifySequence(double lower,
double initial,
double upper)
Deprecated.
Verifies that
lower < initial < upper
throws IllegalArgumentException if not |
getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, incrementIterationsCounter, resetAbsoluteAccuracy, resetIterationsCounter, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
solve, solve, solve, solve
getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, resetAbsoluteAccuracy, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy
protected double functionValueAccuracy
protected double defaultFunctionValueAccuracy
protected boolean resultComputed
protected double result
protected double functionValue
@Deprecated protected UnivariateRealFunction f
UnivariateRealSolver.solve(UnivariateRealFunction, double, double)
or
UnivariateRealSolver.solve(UnivariateRealFunction, double, double, double)
method.@Deprecated protected UnivariateRealSolverImpl(UnivariateRealFunction f, int defaultMaximalIterationCount, double defaultAbsoluteAccuracy)
UnivariateRealSolver.solve(UnivariateRealFunction, double, double)
or
UnivariateRealSolver.solve(UnivariateRealFunction, double, double, double)
method.f
- the function to solve.defaultAbsoluteAccuracy
- maximum absolute errordefaultMaximalIterationCount
- maximum number of iterationsIllegalArgumentException
- if f is null or the
defaultAbsoluteAccuracy is not validprotected UnivariateRealSolverImpl(int defaultMaximalIterationCount, double defaultAbsoluteAccuracy)
defaultAbsoluteAccuracy
- maximum absolute errordefaultMaximalIterationCount
- maximum number of iterationsIllegalArgumentException
- if f is null or the
defaultAbsoluteAccuracy is not validprotected void checkResultComputed() throws IllegalStateException
IllegalStateException
- if no result has been computedpublic double getResult()
getResult
in interface UnivariateRealSolver
public double getFunctionValue()
getFunctionValue
in interface UnivariateRealSolver
public void setFunctionValueAccuracy(double accuracy)
This is used to determine when an evaluated function value or some other value which is used as divisor is zero.
This is a safety guard and it shouldn't be necessary to change this in general.
setFunctionValueAccuracy
in interface UnivariateRealSolver
accuracy
- the accuracy.public double getFunctionValueAccuracy()
getFunctionValueAccuracy
in interface UnivariateRealSolver
public void resetFunctionValueAccuracy()
resetFunctionValueAccuracy
in interface UnivariateRealSolver
public double solve(int maxEval, UnivariateRealFunction function, double min, double max) throws ConvergenceException, FunctionEvaluationException
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.
function
- the function to solve.min
- the lower bound for the interval.max
- the upper bound for the interval.maxEval
- Maximum number of evaluations.ConvergenceException
- if the maximum iteration count is exceeded
or the solver detects convergence problems otherwise.FunctionEvaluationException
- if an error occurs evaluating the functionIllegalArgumentException
- if min > max or the endpoints do not
satisfy the requirements specified by the solverpublic double solve(int maxEval, UnivariateRealFunction function, double min, double max, double startValue) throws ConvergenceException, FunctionEvaluationException, IllegalArgumentException
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.
function
- the function to solve.min
- the lower bound for the interval.max
- the upper bound for the interval.startValue
- the start value to usemaxEval
- Maximum number of evaluations.ConvergenceException
- if the maximum iteration count is exceeded
or the solver detects convergence problems otherwise.FunctionEvaluationException
- if an error occurs evaluating the functionIllegalArgumentException
- if min > max or the arguments do not
satisfy the requirements specified by the solverprotected final void setResult(double newResult, int iterationCount)
newResult
- the result to setiterationCount
- the iteration count to setprotected final void setResult(double x, double fx, int iterationCount)
x
- the result to setfx
- the result to setiterationCount
- the iteration count to setprotected final void clearResult()
protected boolean isBracketing(double lower, double upper, UnivariateRealFunction function) throws FunctionEvaluationException
lower
- the lower endpointupper
- the upper endpointfunction
- the functionFunctionEvaluationException
- if an error occurs evaluating the function at the endpointsprotected boolean isSequence(double start, double mid, double end)
start
- first numbermid
- second numberend
- third numberprotected void verifyInterval(double lower, double upper)
lower
- lower endpointupper
- upper endpointIllegalArgumentException
protected void verifySequence(double lower, double initial, double upper)
lower < initial < upper
throws IllegalArgumentException if notlower
- lower endpointinitial
- initial valueupper
- upper endpointIllegalArgumentException
protected void verifyBracketing(double lower, double upper, UnivariateRealFunction function) throws FunctionEvaluationException
lower
- lower endpointupper
- upper endpointfunction
- functionIllegalArgumentException
FunctionEvaluationException
- if an error occurs evaluating the function at the endpointsCopyright (c) 2003-2014 Apache Software Foundation