Decomposition on a Hermite basis

Being the eigenstates of the harmonic oscillator, a set of Hermite functions is a basis of the Hilbert state. This amazing consequence of Hilbert mathematics is illustrated here where you can change a target function chosen among a rectangle, a triangle and a gaussian by changing its center and width.

In fact, the decomposition is exact only when an infinite number of basis functions is used. When truncating the basis to a finite number of element, the decomposition is only approximate.