On 7/7/08 at 5:06 AM, aaronfude at gmail.com (Aaron Fude) wrote:
>I can't figure out how the precision and accuracy concepts work in
>Mathematica.
>A. First of all, what's the difference? (Is it only total number of
>digits vs digits after decimal?)
Have you looked at the documentation for Accuracy and/or
Precision? In particular, did you see the note under More
Information that states for any approximate number x
Precision[x] == Accuracy[x] + RealExponent[x]
also there is
tutorial/NumericalPrecision
>B. Secondly, could someone talk through the logic of why.
>N[Tanh[100000] - 1]
>equals 0, while
It doesn't. N[Tanh[100000]-1] will return "0." not "0". That is
a machine precision number is returned not the exact value 0
Note, I've use quotes here to make a clear distinction between a
decimal point and a period terminating a sentence. This is not
at all to imply a string gets returned by N[Tanh[100000]-1].
>N[Tanh[100000``1] - 1]
>equals -3.*10^-86859;
>C. On a related issue, how do I see Pi to a certain number of
>digits. I figured out this hack:
>1``100 Pi
The most straight forward way to see the first n digits of any
exact number is to use N. For 100 digits of Pi this is done by
N[Pi,100]
>D. And finally (for now) where can I read up on rules for "precision
>arithmetic". For example, my guess that
>Precision[1`10 + 1`100]
>ought to be 100-ish rather than 10-ish.
No. You should never expect the result any sequence of
operations done on mixed precision numbers to be near the
precision of the number with the highest precision. In general,
the result precision will be near the precision of the lowest
precision number. And some sequences will end with a result with
considerably less precision than the precision of the lowest
precision number. In general, the more operations done on a set
of numbers, the lower the precision of the end result. For example,
In[13]:= Table[Precision[(1`10 + 1`100)^n], {n, 5}]
Out[13]= {10.301,10.,9.82391,9.69897,9.60206}