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.

Chebyshev2Basis

Open In Colab

Overview

Chebyshev2Basis provides the second-kind Chebyshev polynomial basis Un(x)U_n(x) on [1,1][-1, 1]. It is related to derivatives of first-kind polynomials and is useful when expressing functions directly in a basis of Un(x)U_n(x) polynomials.

Key Functionality / API

  • CalculateWeights(N, x, a=-1, b=1) returns basis weights.

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

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

Usage Example

Evaluate second-kind Chebyshev weights 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.3
weights = gtsam.Chebyshev2Basis.CalculateWeights(N, x)
print("Weights at x=-0.3:", np.asarray(weights).ravel())

X = np.linspace(-1.0, 1.0, 5)
W = gtsam.Chebyshev2Basis.WeightMatrix(N, X)
print("WeightMatrix shape:", np.asarray(W).shape)
print("Row for x=0:", np.asarray(W)[2])
Weights at x=-0.3: [ 1.    -0.6   -0.64   0.984  0.05  -1.014]
WeightMatrix shape: (5, 6)
Row for x=0: [ 1.  0. -1. -0.  1.  0.]