Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Chebyshev2

Open In Colab

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 matrices and exact rectangular integration matrices for spectral calculus.

Key Functionality / API

  • Point(N, j[, a, b]) and Points(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]) differentiates values at N nodes.

  • IntegrationMatrix(N[, a, b]) maps N derivative values to N+1 exact antiderivative values with F(a)=0.

  • IntegrationWeights(N[, a, b]) and DoubleIntegrationWeights(N[, a, b]) provide quadrature weights.

Usage Example

This example inspects the Chebyshev points, interpolation weights, differentiation matrix, and exact integration 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])

P = gtsam.Chebyshev2.IntegrationMatrix(N)
integration_weights = gtsam.Chebyshev2.IntegrationWeights(N)
print("P shape:", np.asarray(P).shape)
print("P final row equals weights:", np.allclose(np.asarray(P)[-1], integration_weights))
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  ]
P shape: (9, 8)
P final row equals weights: True