Skip to content
fn

chebyshev_polynomial_t

→Tensor
chebyshev_polynomial_t(x: TensorOrScalar, n: TensorOrScalar)

Chebyshev polynomial of the first kind, Tn(x)T_n(x).

The Chebyshev T polynomials are orthogonal on [−1,1][-1, 1] with weight 1/1−x21/\sqrt{1 - x^2} and underlie spectral methods, minimax polynomial approximation, and Clenshaw-Curtis quadrature.

Parameters

xTensor | Scalar
Where TnT_n is evaluated, of any real dtype. Customarily on [−1,1][-1, 1] but defined for all real x.
nTensor | Scalar
Degree of TnT_n, for every element or one per element; truncated toward zero, and a negative degree gives 0.

Returns

Tensor

Tn(x)T_n(x) element-wise, broadcast over x and n.

Notes

Defined by Tn(cos⁡θ)=cos⁡(nθ)T_n(\cos\theta) = \cos(n\theta) and built by the three-term recurrence

T0(x)=1,T1(x)=x,Tk+1(x)=2x Tk(x)−Tk−1(x).T_0(x) = 1, \quad T_1(x) = x, \quad T_{k+1}(x) = 2x\, T_k(x) - T_{k-1}(x).

On [−1,1][-1, 1], ∣Tn(x)∣≤1|T_n(x)| \le 1; the extrema lie at the Chebyshev nodes cos⁡(jπ/n)\cos(j\pi/n) for j=0,…,nj = 0,\ldots,n.

Examples

>>> import lucid
>>> from lucid.special import chebyshev_polynomial_t
>>> chebyshev_polynomial_t(lucid.tensor([-1.0, 0.0, 0.5, 1.0]), n=3)
tensor([-1., -0., -1., 1.])

Used by 1