chebyshevBasis function

List<double> chebyshevBasis(
  1. double s,
  2. int n
)

Values T₀(s)…Tₙ₋₁(s) of the Chebyshev polynomials.

Implementation

List<double> chebyshevBasis(double s, int n) {
  final t = List.filled(n, 0.0);
  t[0] = 1;
  if (n > 1) t[1] = s;
  for (var k = 2; k < n; k++) {
    t[k] = 2 * s * t[k - 1] - t[k - 2];
  }
  return t;
}