scipy.special.
sh_chebyu#
- scipy.special.sh_chebyu(n, monic=False)[source]#
Shifted Chebyshev polynomial of the second kind.
Defined as \(U^*_n(x) = U_n(2x - 1)\) for \(U_n\) the nth Chebyshev polynomial of the second kind.
- Parameters:
- nint
Degree of the polynomial.
- monicbool, optional
If True, scale the leading coefficient to be 1. Default is False.
- Returns:
- Uorthopoly1d
Shifted Chebyshev polynomial of the second kind.
Notes
The polynomials \(U^*_n\) are orthogonal over \([0, 1]\) with weight function \((x - x^2)^{1/2}\).
Examples
Evaluate the shifted Chebyshev polynomial of the second kind \(U^*_3\) at \(x = 0.75\):
>>> import numpy as np >>> from scipy.special import chebyu, sh_chebyu >>> np.isclose(sh_chebyu(3)(0.75), -1.0) True
The polynomial \(U^*_n\) is the Chebyshev polynomial \(U_n\) shifted from \([-1, 1]\) to \([0, 1]\):
>>> x = np.linspace(0, 1, 5) >>> np.allclose(sh_chebyu(3)(x), chebyu(3)(2*x - 1)) True
Plot \(U^*_n\) for several values of \(n\):
>>> import matplotlib.pyplot as plt >>> x = np.linspace(0, 1, 400) >>> fig, ax = plt.subplots() >>> for n in range(4): ... ax.plot(x, sh_chebyu(n)(x), label=rf"$U^*_{n}$") >>> ax.set_title(r"Shifted Chebyshev polynomials $U^*_n$") >>> ax.set_xlabel("x") >>> ax.legend(loc="best") >>> plt.show()