1
$\begingroup$

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:

GlobalAdaptive: 6.28318

MonteCarlo: 5.66018

AdaptiveMonteCarlo: 6.01981

QuasiMonteCarlo: 5.15901

AdaptiveQuasiMonteCarlo: 4.59813

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

$\endgroup$
  • 1
    $\begingroup$ 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. $\endgroup$ – mikado May 30 at 21:29
2
$\begingroup$

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 π]]

enter image description here

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

$\endgroup$
  • $\begingroup$ 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 $\endgroup$ – Dominic Jun 1 at 9:17
  • $\begingroup$ @Dominic Cool, thank you for the link :-) $\endgroup$ – AccidentalFourierTransform Jun 1 at 11:39
  • $\begingroup$ I have solved it analytically too. Thanks for your help! $\endgroup$ – lol Jun 1 at 19:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.