fn

hermite_polynomial_he

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

Probabilist's Hermite polynomial Hen(x)\mathit{He}_n(x).

Probabilists' Hermite polynomials are orthogonal on (,)(-\infty, \infty) with weight ex2/2/2πe^{-x^2/2} / \sqrt{2\pi} — the standard normal density — and are the natural basis for Hermite-expansions of functions against a Gaussian measure (Wiener chaos, Gauss-Hermite quadrature with weight 1).

Parameters

xTensor
Argument tensor; any floating-point dtype.
nint
Non-negative polynomial degree.

Returns

Tensor

Hen(x)\mathit{He}_n(x) element-wise, same shape and dtype as x.

Notes

Recurrence:

He0(x)=1,He1(x)=x,Hek+1(x)=xHek(x)kHek1(x).\mathit{He}_0(x) = 1, \quad \mathit{He}_1(x) = x, \quad \mathit{He}_{k+1}(x) = x\, \mathit{He}_k(x) - k\, \mathit{He}_{k-1}(x).

Connection to physicists' Hermite: Hen(x)=2n/2Hn(x/2)\mathit{He}_n(x) = 2^{-n/2} H_n(x/\sqrt 2). Raises ValueError for n < 0.

Examples

>>> import lucid
>>> from lucid.special import hermite_polynomial_he
>>> hermite_polynomial_he(lucid.tensor([-1.0, 0.0, 1.0]), n=3)
Tensor([2.0000, 0.0000, -2.0000])