Original post
This is not an answer to the question, but an extended comment. I was curious if the recursion problem (without memorization) would admit an explicit solution in Mathematica. I can withdraw my contribution if you want.
Here we solve the recursion problem in the "natural way", viz. using RSolve. Also we have included the dependence on the variable x.
The recursion equation including the inital condition is
eq = {hr[0, x] == 0,
hr[n, x] ==
hr[n - 1, x] +
Exp[-x^2]/(2^n*n!)*HermiteH[n, x]*HermiteH[n - 1, x]};
The solution
hrs[n_, x_] = hr[n, x] /. RSolve[eq, hr[n, x], n][[1]] // FullSimplify
is an expression using DifferenceRoot[] containing a linear difference equation of 5th order which I don't reproduce here.
It is not ecessary to understand it, since the resulting function can simply be used.
Examples
1) we have operable dependence on the second argument
hrs[1, x]
hrs[2, y]
(* Out[271]= E^-x^2 x
Out[272]= 1/2 E^-y^2 (y + 2 y^3) *)
2) Some more terms
t = Table[hrs[k, z], {k, 0, 4}]
(* Out[270]=
{0, E^-z^2 z, 1/2 E^-z^2 (z + 2 z^3), 1/3 E^-z^2 z (3 - z^2 + 2 z^4),
1/24 E^-z^2 z (15 + 34 z^2 - 20 z^4 + 8 z^6)}
*)
EDIT
I noticed only now the interesting fact that the functions h
are solutions of a linear difference equation of the order 5 in n
. And this inlcudes the Hermite polynomials.
At the same time this exercise took off my slight horror of the function DifferenceRoot[].
The main expression under the DifferenceRoot[] is the difference equation and the initial conditions:
$$\left\{(-n-1) (n+2) y(n)\\+(n+2) \left(n+2 x^2+2\right) y(n+1)\\+\left(2 n^2-6 n x^2+11 n-16 x^2+16\right) y(n+2)\\+\left(-2 n^2+6 n x^2-13 n+20 x^2-22\right) y(n+3)\\-(n+4) \left(n+2 x^2+4\right) y(n+4)\\+(n+4) (n+5) y(n+5)=0,\\y(0)=0,y(1)=2 x,y(2)=2 x^3+x,y(3)=\frac{2}{3} x \left(2 x^4-x^2+3\right),\\y(4)=\frac{1}{12} x \left(8 x^6-20 x^4+34 x^2+15\right)\right\}$$
Notice that except for the case n = 1
the initial conditions are not given by Hermite polynomials.
The surprising incorporation of the Hermite polynomials into the recursion relation for h
might have to do with the fact that HermiteH[]
is itself a solution of a linear difference equation:
ff[n_] = f[n] /.
First[RSolve[
f[n + 1] == 2 x f[n] - 2 n f[n - 1] && f[0] == 1 && f[1] == 2 x,
f[n], n] // Simplify]
(* Out[100]= HermiteH[n, x] *)