torch.special.chebyshev_polynomial_t
function chebyshev_polynomial_t<S extends Shape>(x: Tensor<S, 'float32'>, n: number | Tensor, _options?: SpecialPolynomialOptions<S>): Tensor<S, 'float32'>Computes Chebyshev polynomial of the first kind T_n(x).
The Chebyshev polynomials of the first kind are the unique polynomials orthogonal on [-1, 1] with respect to the weight function 1/√(1-x²). They have remarkable properties: minimal oscillation amplitude (equiripple), fastest growth outside [-1, 1], and numerous physical/engineering applications. Essential for:
- Function approximation: minimize maximum approximation error (Chebyshev approximation)
- Orthogonal polynomial expansion: numerical methods, spectral analysis
- Filter design: Chebyshev filters maximize attenuation in stopband
- Numerical differentiation and integration: stable node placement (Chebyshev-Gauss-Lobatto)
- Asymptotic analysis: WKB approximations, quantum mechanics
- Signal processing: window functions with controlled sidelobe levels
Optimal Polynomial: T_n is the monic polynomial of degree n with smallest maximum absolute value on [-1, 1], achieving max |T_n(x)| = 1 with equiripple property (oscillates between ±1 with n+1 peaks). Used when minimizing maximum error matters (worst-case analysis, robust filtering).
Relationship to Cosine: T_n(cos θ) = cos(nθ) (fundamental trigonometric identity). This connects polynomial algebra to angular frequency analysis.
- Equiripple property: T_n oscillates between ±1 exactly n+1 times on [-1, 1]
- Extrema: Maximum absolute value is 1 on [-1, 1]; extrema occur at x_k = cos(kπ/n), k=0,...,n
- Recurrence relation: Very efficient for computing multiple degrees (compute all T_0 through T_n sequentially)
- Trigonometric connection: T_n(cos θ) = cos(nθ) makes angular analysis exact
- Outside [-1, 1]: Growth becomes exponential; T_n(x) ≈ (x + √(x²-1))^n / 2^(n-1) for |x| 1
- Zeros: T_n has n distinct zeros at x_k = cos((2k-1)π/(2n)), k=1,...,n in (-1, 1)
- Energy concentration: Used in spectral methods for optimal convergence (minimal oscillation)
- Domain [−1, 1]: Behavior outside this interval is different (not bounded by ±1); extrapolation unstable
- Large n: For very large degree n, T_n(x) grows exponentially for |x| 1; numerical overflow risk
- Not same as shifted version: Use shifted_chebyshev_polynomial_t for domain [0, 1]
Parameters
xTensor<S, 'float32'>- Input tensor with values in [-1, 1] (though defined for all real x, extreme extrapolation unstable)
nnumber | Tensor- Polynomial degree (non-negative integer). Can be scalar or Tensor
_optionsSpecialPolynomialOptions<S>optional
Returns
Tensor<S, 'float32'>– Tensor with T_n(x) valuesExamples
// Basic Chebyshev polynomial evaluation
const x = torch.linspace(-1, 1, 5);
const T_0 = torch.special.chebyshev_polynomial_t(x, 0); // [1, 1, 1, 1, 1]
const T_1 = torch.special.chebyshev_polynomial_t(x, 1); // x
const T_2 = torch.special.chebyshev_polynomial_t(x, 2); // 2x^2 - 1
// Function approximation: approximate sin(πx/2) on [-1, 1]
const xApprox = torch.linspace(-1, 1, 100);
const T1 = torch.special.chebyshev_polynomial_t(xApprox, 1);
const T3 = torch.special.chebyshev_polynomial_t(xApprox, 3);
const T5 = torch.special.chebyshev_polynomial_t(xApprox, 5);
// Higher n terms give increasingly accurate approximation (Chebyshev series expansion)
// Chebyshev filter design: poles at T_n roots define analog prototype
const nCoeff = 4;
const roots_normalized = torch.linspace(-1, 1, nCoeff);
const chebyshev_roots = torch.special.chebyshev_polynomial_t(roots_normalized, nCoeff);
// Filter poles derived from Chebyshev polynomial zeros
// Batched evaluation with different degrees
const xBatch = torch.randn(32, 10);
const degrees = torch.tensor([1, 2, 3, 4, 5]);
const T2_batch = torch.special.chebyshev_polynomial_t(xBatch, 2);
// [32, 10] shaped output of T_2 valuesSee Also
- PyTorch torch.special.chebyshev_polynomial_t()
- torch.special.chebyshev_polynomial_u - Second kind (U_n), related but different orthogonality
- torch.special.shifted_chebyshev_polynomial_t - Shifted version T*_n for domain [0, 1]
- torch.special.legendre_polynomial_p - Legendre polynomials (different weight, slower growth)