|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for (univariate real) rootfinding algorithms.
Implementations will search for only one zero in the given interval.
Method Summary | |
double |
getAbsoluteAccuracy()
Get the actual absolute accuracy. |
double |
getFunctionValueAccuracy()
Get the actual function value accuracy. |
int |
getIterationCount()
Get the number of iterations in the last run of the solver. |
int |
getMaximalIterationCount()
Get the upper limit for the number of iterations. |
double |
getRelativeAccuracy()
Get the actual relative accuracy. |
double |
getResult()
Get the result of the last run of the solver. |
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. |
double |
solve(double min,
double max)
Solve for a zero root in the given interval. |
double |
solve(double min,
double max,
double startValue)
Solve for a zero in the given interval, start at startValue. |
Method Detail |
public void setMaximalIterationCount(int count)
Usually a high iteration count indicates convergence problems. However, the "reasonable value" varies widely for different solvers. Users are advised to use the default value supplied by the solver.
A ConvergenceException
will be thrown if this number
is exceeded.
count
- maximum number of iterationspublic int getMaximalIterationCount()
public void resetMaximalIterationCount()
The default value is supplied by the solver implementation.
setMaximalIterationCount(int)
public void setAbsoluteAccuracy(double accuracy)
The default is usually choosen so that roots in the interval -10..-0.1 and +0.1..+10 can be found with a reasonable accuracy. If the expected absolute value of your roots is of much smaller magnitude, set this to a smaller value.
Solvers are advised to do a plausibility check with the relative accuracy, but clients should not rely on this.
accuracy
- the accuracy.
IllegalArgumentException
- if the accuracy can't be achieved by
the solver or is otherwise deemed unreasonable.public double getAbsoluteAccuracy()
public void resetAbsoluteAccuracy()
The default value is provided by the solver implementation.
public void setRelativeAccuracy(double accuracy)
This is used to stop iterations if the absolute accuracy can't be achieved due to large values or short mantissa length.
If this should be the primary criterion for convergence rather then a safety measure, set the absolute accuracy to a ridiculously small value, like 1E-1000.
accuracy
- the relative accuracy.
IllegalArgumentException
- if the accuracy can't be achieved by
the solver or is otherwise deemed unreasonable.public double getRelativeAccuracy()
public void resetRelativeAccuracy()
public void setFunctionValueAccuracy(double accuracy)
This is used to determine whan 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 necesary to change this in general.
accuracy
- the accuracy.
IllegalArgumentException
- if the accuracy can't be achieved by
the solver or is otherwise deemed unreasonable.public double getFunctionValueAccuracy()
public void resetFunctionValueAccuracy()
public double solve(double min, double max) throws ConvergenceException, FunctionEvaluationException
min
- the lower bound for the interval.max
- the upper bound for the interval.
ConvergenceException
- if the maximum iteration count is exceeded
or the solver detects convergence problems otherwise.
FunctionEvaluationException
- if an error occurs evaluating the
function
IllegalArgumentException
- if min > max or the endpoints do not
satisfy the requirements specified by the solverpublic double solve(double min, double max, double startValue) throws ConvergenceException, FunctionEvaluationException
min
- the lower bound for the interval.max
- the upper bound for the interval.startValue
- the start value to use
ConvergenceException
- if the maximum iteration count is exceeded
or the solver detects convergence problems otherwise.
FunctionEvaluationException
- if an error occurs evaluating the
function
IllegalArgumentException
- if min > max or the arguments do not
satisfy the requirements specified by the solverpublic double getResult()
IllegalStateException
- if there is no result available, either
because no result was yet computed or the last attempt failed.public int getIterationCount()
This is mainly meant for testing purposes. It may occasionally help track down performance problems: if the iteration count is notoriously high, check whether the function is evaluated properly, and whether another solver is more amenable to the problem.
IllegalStateException
- if there is no result available, either
because no result was yet computed or the last attempt failed.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |