Re: Re: Accuracy and Precision

*To*: mathgroup at smc.vnet.net*Subject*: [mg37074] Re: [mg37058] Re: Accuracy and Precision*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Tue, 8 Oct 2002 07:17:35 -0400 (EDT)*References*: <anp065$qtb$1@smc.vnet.net> <200210070926.FAA03967@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Peter Kosta wrote: > > Andrzej Kozlowski <andrzej at tuins.ac.jp> wrote in message news:<anp065$qtb$1 at smc.vnet.net>... > > On Friday, October 4, 2002, at 06:01 PM, DrBob wrote: > > > >[...] > > > > I would say this is correct and show that SetPrecision is very useful > > indeed. It tells you (what of course you ought to already know in this > > case anyway) that machine precision will not give you a realiable > > answer in this case. If you know your numbers with a great deal of > > accuracy you can get an accurate answer: > > > > In[24]:= > > f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - > > 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100]; > > a=SetPrecision[77617.,100]; b = SetPrecision[33096.,100]; > > > > > > In[26]:= > > {f, Precision[f]} > > > > Out[26]= > > {-0.82739605994682136814116509547981629199903311578438481991\ > > 781484167246798617832`61.2597, 61} > > > > Congratulations! You just requested accuracy of 100 for f and got 61 ( > to convince yourself add Accuracy[f] to In[26]). If In[24] one > replaces SetAccuracy by SetPrecision the result is similar. > > PK > [...] One has (initially) an accuracy of 100 for an expression that contains variables. In[25]:= Clear[a,b,f] In[26]:= f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100]; In[27]:= Accuracy[f] Out[27]= 100. Now we assign values to some indeterminants in f. In[28]:= a = SetPrecision[77617.,100]; b = SetPrecision[33096.,100]; In[29]:= {f, Precision[f], Accuracy[f]} Out[29]= {-0.8273960599468213681411650954798162919990331157843848199178148, 61.2599, 61.3422} The precision and accuracy has dropped. This is all according to standard numerical analysis regarding cancellation error. You'll find it in any textbook on the topic. As for what happens when you artificially raise precision (or accuracy) of machine numbers far beyond that guaranteed by their internal representation, that falls into to category of garbage in, garbage out. It is, howoever, valid to use SetPrecision to raise precision in (typically iterative) algorithms where significance arithmetic might be unduly pessimistic due to incorrect assumptions about uncorollatedness of numerical error. Examples of such usage have appeared in this news group. Daniel Lichtblau Wolfram Research

**References**:**Re: Accuracy and Precision***From:*pkosta2002@yahoo.com (Peter Kosta)