Re: Precision issues

*To*: mathgroup at smc.vnet.net*Subject*: [mg73516] Re: Precision issues*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>*Date*: Wed, 21 Feb 2007 01:39:06 -0500 (EST)*Organization*: The Open University, Milton Keynes, UK*References*: <erelv2$7ol$1@smc.vnet.net>

mickey 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? You are using machine-precision numbers; therefore you cannot know since, "Machine numbers, [...], always contain the same number of digits, and maintain no information on their precision. [1]" In[1]:= sol = NIntegrate[Exp[-p^2 - q^2], {p, 0, 10}, {q, 0, 10}, Method -> MonteCarlo[24], MaxPoints -> 1000000] Out[1]= 0.7912492023745136 In[2]:= Precision[sol] Out[2]= MachinePrecision If you desire to be guarantee a specific level of precision, or at least to know when Mahtematica failed to reach the desired precision, you must use arbitrary-precision numbers. See the options PrcecisionGoal and WorkingPrecision on the online help. Regards, Jean-Marc [1] " The Mathematica Book Online / Advanced Mathematics in Mathematica / Numbers / 3.1.4 Numerical Precision" http://documents.wolfram.com/mathematica/book/section-3.1.4