Top Description Fields Constructors Methods
org.apache.commons.math3.analysis.solvers

public Class MullerSolver

extends AbstractUnivariateSolver
Class Inheritance
Imports
org.apache.commons.math3.exception.NoBracketingException, .NumberIsTooLargeException, .TooManyEvaluationsException, org.apache.commons.math3.util.FastMath

This class 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. This class differs from MullerSolver in the way it avoids complex operations.

Muller's original 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.

Since
1.2
See Also
MullerSolver2

Field Summary

Modifier and TypeField and Description
private static final double
DEFAULT_ABSOLUTE_ACCURACY

Default absolute accuracy.

Constructor Summary

AccessConstructor and Description
public
MullerSolver()

Construct a solver with default accuracy (1e-6).

public
MullerSolver(double
Absolute accuracy.
absoluteAccuracy
)

Construct a solver.

public
MullerSolver(double
Relative accuracy.
relativeAccuracy
,
double
Absolute accuracy.
absoluteAccuracy
)

Construct a solver.

Method Summary

Modifier and TypeMethod and Description
protected double
doSolve()

Implements abstract org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver.doSolve.

Method for implementing actual optimization algorithms in derived classes.

private double

Returns:

the point at which the function value is zero.
solve
(double
Lower bound for the interval.
min
,
double
Upper bound for the interval.
max
,
double
function value at the lower bound.
fMin
,
double
function value at the upper bound.
fMax
)

Find a real root in the given interval.

Field Detail

DEFAULT_ABSOLUTE_ACCURACYback to summary
private static final double DEFAULT_ABSOLUTE_ACCURACY

Default absolute accuracy.

Constructor Detail

MullerSolverback to summary
public MullerSolver()

Construct a solver with default accuracy (1e-6).

MullerSolverback to summary
public MullerSolver(double absoluteAccuracy)

Construct a solver.

Parameters
absoluteAccuracy:double

Absolute accuracy.

MullerSolverback to summary
public MullerSolver(double relativeAccuracy, double absoluteAccuracy)

Construct a solver.

Parameters
relativeAccuracy:double

Relative accuracy.

absoluteAccuracy:double

Absolute accuracy.

Method Detail

doSolveback to summary
protected double doSolve() throws TooManyEvaluationsException, NumberIsTooLargeException, NoBracketingException

Implements abstract org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver.doSolve.

Doc from org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver.doSolve.

Method for implementing actual optimization algorithms in derived classes.

Returns:double

the root.

Annotations
@Override
Exceptions
TooManyEvaluationsException:
if the maximal number of evaluations is exceeded.
NoBracketingException:
if the initial search interval does not bracket a root and the solver requires it.
solveback to summary
private double solve(double min, double max, double fMin, double fMax) throws TooManyEvaluationsException

Find a real root in the given interval.

Parameters
min:double

Lower bound for the interval.

max:double

Upper bound for the interval.

fMin:double

function value at the lower bound.

fMax:double

function value at the upper bound.

Returns:double

the point at which the function value is zero.

Exceptions
TooManyEvaluationsException:
if the allowed number of calls to the function to be solved has been exhausted.