# Why does Integrate get this wrong?

Why does Integrate get this wrong?

b = 2;

NIntegrate[E^(-x^2) HypergeometricU[-b/2, 1/2, x^2], {x, -Infinity, Infinity},
AccuracyGoal -> 4]
(* -7.67473*10^-9 *)

Clear[b];

Integrate[E^(-x^2) HypergeometricU[-b/2, 1/2, x^2], {x, -Infinity, Infinity}]
(* ConditionalExpression[-(((-2 + b) Sqrt[π] Hypergeometric2F1[1, (1 - b)/2, 1/2, 1])/
Gamma[1 - b/2]), Re[b] > 0] *)

f[b_] := ConditionalExpression[-(((-2 + b) Sqrt[π]
Hypergeometric2F1[1, (1 - b)/2, 1/2, 1])/
Gamma[1 - b/2]), Re[b] > 0]

f[2]
(* Indeterminate *)

• Have you submiited a bug report toWRI? Sep 23, 2020 at 18:51

Mathematica is unable to determine the limit f[b] for b->2.

If you don't integrate to Infinity, but only up to a cutoff c you get

c = 10; Table[{NIntegrate[Exp[-x^2] HypergeometricU[-b/2, 1/2, x^2], {x, -c, c}],c MeijerG[{{1/2}, {(1 - b)/2}}, {{0, 1/2}, {-(1/2)}}, c^2]}, {b, 0,
3, 0.2}] // N


with good agreement.

• Andreas, you are not right: Limit[-(((-2 + b) Sqrt[\[Pi]] Hypergeometric2F1[1, (1 - b)/2, 1/2, 1])/Gamma[1 - b/2]), b -> 2, Direction -> "FromAbove"] performs 0 and Limit[-(((-2 + b) Sqrt[\[Pi]] Hypergeometric2F1[1, (1 - b)/2, 1/2, 1])/Gamma[1 - b/2]), b -> 2, Direction -> "FromBelow"] produces ComplexInfinity. I think the result of Integrate is not correct. Sep 23, 2020 at 18:48
• Because the results from above and below are different the value f[2] is returned as 'indeterminate'. With the cutoff in the integration range one gets an analytic result (MeijerG) with reasonable accuracy. Sep 23, 2020 at 18:59
• If you leave c symbolic and integrate, then take the (direction-free) limit as b->2, you get c*Exp[-c^2]. This of course vanishes as c->Infinity. Sep 23, 2020 at 23:16
• I found the answer in Gradshteyn and Ryzhik 7th edition, formula 7.621.6. You have to change variables to transform to their integral. The answer to the Integrate[ ..] above is Sqrt[Pi]/Gamma[-b/2 + 1]. I think Mathematica gives an incorrect answer. Sep 25, 2020 at 19:54
• If you evaluate the defining Series of the Hypergeometric2F1 function you get 1/(2-b) Sep 25, 2020 at 21:48