Overview¶
Chebyshev2 implements a pseudo-spectral parameterization on Chebyshev points of the second kind. Instead of coefficients, the parameters are function values at Chebyshev points, and evaluation uses barycentric interpolation. The class also provides differentiation and integration matrices for spectral calculus.
Key Functionality / API¶
Point(N, j[, a, b])andPoints(N[, a, b])return Chebyshev points.CalculateWeights(N, x[, a, b])returns barycentric interpolation weights.DerivativeWeights(N, x[, a, b])returns derivative weights.DifferentiationMatrix(N[, a, b])andIntegrationMatrix(N[, a, b])provide spectral operators.IntegrationWeights(N[, a, b])andDoubleIntegrationWeights(N[, a, b])provide quadrature weights.
Usage Example¶
This example inspects the Chebyshev points, interpolation weights, and the differentiation matrix.
import numpy as np
import gtsam
np.set_printoptions(precision=3, suppress=True)
N = 8
points = gtsam.Chebyshev2.Points(N)
print("Chebyshev points:", np.asarray(points).ravel())
x = 0.2
weights = gtsam.Chebyshev2.CalculateWeights(N, x)
print("Interpolation weights at x=0.2:", np.asarray(weights).ravel())
D = gtsam.Chebyshev2.DifferentiationMatrix(N)
print("D shape:", np.asarray(D).shape)
print("First row of D:", np.asarray(D)[0])
Chebyshev points: [-1. -0.901 -0.623 -0.223 0.223 0.623 0.901 1. ]
Interpolation weights at x=0.2: [-0.009 0.02 -0.027 0.053 0.998 -0.053 0.032 -0.014]
D shape: (8, 8)
First row of D: [-16.5 20.196 -5.312 2.572 -1.636 1.232 -1.052 0.5 ]