def test_hermite(self): v = orth.eval_hermite(70, 1.0) a = -1.457076485701412e60 assert_allclose(v,a)
def test_hermite_nan(n, x): # Regression test for gh-11369. assert np.isnan(orth.eval_hermite(n, x)) == np.any(np.isnan([n, x])) assert np.isnan(orth.eval_hermitenorm(n, x)) == np.any(np.isnan([n, x]))
def gauss_hermite(u, sigma=1., m=0): gaus_herm = gaussian(u, sigma) * spo.eval_hermite(m, u) return gaus_herm
def test_hermite_domain(): # Regression test for gh-11091. assert np.isnan(orth.eval_hermite(-1, 1.0)) assert np.isnan(orth.eval_hermitenorm(-1, 1.0))
from scipy.special import gamma from scipy.special.orthogonal import eval_hermite, eval_hermitenorm import matplotlib.pyplot as plt import numpy as np #psi = lambda n,x: 1.0/np.sqrt((2**n*gamma(n+1)*np.sqrt(np.pi))) * np.exp(-x**2/2.0) * eval_hermitenorm(n, x) psi = lambda n,x: 1.0/np.sqrt((2**n*gamma(n+1)*np.sqrt(np.pi))) * np.exp(-x**2/2.0) * eval_hermite(n, x) x = np.linspace(-5, 5, 500) for n in xrange(6): plt.plot(x, psi(n,x), label=r"$\psi_"+str(n)+r"(x)$") plt.grid(True) plt.xlim(-5,5) #plt.ylim(-5,5) plt.xlabel(r"$x$") plt.ylabel(r"$\psi_n(x)$") plt.legend(loc="lower right") plt.title(r"Hermite functions $\psi_n$") #plt.show() plt.savefig('hermite.pdf')