org.apache.commons.math3.analysis.solvers
Class MullerSolver

java.lang.Object
  extended by org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver<UnivariateFunction>
      extended by org.apache.commons.math3.analysis.solvers.AbstractUnivariateSolver
          extended by org.apache.commons.math3.analysis.solvers.MullerSolver
All Implemented Interfaces:
BaseUnivariateSolver<UnivariateFunction>, UnivariateSolver

public class MullerSolver
extends AbstractUnivariateSolver

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
Version:
$Id: MullerSolver.java 1244107 2012-02-14 16:17:55Z erans $
See Also:
MullerSolver2

Field Summary
private static double DEFAULT_ABSOLUTE_ACCURACY
          Default absolute accuracy.
 
Constructor Summary
MullerSolver()
          Construct a solver with default accuracy (1e-6).
MullerSolver(double absoluteAccuracy)
          Construct a solver.
MullerSolver(double relativeAccuracy, double absoluteAccuracy)
          Construct a solver.
 
Method Summary
protected  double doSolve()
          Method for implementing actual optimization algorithms in derived classes.
private  double solve(double min, double max, double fMin, double fMax)
          Find a real root in the given interval.
 
Methods inherited from class org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver
computeObjectiveValue, getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getMax, getMaxEvaluations, getMin, getRelativeAccuracy, getStartValue, incrementEvaluationCount, isBracketing, isSequence, setup, solve, solve, solve, verifyBracketing, verifyInterval, verifySequence
 
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.math3.analysis.solvers.BaseUnivariateSolver
getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getMaxEvaluations, getRelativeAccuracy, solve, solve, solve
 

Field Detail

DEFAULT_ABSOLUTE_ACCURACY

private static final double DEFAULT_ABSOLUTE_ACCURACY
Default absolute accuracy.

See Also:
Constant Field Values
Constructor Detail

MullerSolver

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


MullerSolver

public MullerSolver(double absoluteAccuracy)
Construct a solver.

Parameters:
absoluteAccuracy - Absolute accuracy.

MullerSolver

public MullerSolver(double relativeAccuracy,
                    double absoluteAccuracy)
Construct a solver.

Parameters:
relativeAccuracy - Relative accuracy.
absoluteAccuracy - Absolute accuracy.
Method Detail

doSolve

protected double doSolve()
Method for implementing actual optimization algorithms in derived classes.

Specified by:
doSolve in class BaseAbstractUnivariateSolver<UnivariateFunction>
Returns:
the root.

solve

private double solve(double min,
                     double max,
                     double fMin,
                     double fMax)
Find a real root in the given interval.

Parameters:
min - Lower bound for the interval.
max - Upper bound for the interval.
fMin - function value at the lower bound.
fMax - function value at the upper bound.
Returns:
the point at which the function value is zero.


Copyright (c) 2003-2013 Apache Software Foundation