# Symbolic integration fails while numerical integration succeeds

I am hoping to evaluate the following integral

Integrate[((r^3 - 7)^(2/3)*(1 - (r^3 - 7)^(2/3)/r^2))/r^3, {r, 2, Infinity}]


but Mathematica informs me that this integral "does not converge on {2,$\infty$}." However, the numerical integration command

NIntegrate[((r^3 - 7)^(2/3)*(1 - (r^3 - 7)^(2/3)/r^2))/r^3, {r, 2, Infinity}]


yields 0.139837 without mention of any difficulties. Which should I believe?

-
Looking into it. It does appear to be a strangeness with Limit or perhaps Series. – Daniel Lichtblau Jul 30 '13 at 20:17
Appears to be fixed. In[55]:= Integrate[((r^3 - 7)^(2/3)*(1 - (r^3 - 7)^(2/3)/r^2))/ r^3, {r, 2, Infinity}] Out[55]= 23/64 + \[Pi]/(3 Sqrt[3]) + 2/7 Hypergeometric2F1[1, 1, 4/3, 8/7] - 2/7 Hypergeometric2F1[1, 1, 5/3, 8/7] In[56]:= N[%] Out[56]= 0.139836863456 + 0. I – Daniel Lichtblau Dec 22 '15 at 15:45

You can do the analytic integral in Mathematica too, by telling it to perform the upper integration limit as follows:

With[
{
i =
Integrate[((r^3 - 7)^(2/3)*(1 - (r^3 - 7)^(2/3)/r^2))/r^3, r]
},
Simplify[
Limit[i, r -> Infinity] - i /. r -> 2
]
]

(*
==> 23/64 + Pi/(3 Sqrt[3]) -
2 (-(1/7))^(1/3) Hypergeometric2F1[1/3, 1/3, 4/3, 8/7] +
2 (-(1/7))^(2/3) Hypergeometric2F1[2/3, 2/3, 5/3, 8/7]
*)

N[%]//Chop

(* ==> 0.139837 *)

-

Believe the numerical one. Mathematica simply could not do the symbolic integration. Symbolic integration will travel via a different code path. Here the symbolic integration done using Maple, and it agrees with the numerical solution given by Mathematica's NIntegrate

 (7/18)*hypergeom([-1/3, 1, 1], [2, 2], 7/8)-(7/36)*hypergeom([1/3, 1, 1], [2, 2], 7/8)


You can do it in Mathematica like this:

z = Integrate[((r^3 - 7)^(2/3)*(1 - (r^3 - 7)^(2/3)/r^2))/r^3, r];
r1 = Limit[z, r -> Infinity]
(* 3/4 + Pi/(3*Sqrt[3]) *)
r2 = Limit[z, r -> 2]
(r1 - r2) // N
Out[6]= 0.139837 + 0. I


Update:

There is some strange kernel buffering issue here. The integral will work, but it depends on order of thing. On a new FRESH kernel, I found the following: If I run the integral once (but the indefinite version), and then run it again, but use the definite integral now, it work ! Here is screen shot

I think what happens is that some definitions get loaded first time which did not exist before. Once these are loaded, then the next time it works.

-
Wow, we posted the analytical result simultaneously... (+1) – Jens Jul 28 '13 at 6:44
seems to be a bug? – Quonux Jul 28 '13 at 11:43
Nice analysis! I always suspect there's a bug in Integrate but can't tell exactly what the bug is... – Leo Fang Jul 28 '13 at 14:04