# Integral does not converge (when it should) [duplicate]

Bug introduced in 10.0 and fixed in 10.0.2

I was looking at integrals like:

Integrate[HermiteH[50, x]*Exp[-x^2], {x, 0, Infinity}]


which gave me a "does not converge on $(0,\infty)$" error. On the other hand something like

Integrate[(x^50)*Exp[-x^2]], {x, 0, Infinity}]
Integrate[HermiteH[4,x]*Exp[-x^2]], {x, 0, Infinity}]


works just fine. In general, for $n\geq 16$, $\int_0^\infty H_n(x)e^{-x^2}dx$ is reported as divergent.

Is there an easy way to resolve this bug?

I should mention that I'm using Mathematica 10.0.0.0.

• It returns zero on Mma v9 – Dr. belisarius Feb 23 '15 at 2:15
• @belisarius: I know, you get zero for even $n$, and not zero for odd $n$. But it should very well converge for any $n$. Did i maybe change an option somewhere? – Alex R. Feb 23 '15 at 2:17
• Sorry, I don't have v10 around so I can't test your problem – Dr. belisarius Feb 23 '15 at 2:19
• Works fine in 10.0.2. Always upgrade to the latest point release. Lots of bugs got fixed since 10.0.0, and 10.0.0 has a reputation for being pretty buggy ... – Szabolcs Feb 23 '15 at 2:26
• Probably duplicates: (61866), (65120) – Michael E2 Aug 3 '15 at 14:33

Integrating each term separately obtains the desired result:

Integrate[#, {x, 0, \[Infinity]}] & /@
Expand[HermiteH[50, x] Exp[-x^2]]


results in 0.

If each term of the integral is convergent, the whole integral must be convergent, so this must be a bug.

• I tried using Expand in 10.0.0 but it produced the same error. – Alex R. Feb 23 '15 at 3:31
• Interesting... I can duplicate your problem in my version (10.0.0.0, $Version == "10.0 for Microsoft Windows (64-bit) (June 29, 2014)"), but this solution solves it. Which of the terms is it giving Integrate::idiv for? – 2012rcampion Feb 23 '15 at 3:45 • I'm on iOS. I tend to get divergence errors for$n\geq 15$of$\int_{-\infty}^\infty H_n(x)e^{-x^2}dx$– Alex R. Feb 23 '15 at 3:52 • When you integrate term-by-term (using my code above) for, say, n = 16, which of the terms are divergent? – 2012rcampion Feb 23 '15 at 3:56 • I'm actually not sure because I upgraded to 10.0.2 which fixed the error. Before using Expand I had: Integrate[Expand[Hermite[20,x]]*Exp[-x^2],{x,0,Infinity}] and that didn't work. – Alex R. Feb 23 '15 at 3:59 Did you try using assumptions? Using assumptions with version 10.0.0, I get the same results as with version 10.0.2 $Version


"10.0 for Mac OS X x86 (64-bit) (June 29, 2014)"

Clear[f]

f[n_Integer] = Integrate[HermiteH[n, x]*Exp[-x^2], {x, 0, Infinity},
Assumptions -> {Element[n, Integers]}]


(2^(-1 + n)*Sqrt[Pi])/Gamma[1 - n/2]

Integrate[HermiteH[n, x]*Exp[-x^2], {x, 0, Infinity}]


ConditionalExpression[ (2^n*(-2 + n)Sqrt[Pi] Hypergeometric2F1[1, (1 - n)/2, 1/2, 1])/(n*Gamma[-(n/2)]), NotElement[n, Integers] && Re[n] > 0]

However, assuming the stated conditions gives the same result as the integer case

f[n_] = Integrate[HermiteH[n, x]*Exp[-x^2], {x, 0, Infinity},
Assumptions -> {NotElement[n, Integers] && Re[n] > 0}]


(2^(-1 + n)*Sqrt[Pi])/Gamma[1 - n/2]

Combining the results

Clear[f]

f[n_] = (2^(-1 + n)*Sqrt[Pi])/Gamma[1 - n/2];

Simplify[f[2 n], {Element[n, Integers], n > 0}] // Quiet


0

Show[
Plot[f[n], {n, -5, 5}, PlotRange -> All],
DiscretePlot[f[n], {n, -5, 5}]]


Table[{n, f[n]}, {n, -5, 50}]


{{-5, 1/120}, {-4, Sqrt[Pi]/64}, {-3, 1/12}, {-2, Sqrt[Pi]/8},
{-1, 1/2}, {0, Sqrt[Pi]/2}, {1, 1}, {2, 0}, {3, -2}, {4, 0},
{5, 12}, {6, 0}, {7, -120}, {8, 0}, {9, 1680}, {10, 0}, {11, -30240}, {12, 0}, {13, 665280}, {14, 0}, {15, -17297280}, {16, 0}, {17, 518918400}, {18, 0}, {19, -17643225600}, {20, 0},
{21, 670442572800}, {22, 0}, {23, -28158588057600}, {24, 0},
{25, 1295295050649600}, {26, 0}, {27, -64764752532480000},
{28, 0}, {29, 3497296636753920000}, {30, 0}, {31, -202843204931727360000}, {32, 0}, {33, 12576278705767096320000}, {34, 0}, {35, -830034394580628357120000}, {36, 0}, {37, 58102407620643984998400000}, {38, 0}, {39, -4299578163927654889881600000}, {40, 0}, {41, 335367096786357081410764800000}, {42, 0}, {43, -2750010193648128067568271360000\ 0}, {44, 0}, {45, 23650087665373901381087133696000\ 00}, {46, 0}, {47, -212850788988365\ 112429784203264000000}, {48, 0}, {49, 2000797416490632056839971510\ 6816000000}, {50, 0}}