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.

Chebyshev1Basis

Open In Colab

Overview

Chebyshev1Basis provides the first-kind Chebyshev polynomial basis Tn(x)T_n(x) on the interval [1,1][-1, 1]. Parameters are coefficients of the basis functions, making this a classic orthogonal polynomial expansion for smooth function approximation.

Key Functionality / API

  • CalculateWeights(N, x, a=-1, b=1) returns the 1×N1 \times N basis weights.

  • DerivativeWeights(N, x, a=-1, b=1) returns weights for the derivative.

  • WeightMatrix(N, X) stacks weights for a vector of sample points.

Usage Example

Evaluate first-kind Chebyshev weights at a point and build a weight matrix for multiple sample points.

import numpy as np
import gtsam

np.set_printoptions(precision=3, suppress=True)

N = 6
x = 0.25
weights = gtsam.Chebyshev1Basis.CalculateWeights(N, x)
print("Weights at x=0.25:", np.asarray(weights).ravel())

X = np.linspace(-1.0, 1.0, 5)
W = gtsam.Chebyshev1Basis.WeightMatrix(N, X)
print("WeightMatrix shape:", np.asarray(W).shape)
print("Row for x=0:", np.asarray(W)[2])
Weights at x=0.25: [ 1.     0.25  -0.875 -0.688  0.531  0.953]
WeightMatrix shape: (5, 6)
Row for x=0: [ 1.  0. -1. -0.  1.  0.]