This is strange - because I haven't seen so many dots as the ones spat out in the DifferenceRoot
(they are, documentation tells me, formal parameters never to be assigned a value. If anyone can add an answer with a mini-tutorial on how they are used, it would be appreciated. There's a few answers here with further explanation).
In any case, it doesn't seem to be wrong:
h1[n_]:=HermiteH[n, 1/2]/(n!)
which is what you expect as a special solution of your second case, and
h2[n_]:=DifferenceRoot[
Function[{\[FormalY], \[FormalN]}, {2 \[FormalY][\[FormalN]] - \[FormalY][
1 + \[FormalN]] + (2 + \[FormalN]) \[FormalY][
2 + \[FormalN]] == 0, \[FormalY][0] == 1, \[FormalY][1] ==
1}]][n]
which is what you actually get and looks intimidatingly like

seem to agree:
Table[h1[n] == h2[n], {n, 0, 100}]

Looking a bit at the documentation and the form of the second output, it seems that the DifferenceRoot
expression is a recursive definition for the Hermite polynomial at the specific point but I can't offer you a proof more than the fact that they agree for the first few hundred values of n
.
---EDIT---
As per your comments, I have no clue why this doesn't get "seen" as a Hermite polynomial. My guess was that at x=1/2
, n!
gets suspiciously cancelled at all terms of the series but it would be strange for Mathematica to not hold the expression before doing any pattern matching.
For the record, I insist this is not a wrong result mathematically (the recursive definition for Hermite at x=1/2
would be
myh[n_] := DifferenceRoot[
Function[{\[FormalY], \[FormalN]},
{\[FormalY][\[FormalN] + 1] - \[FormalY][\[FormalN]] + 2 (\[FormalN]) \[FormalY][\[FormalN] - 1] == 0,
\[FormalY][0] == 1, \[FormalY][1] == 1}]][n]
and the series given is myh[n]/n!
but I think I see your point and I agree - in terms of Mathematica evaluation the result is, well... wrong. Evaluating the second expression takes twenty+ times longer:
Divide @@ ({AbsoluteTiming[h2[i];], AbsoluteTiming[h1[i];]} /.
i -> 1000) // First
(*24.*)
I'll keep the answer up for a couple of days and then delete.