Re: approximation
- To: mathgroup at smc.vnet.net
- Subject: [mg79469] Re: approximation
- From: chuck009 <dmilioto at comcast.com>
- Date: Fri, 27 Jul 2007 05:56:57 -0400 (EDT)
Just evaluate a to a particular level of precision with the N directive: In[62]:= a=1.56068376362920545943; Print["The value is: ",N[a,2]] Print["The value is: ",N[a,17]] >From In[62]:= The value is: 1.6 >From In[62]:= The value is: 1.5606837636292055 Note the precision is as you entered it: In[65]:= Precision[a] Out[65]= 20.1933 Now if you do anything with that number using a number less than that precision, the overall precision drops down to the lowest precision: b=2.55 Precision[b] Out[67]= MachinePrecision which is about 15 digits. You can see them with this command: RealDigits[b] Out[69]= {{2,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0},1} Now, when I multiply them both, the overall precision drops down to 15: net=a b; Precision[net] Out[71]= MachinePrecision Unless I explicitly set the precsion of 2.5 to say 21: In[82]:= b=SetPrecision[2.5,21] net=a b; Precision[net] Out[82]= 2.50000000000000000000 Out[84]= 20.1303