|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.ConvergingAlgorithmImpl
org.apache.commons.math.analysis.solvers.UnivariateRealSolverImpl
org.apache.commons.math.analysis.solvers.MullerSolver
public class MullerSolver
Implements the Muller's Method for root finding of real univariate functions. For reference, see Elementary Numerical Analysis, ISBN 0070124477, chapter 3.
Muller's method applies to both real and complex functions, but here we restrict ourselves to real functions. Methods solve() and solve2() find real zeros, using different ways to bypass complex arithmetics.
Field Summary |
---|
Fields inherited from class org.apache.commons.math.analysis.solvers.UnivariateRealSolverImpl |
---|
defaultFunctionValueAccuracy, f, functionValue, functionValueAccuracy, result, resultComputed |
Fields inherited from class org.apache.commons.math.ConvergingAlgorithmImpl |
---|
absoluteAccuracy, defaultAbsoluteAccuracy, defaultMaximalIterationCount, defaultRelativeAccuracy, iterationCount, maximalIterationCount, relativeAccuracy |
Constructor Summary | |
---|---|
MullerSolver()
Deprecated. in 2.2 (to be removed in 3.0). |
|
MullerSolver(UnivariateRealFunction f)
Deprecated. as of 2.0 the function to solve is passed as an argument to the solve(UnivariateRealFunction, double, double) or
UnivariateRealSolver.solve(UnivariateRealFunction, double, double, double)
method. |
Method Summary | |
---|---|
double |
solve(double min,
double max)
Deprecated. |
double |
solve(double min,
double max,
double initial)
Deprecated. |
double |
solve(int maxEval,
UnivariateRealFunction f,
double min,
double max)
Find a real root in the given interval. |
double |
solve(int maxEval,
UnivariateRealFunction f,
double min,
double max,
double initial)
Find a real root in the given interval with initial value. |
double |
solve(UnivariateRealFunction f,
double min,
double max)
Deprecated. in 2.2 (to be removed in 3.0). |
double |
solve(UnivariateRealFunction f,
double min,
double max,
double initial)
Deprecated. in 2.2 (to be removed in 3.0). |
double |
solve2(double min,
double max)
Deprecated. replaced by solve2(UnivariateRealFunction, double, double)
since 2.0 |
double |
solve2(UnivariateRealFunction f,
double min,
double max)
Deprecated. in 2.2 (to be removed in 3.0). |
Methods inherited from class org.apache.commons.math.analysis.solvers.UnivariateRealSolverImpl |
---|
checkResultComputed, clearResult, getFunctionValue, getFunctionValueAccuracy, getResult, isBracketing, isSequence, resetFunctionValueAccuracy, setFunctionValueAccuracy, setResult, setResult, verifyBracketing, verifyInterval, verifySequence |
Methods inherited from class org.apache.commons.math.ConvergingAlgorithmImpl |
---|
getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, incrementIterationsCounter, resetAbsoluteAccuracy, resetIterationsCounter, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy |
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.ConvergingAlgorithm |
---|
getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, resetAbsoluteAccuracy, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy |
Constructor Detail |
---|
@Deprecated public MullerSolver(UnivariateRealFunction f)
solve(UnivariateRealFunction, double, double)
or
UnivariateRealSolver.solve(UnivariateRealFunction, double, double, double)
method.
f
- function to solve@Deprecated public MullerSolver()
Method Detail |
---|
@Deprecated public double solve(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.
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@Deprecated public double solve(double min, double max, double initial) 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.
min
- the lower bound for the interval.max
- the upper bound for the interval.initial
- 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 functionpublic double solve(int maxEval, UnivariateRealFunction f, double min, double max, double initial) throws MaxIterationsExceededException, FunctionEvaluationException
Requires bracketing condition.
solve
in class UnivariateRealSolverImpl
f
- the function to solvemin
- the lower bound for the intervalmax
- the upper bound for the intervalinitial
- the start value to usemaxEval
- Maximum number of evaluations.
MaxIterationsExceededException
- if the maximum iteration count is exceeded
or the solver detects convergence problems otherwise
FunctionEvaluationException
- if an error occurs evaluating the function
java.lang.IllegalArgumentException
- if any parameters are invalid@Deprecated public double solve(UnivariateRealFunction f, double min, double max, double initial) throws MaxIterationsExceededException, FunctionEvaluationException
Requires bracketing condition.
f
- the function to solvemin
- the lower bound for the intervalmax
- the upper bound for the intervalinitial
- the start value to use
MaxIterationsExceededException
- if the maximum iteration count is exceeded
or the solver detects convergence problems otherwise
FunctionEvaluationException
- if an error occurs evaluating the function
java.lang.IllegalArgumentException
- if any parameters are invalidpublic double solve(int maxEval, UnivariateRealFunction f, double min, double max) throws MaxIterationsExceededException, FunctionEvaluationException
Original Muller's method would have function evaluation at complex point. Since our f(x) is real, we have to find ways to avoid that. Bracketing condition is one way to go: by requiring bracketing in every iteration, the newly computed approximation is guaranteed to be real.
Normally Muller's method converges quadratically in the vicinity of a zero, however it may be very slow in regions far away from zeros. For example, f(x) = exp(x) - 1, min = -50, max = 100. In such case we use bisection as a safety backup if it performs very poorly.
The formulas here use divided differences directly.
solve
in class UnivariateRealSolverImpl
f
- the function to solvemin
- the lower bound for the intervalmax
- the upper bound for the intervalmaxEval
- Maximum number of evaluations.
MaxIterationsExceededException
- if the maximum iteration count is exceeded
or the solver detects convergence problems otherwise
FunctionEvaluationException
- if an error occurs evaluating the function
java.lang.IllegalArgumentException
- if any parameters are invalid@Deprecated public double solve(UnivariateRealFunction f, double min, double max) throws MaxIterationsExceededException, FunctionEvaluationException
Original Muller's method would have function evaluation at complex point. Since our f(x) is real, we have to find ways to avoid that. Bracketing condition is one way to go: by requiring bracketing in every iteration, the newly computed approximation is guaranteed to be real.
Normally Muller's method converges quadratically in the vicinity of a zero, however it may be very slow in regions far away from zeros. For example, f(x) = exp(x) - 1, min = -50, max = 100. In such case we use bisection as a safety backup if it performs very poorly.
The formulas here use divided differences directly.
f
- the function to solvemin
- the lower bound for the intervalmax
- the upper bound for the interval
MaxIterationsExceededException
- if the maximum iteration count is exceeded
or the solver detects convergence problems otherwise
FunctionEvaluationException
- if an error occurs evaluating the function
java.lang.IllegalArgumentException
- if any parameters are invalid@Deprecated public double solve2(double min, double max) throws MaxIterationsExceededException, FunctionEvaluationException
solve2(UnivariateRealFunction, double, double)
since 2.0
solve2() differs from solve() in the way it avoids complex operations. Except for the initial [min, max], solve2() does not require bracketing condition, e.g. f(x0), f(x1), f(x2) can have the same sign. If complex number arises in the computation, we simply use its modulus as real approximation.
Because the interval may not be bracketing, bisection alternative is not applicable here. However in practice our treatment usually works well, especially near real zeros where the imaginary part of complex approximation is often negligible.
The formulas here do not use divided differences directly.
min
- the lower bound for the intervalmax
- the upper bound for the interval
MaxIterationsExceededException
- if the maximum iteration count is exceeded
or the solver detects convergence problems otherwise
FunctionEvaluationException
- if an error occurs evaluating the function
java.lang.IllegalArgumentException
- if any parameters are invalid@Deprecated public double solve2(UnivariateRealFunction f, double min, double max) throws MaxIterationsExceededException, FunctionEvaluationException
solve2() differs from solve() in the way it avoids complex operations. Except for the initial [min, max], solve2() does not require bracketing condition, e.g. f(x0), f(x1), f(x2) can have the same sign. If complex number arises in the computation, we simply use its modulus as real approximation.
Because the interval may not be bracketing, bisection alternative is not applicable here. However in practice our treatment usually works well, especially near real zeros where the imaginary part of complex approximation is often negligible.
The formulas here do not use divided differences directly.
f
- the function to solvemin
- the lower bound for the intervalmax
- the upper bound for the interval
MaxIterationsExceededException
- if the maximum iteration count is exceeded
or the solver detects convergence problems otherwise
FunctionEvaluationException
- if an error occurs evaluating the function
java.lang.IllegalArgumentException
- if any parameters are invalid
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |