operator [] method

Complex operator [](
  1. int index
)

Returns the coefficient of the polynomial at the given index position. For example:

final quadratic = Quadratic(
  a: Complex.fromReal(2),
  b: Complex.fromReal(-6),
  c: Complex.fromReal(5),
);

final a = quadratic[0] // a = Complex(2, 0)
final b = quadratic[1] // b = Complex(-6, 0)
final c = quadratic[2] // c = Complex(5, 0)

An exception is thrown if the index is negative or if it doesn't correspond to a valid position.

Implementation

Complex operator [](int index) => coefficients[index];