org.apache.commons.math.analysis.solvers
Class LaguerreSolver

java.lang.Object
  extended by org.apache.commons.math.analysis.solvers.BaseAbstractUnivariateRealSolver<PolynomialFunction>
      extended by org.apache.commons.math.analysis.solvers.AbstractPolynomialSolver
          extended by org.apache.commons.math.analysis.solvers.LaguerreSolver
All Implemented Interfaces:
BaseUnivariateRealSolver<PolynomialFunction>, PolynomialSolver

public class LaguerreSolver
extends AbstractPolynomialSolver

Implements the Laguerre's Method for root finding of real coefficient polynomials. For reference, see A First Course in Numerical Analysis ISBN 048641454X, chapter 8. Laguerre's method is global in the sense that it can start with any initial approximation and be able to solve all roots from that point. The algorithm requires a bracketing condition.

Since:
1.2
Version:
$Id: LaguerreSolver.java 1145746 2011-07-12 20:15:01Z psteitz $

Field Summary
protected  org.apache.commons.math.analysis.solvers.LaguerreSolver.ComplexSolver complexSolver
          Complex solver.
 
Constructor Summary
LaguerreSolver()
          Construct a solver with default accuracy (1e-6).
LaguerreSolver(double absoluteAccuracy)
          Construct a solver.
LaguerreSolver(double relativeAccuracy, double absoluteAccuracy)
          Construct a solver.
LaguerreSolver(double relativeAccuracy, double absoluteAccuracy, double functionValueAccuracy)
          Construct a solver.
 
Method Summary
 double doSolve()
          Method for implementing actual optimization algorithms in derived classes.
 double laguerre(double lo, double hi, double fLo, double fHi)
          Find a real root in the given interval.
 
Methods inherited from class org.apache.commons.math.analysis.solvers.AbstractPolynomialSolver
getCoefficients, setup
 
Methods inherited from class org.apache.commons.math.analysis.solvers.BaseAbstractUnivariateRealSolver
computeObjectiveValue, getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getMax, getMaxEvaluations, getMin, getRelativeAccuracy, getStartValue, incrementEvaluationCount, isBracketing, isSequence, 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.math.analysis.solvers.BaseUnivariateRealSolver
getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getMaxEvaluations, getRelativeAccuracy, solve, solve, solve
 

Field Detail

complexSolver

protected org.apache.commons.math.analysis.solvers.LaguerreSolver.ComplexSolver complexSolver
Complex solver.

Constructor Detail

LaguerreSolver

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


LaguerreSolver

public LaguerreSolver(double absoluteAccuracy)
Construct a solver.

Parameters:
absoluteAccuracy - Absolute accuracy.

LaguerreSolver

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

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

LaguerreSolver

public LaguerreSolver(double relativeAccuracy,
                      double absoluteAccuracy,
                      double functionValueAccuracy)
Construct a solver.

Parameters:
relativeAccuracy - Relative accuracy.
absoluteAccuracy - Absolute accuracy.
functionValueAccuracy - Function value accuracy.
Method Detail

doSolve

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

Specified by:
doSolve in class BaseAbstractUnivariateRealSolver<PolynomialFunction>
Returns:
the root.

laguerre

public double laguerre(double lo,
                       double hi,
                       double fLo,
                       double fHi)
Find a real root in the given interval. Despite the bracketing condition, the root returned by LaguerreSolver.ComplexSolver.solve(Complex[],Complex) may not be a real zero inside [min, max]. For example, p(x) = x3 + 1, with min = -2, max = 2, initial = 0. When it occurs, this code calls LaguerreSolver.ComplexSolver.solveAll(Complex[],Complex) in order to obtain all roots and picks up one real root.

Parameters:
lo - Lower bound of the search interval.
hi - Higher bound of the search interval.
fLo - Function value at the lower bound of the search interval.
fHi - Function value at the higher bound of the search interval.
Returns:
the point at which the function value is zero.


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.