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[24], 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[46]:= Integrate[Exp[-p^2 - q^2], {p, 0, 10}, {q, 0, 10}]
Out[46]= (1/4)*Pi*Erf[10]^2
In[47]:= N[%, 20]
Out[47]= 0.78539816339744830962
David