Re: Precision in Mathematica 6
- To: mathgroup at smc.vnet.net
- Subject: [mg92286] Re: Precision in Mathematica 6
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 26 Sep 2008 06:25:38 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
CaveSnow wrote: *snip* > this is the things I written in my notebook > > FindRoot[\!\( > \*SubsuperscriptBox[\(\[Integral]\), \(0\), \(t\)] > FractionBox[\(Sin[x]\), \(x\)] \[DifferentialD]x\) == 1, {t, 1}] > > N[t, 10] /. % *snip* > In other words I used FindRoot to find the t that makes the definite > integral from 0 to t of sinx/x be 1. > As a result I got a certain rule, that had a small amount of digits > (only 6 of them). Then I issued the second command ti get more digits > from the result. But the result, even if I asked 10 digits remained > the same 1.06484. *snip* Here, you are working with machine/hardware-precision numbers (aka double-precision floating-point numbers), numbers that usually have up to 16 decimal digits. To control the number of decimal digits that are displayed, you can use either *NumberForm* (see below) or goto menu "Preferences" -> "Appearance" -> "Numbers" -> "Formating" -> "Displayed precision", there change the field called "Number of digits displayed in output" from 6 (the "factory" default) to whatever you wish. Note that the above setting does not affect the precision of computations and you will not be able to display more that 16 decimal digits for machine-precision numbers. In[209]:= sol = FindRoot[Integrate[Sin[x]/x, {x, 0, t}] == 1, {t, 1}] Precision[t /. sol] $MachinePrecision Do[Print[NumberForm[t, n] /. sol], {n, 20}] Out[209]= {t -> 1.06484} Out[210]= MachinePrecision Out[211]= 15.9546 During evaluation of In[209]:= 1. During evaluation of In[209]:= 1.1 During evaluation of In[209]:= 1.06 During evaluation of In[209]:= 1.065 During evaluation of In[209]:= 1.0648 During evaluation of In[209]:= 1.06484 During evaluation of In[209]:= 1.06484 During evaluation of In[209]:= 1.0648397 During evaluation of In[209]:= 1.06483973 During evaluation of In[209]:= 1.064839726 During evaluation of In[209]:= 1.0648397255 During evaluation of In[209]:= 1.06483972554 During evaluation of In[209]:= 1.064839725537 During evaluation of In[209]:= 1.0648397255366 During evaluation of In[209]:= 1.06483972553656 During evaluation of In[209]:= 1.064839725536558 During evaluation of In[209]:= 1.064839725536558 During evaluation of In[209]:= 1.064839725536558 During evaluation of In[209]:= 1.064839725536558 During evaluation of In[209]:= 1.064839725536558 Also, the tutorial "Machine-Precision Numbers" might be worth reading: http://reference.wolfram.com/mathematica/tutorial/MachinePrecisionNumbers.html Regards, -- Jean-Marc