I’m currently getting to grips with the AdaptiveMonteCarlo method in the NIntegrate function. I’ve been using the sub-method MonteCarloRule, however I’m unsure from reading the Mathematica documentation exactly how the option Points (for this sub-method) actually works. Suppose for example I have the following integral $$\int_{0}^{\pi}\sin(x)dx$$ Then using NIntegrate I have

NIntegrate[Sin[x], {x,0,Pi}, Method->{“AdaptiveMonteCarlo”, Method->{“MonteCarloRule”, “Points”->5}, “MaxRecursion”->200}, AccuracyGoal->5, PrecisionGoal->5]


Now, I realise that I could simply use Integrate on this integral and get an exact result, but I wanted to choose a relatively simple analytic integral as practise.

Using Points->5 gives a pretty accurate result, but does specifying Points->5 mean that NIntegrate only uses 5 points in its Monte Carlo routine? I’m assuming there must be more to it than that otherwise I wouldn’t expect the result to be so close to the true result.

Any help would be much appreciated.

• See this answer to a similar question "Monte Carlo integration with random numbers generated from a Gaussian distribution". – Anton Antonov Oct 9 '17 at 18:46
• @AntonAntonov Thanks for the link. I’ve had a read through your answer, but I’m still unsure as to what Points does?! Is it related to PointGenerator? – user35305 Oct 9 '17 at 19:14
• Points specifies the number of sampling points in a single rule application. The point generator uses that option value. – Anton Antonov Oct 9 '17 at 19:27
• @AntonAntonov So is the example I gave literally only using 5 sample points to calculate the integral? – user35305 Oct 9 '17 at 19:38