Class LaguerreSolver

All Implemented Interfaces:
BaseUnivariateSolver<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.
• Constructor Details

• 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 Details

• doSolve

public double doSolve() throws
Method for implementing actual optimization algorithms in derived classes.
Specified by:
doSolve in class BaseAbstractUnivariateSolver<PolynomialFunction>
Returns:
the root.
Throws:
MathIllegalArgumentException - if the initial search interval does not bracket a root and the solver requires it.
MathIllegalStateException - if the maximal number of evaluations is exceeded.
• solveAllComplex

public Complex[] solveAllComplex(double[] coefficients, double initial) throws
Find all complex roots for the polynomial with the given coefficients, starting from the given initial value.

Note: This method is not part of the API of BaseUnivariateSolver.

Parameters:
coefficients - Polynomial coefficients.
initial - Start value.
Returns:
the point at which the function value is zero.
Throws:
MathIllegalStateException - if the maximum number of evaluations is exceeded.
NullArgumentException - if the coefficients is null.
MathIllegalArgumentException - if the coefficients array is empty.
• solveAllComplex

public Complex[] solveAllComplex(double[] coefficients, int maxEval, double initial) throws
Find all complex roots for the polynomial with the given coefficients, starting from the given initial value.

Note: This method is not part of the API of BaseUnivariateSolver.

Parameters:
coefficients - Polynomial coefficients.
maxEval - Maximum number of evaluations.
initial - Start value.
Returns:
the point at which the function value is zero.
Throws:
MathIllegalStateException - if the maximum number of evaluations is exceeded.
NullArgumentException - if the coefficients is null.
MathIllegalArgumentException - if the coefficients array is empty.
• solveComplex

public Complex solveComplex(double[] coefficients, double initial) throws
Find a complex root for the polynomial with the given coefficients, starting from the given initial value.

Note: This method is not part of the API of BaseUnivariateSolver.

Parameters:
coefficients - Polynomial coefficients.
initial - Start value.
Returns:
the point at which the function value is zero.
Throws:
MathIllegalStateException - if the maximum number of evaluations is exceeded.
NullArgumentException - if the coefficients is null.
MathIllegalArgumentException - if the coefficients array is empty.