1
$\begingroup$

I'm trying to improve the accuracy of a numerical integral of a very complicated function using the Monte Carlo Method by changing the MaxPoints. While doing that I asked to myself if it is better to perform a lot of (say 10) Monte Carlo integrations and then perform the average of all of them or to just increase the value of MaxPoints by a factor 10.

As an example I have performed 7 Monte Carlo integrations using "MaxPoints = $10^6$"

fourkintegral[fun_, k1_, k2_, k3_, k4_, x3_, x5_, x7_, points_] := 
 With[{sol = 
    NIntegrate[(2 Pi) k1 k2 k3 k4 fun Cos[2 (x3 - x5 - x7)], {k1, 0, 
      Infinity}, {k2, 0, Infinity}, {k3, 0, Infinity}, {k4, 0, 
      Infinity}, {x3, 0, 2 Pi}, {x5, 0, 2 Pi}, {x7, 0, 2 Pi}, 
     Method -> {"MonteCarlo", "MaxPoints" -> points}, 
     IntegrationMonitor -> ((errors = Through[#@"Error"]) &) ]}, 
  Around[sol, Total@errors]]

and then I did

fourkintegral[funint[1], k[1], k[3], k[5], k[7], x3, x5, x7, 10^6]

7 times ("funint[1]" is my complicated function) and I performed the average.

The result was

Out[64]= Around[0.0007229541751627402, 0.0004192286316295475]

On the other hand doing the same integral by changing the value of MaxPoints by a factor 7 I obtained the following result

In[66]:= fourkintegral[funint[1], k[1], k[3], k[5], k[7], x3, x5, x7,7*10^6]

Out[66]= Around[0.0003400475222668622, 0.000559829413446022]

The error estimates for the first result is better and therefore I have the following question:

Is it better to perform the average o $N$ Monte Carlo Integrals using $P$ points or just making one integral using $N \times P$ points?

$\endgroup$
1
  • $\begingroup$ While this seems more a question for a mathematics/statistics site than a Mathematica one, the question leads me to wonder about how Mathematica implements `MonteCarlo" and whether it should deliver different results. I hope someone from Wolfram chimes in on this. $\endgroup$
    – Jagra
    Sep 23, 2020 at 13:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.