Re: Accuracy and Precision
- To: mathgroup at smc.vnet.net
- Subject: [mg36872] Re: Accuracy and Precision
- From: Bill Rowe <listuser at earthlink.net>
- Date: Mon, 30 Sep 2002 03:03:20 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Neither SetAccuracy[expr,n] nor SetPrecisions[expr,n] modify expr. These functions modify the prinout not the internal representation. So, the first computation of f is done with approximate numbers and doesn't result in a correct answer due to approximate arithmetic. By assigning a rational expression to each of the variables, you have made them exact numbers and Mathematica responds with an exact solution. On 9/29/02 at 2:55 AM, pkosta2002 at yahoo.com (Peter Kosta) wrote: >Could someone explain what is going on here, please? > >In[1]:= a = 77617.; b = 33096.; > >In[2]:= SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity]; >SetPrecision[a, Infinity]; SetPrecision[b, Infinity]; > >In[4]:= 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[5]:= SetAccuracy[f, Infinity]; SetPrecision[f, Infinity]; > >In[6]:= f > >Out[6]= -1.1805916207174113*^21 > >In[7]:= a = 77617; b = 33096; > >In[8]:= g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + >(55/10)*b^8 + a/(2*b) > >In[9]:= g > >Out[9]= -(54767/66192) > >In[10]:= N[%] > >Out[10]= -0.8273960599468214 > >Thanks, > >PK >