Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6896 > unrolled thread

Re: NIntegrate with AdaptiveMonteCarlo gives different results

Started byBill Rowe <readnews@sbcglobal.net>
First post2011-12-02 12:27 +0000
Last post2011-12-02 12:27 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: NIntegrate with AdaptiveMonteCarlo gives different results Bill Rowe <readnews@sbcglobal.net> - 2011-12-02 12:27 +0000

#6896 — Re: NIntegrate with AdaptiveMonteCarlo gives different results

FromBill Rowe <readnews@sbcglobal.net>
Date2011-12-02 12:27 +0000
SubjectRe: NIntegrate with AdaptiveMonteCarlo gives different results
Message-ID<jbag8d$21c$1@smc.vnet.net>
On 12/1/11 at 8:03 AM, fuchi8@tiscali.it (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?

You have not posted code for the function compnx. So, I will
have to speculate as to the source of the problem.

Mathematica caches results from computations for a variety of
algorithms. And the next evaluation makes use of the cached
results from the previous calculation. Mathematica also has
default time constraints on algorithms that can run for long
times such as integration. The combined effect cached
information and time constraints is that a second calculation
can be different than the first.

There are a few ways to check on my speculation above.

=46irst, you can use ClearSystemCache[] between the two
computations. This will clear cached information and should make
the second computation agree with the first.

Another possibility would be to add

TimeConstraint->some large value

If the my speculation is correct, a large enough value should
cause both computations to be the same as the second result.

Also, I see in the subject of your post you comment about
AdaptiveMonteCarlo integration. Yet your code specifies the
method to use as MultiDimensionsalRule. I don't believe
specifying the method as you've done in your code actually does
MonteCarlo sampling. At least that is the impression I get when
reading tutorial/NIntegrateOverview.

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web