Laguerre constructor
Laguerre({})
Instantiates a new object to find all the roots of a polynomial equation using Laguerre's method. The polynomial can have both complex (Complex) and real (double) values.
coefficients
: the coefficients of the polynomial;- initialGuess: the initial guess from which the algorithm has to start finding the roots;
- precision: the accuracy of the algorithm;
- maxSteps: the maximum steps to be made by the algorithm.
Note that the coefficient with the highest degree goes first. For example,
the coefficients of the -5x^2 + 3x + i = 0
has to be inserted in the
following way:
final laguerre = Laguerre(
coefficients [
Complex.fromReal(-5),
Complex.fromReal(3),
Complex.i(),
],
);
Since -5
is the coefficient with the highest degree (2), it goes first.
If the coefficients of your polynomial are only real numbers, consider
using the Laguerre.realEquation() constructor instead.
Implementation
Laguerre({
required List<Complex> coefficients,
this.initialGuess = const Complex.zero(),
this.precision = 1.0e-10,
this.maxSteps = 1000,
}) : super(coefficients);