       Re: Precision issues

• To: mathgroup at smc.vnet.net
• Subject: [mg73507] Re: Precision issues
• From: "David W.Cantrell" <DWCantrell at sigmaxi.net>
• Date: Wed, 21 Feb 2007 01:34:16 -0500 (EST)
• References: <erelv2\$7ol\$1@smc.vnet.net>

mickey <micky at hotmail.com> wrote:
> Hi,
>
> I am calculating certain integrals numerically and get back a number.
> Now, is it possible to determine how many digits is that answer accurate
> to?
>
> E.g.,
>
> NIntegrate[ Exp[-p^2 - q^2], {p, 0, 10}, {q, 0, 10}, Method ->
>      MonteCarlo, MaxPoints -> 1000000]
>
> Gives,
>
> 0.791249
>
> How many digits is this answer accurate to?

In this case, you can calculate the integral precisely first. Then
approximate that result to whatever accuracy you wish, and compare that
with what you got above.

In:= Integrate[Exp[-p^2 - q^2], {p, 0, 10}, {q, 0, 10}]

Out= (1/4)*Pi*Erf^2

In:= N[%, 20]

Out= 0.78539816339744830962

David

• Prev by Date: Re: Find index of maximal element in multi-dimensional array
• Next by Date: Re: Find index of maximal element in multi-dimensional array
• Previous by thread: Re: Precision issues
• Next by thread: Re: Precision issues