evaluateOn method
Evaluates the polynomial on the specified complex number x
.
Implementation
Complex evaluateOn(Complex x) {
var value = const Complex.zero();
var power = coefficients.length - 1;
// Actual valuation
for (final c in coefficients) {
if (power != 0) {
value += x.pow(power) * c;
} else {
value += c;
}
power--;
}
return value;
}