Re: Accuracy and Precision

*To*: mathgroup at smc.vnet.net*Subject*: [mg36933] Re: Accuracy and Precision*From*: pkosta2002 at yahoo.com (Peter Kosta)*Date*: Wed, 2 Oct 2002 03:32:46 -0400 (EDT)*References*: <anbofj$e7u$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp> wrote in message news:<anbofj$e7u$1 at smc.vnet.net>... > It seems clear to me that what Allan and what you mean by "succeeds" > here refer to quite different things and your objection is therefore > beside the point. There are obviously two ways in which one can > interpret the original posting. The first interpretation, which Allan > and myself adopted, was that the question concerned purely the > computational mechanism of Mathematica. Or, to put it in other words, > it was "why are the results of these two computations not the same?". > In this sense "success" means no more than making Mathematica return > the same answer using the two different routes the original poster used. > You on the other hand choose to assume that the posting shows that its > author does not understand not just the mechanism of significance > arithmetic used by Mathematica but also computations with inexact > numbers in general. I do not think this is necessarily the correct > assumption. I also don't see that Mathematica is doing anything wrong. > After all, one can always check the accuracy of your answer: > > In[1]:= > a = 77617.; b = 33096.; > > In[2]:= > f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + > 5.5*b^8 + a/(2*b) > > In[3]:= > f > > Out[3]= > -1.1805916207174113*^21 > > In[4]:= > Accuracy[%] > > Out[4]= > -5 > > which tells you that it can't be very reliable. What more do you demand? > As you are dealing here only with machine-precision numbers, your argument is valid. From the manual 3.1.6: "When you do calculations with arbitrary-precision numbers, as discussed in the previous section, Mathematica always keeps track of the precision of your results, and gives only those digits which are known to be correct, given the precision of your input. When you do calculations with machine-precision numbers, however, Mathematica always gives you a machine-precision result, whether or not all the digits in the result can, in fact, be determined to be correct on the basis of your input. " In practice, to rely on a numerical result, you ALWAYS have to check its accuracy. How reliable is Accuracy anyway? In[1]:= a = SetAccuracy[77617., Infinity]; b = SetAccuracy[33096., Infinity]; In[3]:= 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), Infinity] Out[3]= 1180591620717411303424 In[4]:= Accuracy[f] Out[4]= Infinity We got completely wrong result with Infinite accuracy. In conclusion, one can not rely on Accuracy. Checking numerical results in Mathematica sounds like a tough task.:-) --PK > Andrzej > > > Andrzej Kozlowski > Yokohama, Japan > http://www.mimuw.edu.pl/~akoz/ > http://platon.c.u-tokyo.ac.jp/andrzej/ > [...] > >