# Result of Integrate depends on order of integration although the domain is rectangular

The following:

Mass/(2 J)
Integrate[(-2 Rotation (r^2 (r - Mass) (1 - 3 Cos[θ]^2) - Rotation^2 (r Cos[θ]^2 (3 - Cos[θ]^2) -
Mass (1 + Cos[θ]^2) (2 - Cos[θ]^2))))/(r^2 + Rotation^2 Cos[θ]^2)^2 Sin[θ], {r, r1, ∞}, {θ, 0, π},
Assumptions -> r1 > 0 && Rotation >= 0 && Mass > 0]


yields

(1/(6 J r1^2 Rotation^2))Mass (r1 Rotation (12 r1^3 +
8 r1 Rotation^2 - 3 Mass (6 r1^2 + π r1 Rotation + 2 Rotation^2)) +
6 Mass r1^2 Rotation^2 ArcTan[r1/Rotation] + 6 (-2 r1^3 (r1^2 + Rotation^2)+
Mass (3 r1^4 + 3 r1^2 Rotation^2 - Rotation^4)) ArcTan[Rotation/r1])


in v.9.0.1 and

(1/(6 J r1^2 Rotation^2))Mass (2 r1^2 (6 r1^2 Rotation + 4 Rotation^3 - 3 π r1 (r1^2 + Rotation^2)) +
3 Mass (-2 r1 Rotation (3 r1^2 + Rotation^2) + π (3 r1^4 + 2 r1^2 Rotation^2 - Rotation^4)) +
6 (r1^2 + Rotation^2) (2 r1^3 + Mass (-3 r1^2 + Rotation^2))ArcTan[r1/Rotation])


in v.10.0.0. If I switch the order of integration, v.9.0.1 says that the integral diverges and v.10.0.0 does not return after tens of minutes. Numerical integration indicates that this integral converges. According to Fubini's theorem, the order of integration should not matter for rectangular domain. Why does the result depend on the order of integration?

This is related to Mathematica 10 fails to calculate integral that Mathematica 9 can handle. In that case, Mathematica 10 fails to calculate the integral unless I change the order of integration. In this case, the result is wrong if I change the order of integration.

-
The fact that integration order matters in this case seems to be due to the fact that the integration in r goes to infinity, so the domain isn't compact. However, I do agree that the behavior of Mathematica has changed, and it would be good to understand better why that is. – Jens Jul 25 '14 at 19:26
The degree (of r) in the denominator is 4 and the numerator has an r^3 term, with coefficient (1 - 3 Cos[θ]^2) Sin[θ]. It seems to me that if the r integral is done first, it diverges almost everywhere. If the θ is done first, there is cancellation that leads to the convergence of the r integral. – Michael E2 Jul 25 '14 at 21:19
@MichaelE2 I agree, and I think version 10 should recognize the divergence more quickly, as is the case in version 8 (and apparently in 9). Maybe it gets stuck in trying to combine some ConditionalExpressions. Don't have time to investigate right now... – Jens Jul 25 '14 at 21:24
@Jens Oops, I read past the fact that the OP complains about how long it takes. For me, it takes a little over 6 sec. (but I have only the latest beta V10, which might make a difference, but I doubt it). – Michael E2 Jul 25 '14 at 21:31
@Jens,@MichaelE2: According to The Lebesgue-Stieltjes integral, p. 118, absolute convergence implies that the order does not matter (Fubini's theorem). Nintegrate over the absolute integrand yields Numerical integration converging too slowly[...]. As I increase the upper limit, the integral seems to increase with always diminishing rate, which indicates that it converges. I'm not very knowledgeable about the intricacies of integration, as I'm a physicist. Apparently, I need to learn more... – auxsvr Jul 25 '14 at 22:54