scipy.special.
hermitenorm#
- scipy.special.hermitenorm(n, monic=False)[source]#
Probabilist’s Hermite polynomial.
Defined by
\[He_n(x) = (-1)^ne^{x^2/2}\frac{d^n}{dx^n}e^{-x^2/2};\]\(He_n\) is a polynomial of degree \(n\).
- Parameters:
- nint
Degree of the polynomial.
- monicbool, optional
If True, scale the leading coefficient to be 1. Default is False.
- Returns:
- Heorthopoly1d
Probabilist’s Hermite polynomial.
Notes
The polynomials \(He_n\) are orthogonal over \((-\infty, \infty)\) with weight function \(e^{-x^2/2}\).
Examples
>>> import numpy as np >>> import matplotlib.pyplot as plt >>> from scipy.special import hermitenorm
>>> p_monic = hermitenorm(3) >>> p_monic poly1d([ 1., 0., -3., 0.])
Evaluate the probabilist’s Hermite polynomial of degree 3 at x = 1:
>>> p_monic(1) np.float64(-2.0)
Plot probabilist’s Hermite polynomials of degree 0 to 4:
>>> x = np.linspace(-3, 3, 100) >>> fig, ax = plt.subplots() >>> for i in range(5): ... ax.plot(x, hermitenorm(i)(x), label=f"n={i}") >>> plt.title(f"Probabilist's Hermite polynomials $He_n$") >>> plt.xlabel("x") >>> plt.ylabel(rf"$He_n(x)$") >>> plt.legend(loc="best") >>> plt.show()