Bug introduced in 8.0 and fixed in 10.0
I attempted to calculate the following integral:
Integrate[ Sqrt[x] Exp[-(x - a)^2], {x, 0, ∞}, Assumptions -> a > 0]
1/(4 Sqrt[a])I E^(-(a^2/2)) π( a^2 BesselI[-(1/4), a^2/2] - (1 + a^2) BesselI[1/4, a^2/2]
+ a^2 (BesselI[3/4, a^2/2] - BesselI[5/4, a^2/2]))
This is obviously incorrect, since applying the rule $a \rightarrow 0.3$ yields $-0.37\mathrm{i}$, whereas the correct result obtained from NIntegrate
is $0.907$.
I have two questions:
- Does anyone know the correct answer? And perhaps more importantly,
- Does anyone have any idea why such a simple integral is resulting in a completely incorrect output? I find it disturbing that the program is capable of yielding incorrect results without warning to the user. In this case the answer was obviously wrong, but what about for more complicated expressions?
Note: removing the Assumptions
option still yields the same incorrect result.
Answer
Here's the exact answer:
i1 = Integrate[x^n Exp[-(x - a)^2], {x, 0, Infinity},
Assumptions -> n > 0] /. n -> 1/2
(* 1/2 E^-a^2 (Gamma[3/4] Hypergeometric1F1[3/4, 1/2, a^2] +
1/2 a Gamma[1/4] Hypergeometric1F1[5/4, 3/2, a^2]) *)
i1 /. a -> 0.3
(* 0.907605 *)
Comments
Post a Comment