MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NIntegrate with AdaptiveMonteCarlo gives different results

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123331] Re: NIntegrate with AdaptiveMonteCarlo gives different results
  • From: Jacopo Bertolotti <J.Bertolotti at utwente.nl>
  • Date: Fri, 2 Dec 2011 07:19:24 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Any MonteCarlo method to solve an integral will approximate the result 
in a non-deterministic way. Very naively you can think that the 
algorithm randomly select a point on the plane and then look if it falls 
under the curve or not (of course the real think is much smarter than 
this simplified picture but the basic idea is the same); in the limit of 
a infinite number of points the ratio between the point that fell 
outside and inside the curve will give you the area you look for. Since 
you always use only a finite number of points you always have some 
fluctuations in the final result. If you want your fluctuation to be 
smaller the easiest thing to do is to increase the number of points 
used. The example given in the manual (look for the tutorial "Advanced 
Numerical Integration in Mathematica") is:
NIntegrate[1/Sqrt[x], {x, 0.01, 1}, Method -> {"MonteCarlo", "MaxPoints" 
-> 10^3}]

Hope it helps

Jacopo

On 12/01/2011 02:03 PM, valentina wrote:
> Hello everybody,
> I am dealing with a three dimensional integral and I am using
> NIntegrate. Searching the web I found out that the best method is the
> AdaptiveMonteCarlo, which also speed up the calculation.
> this is the integral, no particular singular points:
>
>
> test[d_] := (0.5  NIntegrate[(compnx[x, y, z, d] +
>         compny[x, y, z, d] + compnz[x, y, z, d]), {z, -R - d/2,
>        R + d/2}, {x, -R, R}, {y, -R, R},
>       Method ->  "MultiDimensionalRule"]*hc) // Timing
>
> so I want to calculate it for different values of the parameter d, but
> for example if I successively calculate it for d=4 i get two different
> results which differs of about 30-50 MeV.
>
> Does anyone know if it is a bug or how could I fix it?
>
> Thanks in advance.
>
>




  • Prev by Date: Re: how to get string in sci. notation to a number?
  • Next by Date: Re: Laplace equation with gradient boundary conditions
  • Previous by thread: Re: NIntegrate with AdaptiveMonteCarlo gives different results
  • Next by thread: Re: NIntegrate with AdaptiveMonteCarlo gives different results