# Computing an integral : Mathematica seems to say it's diverging or not defined and I think it is

I would like to compute :

Element[a, Integers]
Element[b, Integers]
Integrate[Exp[-a^2*(x (1 - x/b^2))^2], {x, 0, Infinity}]


which is obviously not diverging. But for some reason Mathematica can't solve it. So I tried to change the variable : $$x \rightarrow x (1 - x/b^2)$$. Now :

Integrate[Exp[-a^2*x^2]*1/(1 - (2 x)/b^2), {x, 0, Infinity}]


And then I get the answer :

ConditionalExpression[1/8 b^2 E^(-(1/4) a^2 b^4) (2 \[Pi] Erfi[1/2 Sqrt[a^2] b^2] + 2 ExpIntegralEi[(a^2 b^4)/4] + 2 Log[a^2] + Log[1/(a^2 b^4)]
- 4 Log[-(1/b^2)] - Log[a^2 b^4]),
(Re[b^2] < 0 || b^2 \[NotElement] Reals) && Re[a^2] > 0]


which implies that $$b^2<0$$, because of the $$- 4 Log[-(1/b^2)]$$ I assume. But I don't get it. Even if $$b^2>0$$ it's converging ! Could it mean it exists but it can't be solved analytically ?

Or what's the mistake ? And is there a way to go around that issue ?

• Probably your substitution is wrong. I would expect for z-> x (1-x/b^2) something like Integrate[Exp[-a^2*z^2]/z 1/2 (b^2 +/- b Sqrt[b^2 - 4 z]), {z, 0, Infinity}] – Ulrich Neumann Nov 19 '18 at 9:08
• In the expression (dg/dx)^-1, which depends on x(!), you have to substitute x[g] according to your substitution. – Ulrich Neumann Nov 19 '18 at 9:19
• Thx ! Yes that was a silly mistake. But I still get the answer with a conditional expression where : (* b^2 [NotElement] Reals ) . I computed the integral ( Integrate[Exp[-a^2*z^2]*(b/Sqrt[b^2 - 4 z]), {z, 0, Infinity}] *) . I think that in your integral you didn't derivate $dx/dz$ – J.A Nov 19 '18 at 9:24
• Simplify your integral by factoring out (and ignoring) Exp[-a^2] once and for all. – David G. Stork Nov 19 '18 at 9:28
• In the second integral there is a pole for real b, so it really does diverge. – Daniel Lichtblau Nov 19 '18 at 15:03

The function under the integral is

f = Exp[-a^2*(x (1 - x/b^2))^2]


One can re-scale the variable x: x -> b^2 y and come to a simple single-parametric expression:

f /. x -> b^2 y

(* E^(-a^2 b^4 (1 - y)^2 y^2) *)


If one tries now to solve the integral:

Integrate[E^(-c*(1 - y)^2 y^2), {y, 0, \[Infinity]},
Assumptions -> c > 0]


where c=a^2*b^4, Mma returns the result unevaluated. This means that Mma "does not know" the result. The probability that this integral cannot be solved exactly is very high.

However, this integral can be easily solved numerically, if this is OK with you. Since a and b take only integer values let us assume them taking both the values 1, 2, 3, 4 and let us form a list:

lst0 = DeleteDuplicates[
Table[a^2*b^4, {a, 1, 4}, {b, 1, 4}] // Flatten] // Sort

{1, 4, 9, 16, 64, 81, 144, 256, 324, 729, 1024, 1296, 2304, 4096}


and now let us calculate the integral

lst = Table[{c,
NIntegrate[
E^(-c*(1 - y)^2 y^2), {y, 0, \[Infinity]}]}, {c,
lst0}]

(* {{1, 1.51102}, {4, 1.19959}, {9, 0.986592}, {16, 0.805204}, {36,
0.533168}, {64, 0.37515}, {81, 0.325363}, {144, 0.234509}, {256,
0.172347}} *)


Do not forget that for the sake of shortness I leaved out the factor b^2` in front of the integral.

Have fun!