# Normalization of MATLAB HermiteH

I was wandering - what kind of normalization does Matlab use in hermiteH, its implementation of the Hermite polynomials?

It is certainly not the case that they use either $\| H_n \|_{L^2 (e^{-x^2})}=1$, and they don't use $H_n(1)=1$ either.

• They seem to be the physicist Hermite polynomials. They are not normalized. The norm should be $\sqrt{\pi} 2^n n!$. Dec 3, 2017 at 16:01
• @nicoguaro Thanks! Other than that, they are regular Hermite polynomials, right? Dec 3, 2017 at 20:11
• They seem to. Actually, they are commonly not normalized. I just checked in SciPy, Mpmath, and Mathematica. SciPy does have normalized probabilist Hermite polynomials, though. Dec 3, 2017 at 23:44
• Ok, thanks! But they are orthogonal, right? Because just trying to numerically integrate $Hn \cdot H_m$ using trapz on a bounded interval w.r.t. the normal measure doesn't return $0$. @nicoguaro Dec 4, 2017 at 7:07
• Hermirte polynomials are orthogonal over the whole real line. trapz won't do the trick. Dec 4, 2017 at 12:04

## 1 Answer

Several packages (MATLAB, Mathematica, SciPy, mpmath) have implemented the physicist Hermite polynomials, they are defined by

$$H_n(x)=(-1)^n e^{x^2}\frac{\mathrm d^n}{\mathrm dx^n}e^{-x^2}=\left (2x-\frac{\mathrm d}{\mathrm dx} \right )^n \cdot 1$$

They are not normalized, the norm should be

$$||H_n(x)||_{L^2(e^{-x^2})} = 2^n \sqrt{\pi} n!\, .$$

These polynomials are orthogonal with respect to the weight $e^{-x^2}$, i.e.

$$\int_{-\infty}^\infty H_m(x) H_n(x)\, e^{-x^2}\, \mathrm{d}x = 2^n \sqrt{ \pi} n! \delta_{nm}\, .$$

If you want to check this orthogonality/normalization numerically you need to be careful. On one hand, you have an infinite interval. As you say, you can make the integration region "big-enough", but you have a caveat: the maximum value of the polynomials grow really fast, and you will need to increase the size of the region, really fast, as well. See, for example, the result of using the trapezoidal rule for the orthogonality between $H_0$ and $\{H_2, H_4, H_6, H_8\}$ using the interval [-3, 3] as you propose.

We can increase the integration interval to, say, [-10, 10] to obtain

where we see that all the considered polynomials are "orthogonal". Nevertheless, you have another complication when you increase the order of the polynomials: the number of changes of sign increases. For that you need to consider a special type of quadrature or use something like Chebfun.