Re: N
- To: mathgroup at yoda.ncsa.uiuc.edu
- Subject: Re: N
- From: uunet!cello.hpl.hp.com!jacobson
- Date: Thu, 22 Mar 90 13:37:12 PST
The real situation is even worse than Fateman claims. On input Mathematica uses trailing decimals to determine accuracy and precision, but only if the resulting precision is higher than machine precision. Furthermore, one can't use N to reliably force the precision down: N[...,3] seems to act as though it were N[...,Max[3,<<machine precision>>]]. In[39]:= 1. Out[39]= 1. In[40]:= Precision[%] Out[40]= 16 In[41]:= N[%39,3] Out[41]= 1. In[42]:= Precision[%] Out[42]= 16 At the Mathematica conference, one of the WRI folks, (Jerry Keiper or Igor Rivin, I believe) claimed than N[] only lowers precision, never raises it. However, here is a counter example. In[43]:= 1.000000000000000000000000001 - 1.0000000000000000000000000001 -28 Out[43]= 9. 10 In[44]:= Precision[%] Out[44]= 1 In[45]:= N[%43] -28 Out[45]= 8.99999 10 In[46]:= Precision[%] Out[46]= 16 and its not just that I used N with no second argument In[49]:= N[%43,16] -28 Out[49]= 8.99999388963799 10 In[50]:= Precision[%] Out[50]= 16 Finally, numbers seem to carry their precision around with them, but I can't seem to access it. I'd like to be able to do this in cases where I want to do my own error analysis. In[58]:= p3 = N[Pi,3] Out[58]= 3.14 In[59]:= p5=N[Pi,5] Out[59]= 3.1416 In[60]:= Precision[p3] Out[60]= 16 In[61]:= Precision[p5] Out[61]= 16 In[62]:= Accuracy[p3] Out[62]= 15 In[63]:= Accuracy[p5] Out[63]= 15 In[64]:= p3===p5 Out[64]= True Somehow p3 will print to 3 places and p5 will print to 5 places, but I don't know how the formatter knows that information. -- David Jacobson