scipy.special.eval_chebyt#

scipy.special.eval_chebyt(n, x, out=None) = <ufunc 'eval_chebyt'>#

Evaluate Chebyshev polynomial of the first kind at a point.

The Chebyshev polynomials of the first kind can be defined via the Gauss hypergeometric function \({}_2F_1\) as

\[T_n(x) = {}_2F_1(n, -n; 1/2; (1 - x)/2).\]

When \(n\) is an integer the result is a polynomial of degree \(n\). See 22.5.47 in [AS] (or equivalently [DLMF]) for details.

Parameters:
narray_like

Degree of the polynomial. If not an integer, the result is determined via the relation to the Gauss hypergeometric function.

xarray_like

Points at which to evaluate the Chebyshev polynomial

outndarray, optional

Optional output array for the function values

Returns:
Tscalar or ndarray

Values of the Chebyshev polynomial

See also

roots_chebyt

roots and quadrature weights of Chebyshev polynomials of the first kind

chebyu

Chebychev polynomial object

eval_chebyu

evaluate Chebyshev polynomials of the second kind

hyp2f1

Gauss hypergeometric function

numpy.polynomial.chebyshev.Chebyshev

Chebyshev series

Notes

This routine is numerically stable for x in [-1, 1] at least up to order 10000.

References

[AS]

Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

[DLMF]

NIST Digital Library of Mathematical Functions, https://dlmf.nist.gov/18.5.E11_2

Examples

>>> import numpy as np
>>> from scipy.special import eval_chebyt
>>> import matplotlib.pyplot as plt

Evaluate the order 3 polynomial at a few values of x.

>>> eval_chebyt(3, [0, 0.25, 0.5])
array([-0.    , -0.6875, -1.    ])

Plot the polynomials of order 0 through 4.

>>> x = np.linspace(-1, 1, 800)
>>> fig, ax = plt.subplots(1, 1, constrained_layout=True)
>>> for n in range(5):
...     y = eval_chebyt(n, x)
...     ax.plot(x, y, label=f'{n = }')
>>> ax.grid()
>>> ax.set_title("Chebyshev Polynomials of the First Kind")
>>> ax.set_xlabel("$x$")
>>> ax.set_ylabel("$T_n(x)$")
>>> ax.legend(loc='upper left', bbox_to_anchor=(1, 1), shadow=True)
>>> plt.show()
../../_images/scipy-special-eval_chebyt-1.png