# NIntegrate a singular function

I am trying to do this integral numerically:

NIntegrate[(1/(x^2 + y^2 + z^2)^(1/2) - 1/((x - 1)^2 + y^2 + z^2)^(
1/2))^2, {x, -Infinity, Infinity}, {y, -Infinity,
Infinity}, {z, -Infinity, 0}]


But for different methods in NIntegrate, I got different results:

MonteCarlo: 5.66018

QuasiMonteCarlo: 5.15901

I am not sure which one is more accurate. Any help will be appreciated!

• The value given by GlobalAdaptive is very close to 2 pi. It should be more accurate than the other methods, though it does give warnings suggesting that the answer might be doubtful. – mikado May 30 '19 at 21:29

Increase the precision and check what happens:

Table[
NIntegrate[(1/(x^2 + y^2 + z^2)^(1/2) - 1/((x - 1)^2 + y^2 + z^2)^(1/2))^2
, {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, {z, -Infinity, 0}
, Method -> {"GlobalAdaptive", "MaxErrorIncreases" -> n 1000}, WorkingPrecision -> 20, MaxRecursion -> 5 n]
, {n, 1, 8}
]
ListLogPlot[Abs[% - 2 π]]


And so, indeed, it appears that the integral converges to $$2\pi$$.

• I found the integral interesting in itself and asked in the Mathematica forum how it would be solved analytically. Adam there solved it beautifully: [1]: math.stackexchange.com/questions/3246406/show-integral-is-2-pi – Dominic Jun 1 '19 at 9:17
• @Dominic Cool, thank you for the link :-) – AccidentalFourierTransform Jun 1 '19 at 11:39
• I have solved it analytically too. Thanks for your help! – lol Jun 1 '19 at 19:25