I don't have much experience of numerical methods for multidimensional integrals. Currently, the particular function I want to integrate is:

$$f(x,y,z,p_x,p_y,p_z) = \frac{p_x^2(2 p_x x(p_y y + 4 p_z z)-2 p_x^2(y^2+4 z^2)+x^2 \sqrt{x^2+y^2+4 z^2})}{2 (x^2+y^2+4 z^2)^{\frac{3}{2}}}$$

I want to integrate $f(x,y,z,p_x,p_y,p_z)$ over the entire real plane: $\int_{-\infty}^{\infty}dx\int_{-\infty}^{\infty}dy\int_{-\infty}^{\infty}dz\int_{-\infty}^{\infty}dp_x\int_{-\infty}^{\infty}dp_y\int_{-\infty}^{\infty}dp_z f(x,y,z,p_x,p_y,p_z)$

  (px^2 (2 px x (py y + 4 pz z) - 2 px^2 (y^2 + 4 z^2) + 
   x^2 Sqrt[x^2 + y^2 + 4 z^2]))/(2 (x^2 + y^2 + 4 z^2)^(3/2)),
  {x, -∞, ∞},
  {y, -∞, ∞},
  {z, -∞, ∞},
  {px, -∞, ∞},
  {py, -∞, ∞},
  {pz, -∞, ∞}

The above code couldn't evaluate a value and returns:

NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.

Is there some general strategy to look at the function and see which numerical method to use?


If I break down the function as follows: $f(x,y,z,p_x,p_y,p_z) = \frac{2 p_x^3 x(p_y y + 4 p_z z)}{2 (x^2+y^2+4 z^2)^{\frac{3}{2}}} - \frac{p_x^4 (y^2 + 4 z^2)}{(x^2+y^2+4 z^2)^{\frac{3}{2}}} + \frac{x^2 p_x^2}{2(x^2+y^2+4 z^2)}$

The first term when integrated will be 0 because it is an odd function in $p_x$ (NIntegrate also return the same result)

$\int_{-\infty}^{\infty} d p_x \frac{2 p_x^3 x(p_y y + 4 p_z z)}{2 (x^2+y^2+4 z^2)^{\frac{3}{2}}} = 0$

Naively, I would expect the second and third term when integrated to give $-\infty$ and $\infty$ respectively. Is it possible for those 2 terms to cancel to 0 or something finite?

  • $\begingroup$ Change NIntegrate to Integrate and you'll get a non-convergence warning. It seems plausible, but I don't have time to track it down just now...(sorry). $\endgroup$ – Michael E2 Nov 4 '14 at 15:28
  • $\begingroup$ Interesting, I just tested that, it says my integral does not converge in the range of -infinity to infinity. $\endgroup$ – user29165 Nov 4 '14 at 15:40
  • 1
    $\begingroup$ Looking at the integrand more closely, I see it is a polynomial in {px, py, pz}. The integral most certainly diverges. $\endgroup$ – Michael E2 Nov 4 '14 at 17:56
  • $\begingroup$ The integral of the odd term is still divergent and equal zero only in the sense of the Cauchy Principal Value. You can ask Mathematica to compute this with the option PrincipalValue -> True (for Integrate). $\endgroup$ – Michael E2 Nov 5 '14 at 21:06
  • 1
    $\begingroup$ There are many ways to define values for divergent integral (and series), but they are tricky. You need to have some external reason for thinking one way will give reliable results that are applicable to the problem at hand. For instance, the Cauchy Principal Value is not translation invariant: change x to x - 1 and you change the value (for some integrals). Intuitively that means shifting the region changes the area, which is un-geometric. (Of course, there's no real violation because the region is infinite.) But blindly choosing a method might give unreliable results. $\endgroup$ – Michael E2 Nov 5 '14 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.