Package org.hipparchus.analysis.solvers
Class LaguerreSolver
- java.lang.Object
-
- org.hipparchus.analysis.solvers.BaseAbstractUnivariateSolver<PolynomialFunction>
-
- org.hipparchus.analysis.solvers.AbstractPolynomialSolver
-
- org.hipparchus.analysis.solvers.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, seeA 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 Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
doSolve()
Method for implementing actual optimization algorithms in derived classes.Complex[]
solveAllComplex(double[] coefficients, double initial)
Find all complex roots for the polynomial with the given coefficients, starting from the given initial value.Complex
solveComplex(double[] coefficients, double initial)
Find a complex root for the polynomial with the given coefficients, starting from the given initial value.-
Methods inherited from class org.hipparchus.analysis.solvers.AbstractPolynomialSolver
getCoefficients, setup
-
Methods inherited from class org.hipparchus.analysis.solvers.BaseAbstractUnivariateSolver
computeObjectiveValue, getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getMax, 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.hipparchus.analysis.solvers.BaseUnivariateSolver
getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getRelativeAccuracy, solve, solve, solve
-
-
-
-
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() throws MathIllegalArgumentException, MathIllegalStateException
Method for implementing actual optimization algorithms in derived classes.- Specified by:
doSolve
in classBaseAbstractUnivariateSolver<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 MathIllegalArgumentException, NullArgumentException, MathIllegalStateException
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 thecoefficients
isnull
.MathIllegalArgumentException
- if thecoefficients
array is empty.
-
solveComplex
public Complex solveComplex(double[] coefficients, double initial) throws MathIllegalArgumentException, NullArgumentException, MathIllegalStateException
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 thecoefficients
isnull
.MathIllegalArgumentException
- if thecoefficients
array is empty.
-
-