Re: Re: Accuracy and Precision
- To: mathgroup at smc.vnet.net
- Subject: [mg37122] Re: Re: Accuracy and Precision
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Thu, 10 Oct 2002 03:21:08 -0400 (EDT)
- References: <ao0t54$gqo$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Bobby, The example that I gave in my previous posting does not make my point, or it makes it in rather a hidden way, but it does show something interesting about computation with bigfloats. I'll explain what I mean by this and then give an example that does make the point directly. First, the previous example: Sin[#1]*10^#1*Log[1+10^(-#1)]&[15.9] -0.336629 Sin[#1]*10^#1*Log[1+10^(-#1)]&[SetPrecision[15.9,20]] Precision[%] -0.190858581374189370 17.7558 Sin[#1]*10^#1*Log[1+10^(-#1)]&[SetPrecision[15.9,7]] Precision[%] -0.19086 4.70309 (**) It looks as if the internal computations must be to a higher precision than 4 and that they start at SetPrecision[15.9,7]//FullForm 15.9000000000000003553`7 With MaxError = 10^-Accuracy[sp]//FullForm 1.590000000000001`*^-6 Roughly speaking, not more than the first seven digits are asserted to be correct. Now, the new example (taken from Stan Wagon, Programming Tips, Mathematica in Education and Research Volume 7, Number 2, 1988 p50) Clear[x] ser= Normal[Series[Cos[x],{x,0,200}]]; x= 75.0; ser//FullForm -2.7019882604300525`*^15 Probably not reliable. Set precision to 20: x= SetPrecision[75.0, 20]; (a=ser)//FullForm -16928.799183047`1.4688 MaxError= 10^-Accuracy[a] 575.263 Not good enough. Raise the precision to x= SetAccuracy[75.0,40]; (a=ser)//FullForm 1.0807905977573169155`7.7627 MaxError = 10^-Accuracy[a] \!\(1.3999657487996298`*^-6\) That is 1.3999657487996298 10^-6 Good enough Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565