fn

chebyshev_polynomial_t

Tensor
chebyshev_polynomial_t(x: Tensor, n: int)
source

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/1x21/\sqrt{1 - x^2} and underlie spectral methods, minimax polynomial approximation, and Clenshaw-Curtis quadrature.

Parameters

xTensor
Argument tensor; any floating-point dtype. Customarily evaluated on [1,1][-1, 1] but defined for all real x.
nint
Non-negative polynomial degree.

Returns

Tensor

Tn(x)T_n(x) element-wise, same shape and dtype as x.

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)=2xTk(x)Tk1(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. Raises ValueError for n < 0.

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.0000, 0.0000, -0.5000, 1.0000])