6

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.

Michael E2
  • 235,386
  • 17
  • 334
  • 747
Alex R.
  • 333
  • 2
  • 8

2 Answers2

1

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.

2012rcampion
  • 7,851
  • 25
  • 44
  • I tried using Expand in 10.0.0 but it produced the same error. – Alex R. Feb 23 '15 at 03: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 03: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 03: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 03: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 03:59
  • HermiteH already returns an expanded polynomial, so Expand does nothing to it. My code uses Expand to multiply the exponential by each term individually, and then uses Map to integrate each of those terms separately. – 2012rcampion Feb 23 '15 at 04:09
1

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}]]

enter image description here

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}}

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198