DurandKerner.realEquation constructor
DurandKerner.realEquation({})
Instantiates a new object to find all the roots of a polynomial equation using the Durand-Kerner algorithm. 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 + 1 = 0
has to be inserted in the
following way:
final durandKerner = DurandKerner(
coefficients [-5, 3, 1],
);
Since -5
is the coefficient with the highest degree (2), it goes first.
If the coefficients of your polynomial contain complex numbers, consider
using the Laguerre()
constructor instead.
Implementation
DurandKerner.realEquation({
required List<double> coefficients,
this.initialGuess = const [],
this.precision = 1.0e-10,
this.maxSteps = 2000,
}) : super.realEquation(coefficients);