Integration of three dimensional function gives wrong answer!

The integral over the subregion does not converge:

Integrate[
 (m^2 - 2 x^2 + y^2 + z^2)/(m^2 + x^2 + y^2 + z^2)^(5/2),
 {y, -Infinity, Infinity},
 {z, -Infinity, Infinity},
 {x, -Sqrt[1 + y^2 + z^2], Sqrt[1 + y^2 + z^2]}, 
 Assumptions -> m > 0 && {x, y, z} \[Element] Reals]
(*  Infinity  *)

The triple integral does not equal the iterated integral, something that Integrate[] misses.

The surface m^2 - 2 x^2 + y^2 + z^2 == 0 divides space into a region over which the integral diverges to positive infinity and one over which the integral diverges to negative infinity. One could try to choose a principal value. One has to be aware that one can obtain any result. The surface m^2 - 2 x^2 + y^2 + z^2 == 0 was a convenient (and somewhat obvious) choice for analyzing the divergence of the integral. It is not necessarily for it to be used to define a principal value. A common choice is as follows. It has the appealing attraction of corresponding somewhat with the symmetry of the integral. Since over a ball $B$ centered at the origin we have by symmetry $$\textstyle \int_B \frac{x^2}{\left(m^2+x^2+y^2+z^2\right)^{5/2}} \; dV = \int_B \frac{y^2}{\left(m^2+x^2+y^2+z^2\right)^{5/2}} \; dV = \int_B \frac{z^2}{\left(m^2+x^2+y^2+z^2\right)^{5/2}} \; dV \,, $$ therefore we get some cancellation and $$ \int_B \frac{m^2-2 x^2+y^2+z^2}{\left(m^2+x^2+y^2+z^2\right)^{5/2}} \; dV = \int_B \frac{m^2}{\left(m^2+x^2+y^2+z^2\right)^{5/2}} \; dV = \frac{4 \pi R^3}{3 \left(m^2+R^2\right)^{3/2}} $$ which converges to $4\pi/3$ as the radius $R$ goes to infinity.

But maybe its attraction is as a Siren leading sailors into a shipwreck.


The integral is indeed equal to $$ \iiint (f_x+f_y+f_z)=4\pi $$ where $f_i=\partial_i(p_i/(p^2+m^2)^{3/2})$. This is easy to prove using spherical symmetry and e.g. the Gauss theorem (the integral is basically the residue at infinity, and so independent of $m$).

The integral is perfectly convergent; indeed, it is easy to see that $(f_x+f_y+f_z)\sim 1/r^5$:

Div[{px, py, pz}/(px^2 + py^2 + pz^2 + m^2)^(3/2), {px, py, pz}] /. {px -> r Cos[θ] Sin[ϕ], py -> r Cos[θ] Cos[ϕ], pz -> r Sin[θ]} // FullSimplify
Series[%, {r, ∞, 4}]
(* O[1/r]^5 *)

The problem is that the partial integrals $$ \iiint f_i $$ do not exist individually. Indeed, they are $f_i\sim 1/r^3$:

D[px/(px^2 + py^2 + pz^2 + m^2)^(3/2), px] /. {px -> r Cos[θ] Sin[ϕ], py -> r Cos[θ] Cos[ϕ], pz -> r Sin[θ]} // FullSimplify
Series[%, {r, ∞, 2}]
(* O[1/r]^3 *)

(This, together with $\mathrm d\boldsymbol p=4\pi p^2\mathrm dp$ means that the integrand is $\sim 1/r$, which is not integrable).

Unfortunately, Mathematica was not able to identify the divergence of the integral: the result it yields is just meaningless.


This appears to be a case where you genuinely cannot change the order of integration. I think it's a Mathematics problem not a Mathematica problem.

Define relevant assumptions

$Assumptions = {px^2 > 0, py^2 > 0, pz^2 > 0};

Evaluate and simplify the integrand

expr = 
 D[px (px^2 + py^2 + pz^2 + m^2)^(-3/2), px] /. m -> 1 // FullSimplify
(* (1 - 2 px^2 + py^2 + pz^2)/(1 + px^2 + py^2 + pz^2)^(5/2) *)

The integral w.r.t. px is zero. (This can be verified easily by specifying numerical values for py and pz)

Integrate[expr, {px, -∞, ∞}]
(* 0 *)

Integrating w.r.t. py and pz

Integrate[expr, {py, -∞, ∞}, {pz, -∞, ∞}]
(* (2 π)/(1 + px^2)^(3/2) *)

Since the integrand is always positive, this is unsurprisingly non-zero

Integrate[%, {px, -∞, ∞}]
(* 4 π *)