       Re: Confused about precision vs accuracy

• To: mathgroup at smc.vnet.net
• Subject: [mg90375] Re: Confused about precision vs accuracy
• From: Bob F <deepyogurt at gmail.com>
• Date: Tue, 8 Jul 2008 02:23:02 -0400 (EDT)
• References: <g4smav\$29\$1@smc.vnet.net>

```Aaron Fude wrote:
> Hi,
>
> 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?)

See the discussion for "Numerical Precision" in Help -- basically
"Precision" is the total number of digits and "Accuracy" is the number
of digits to the right of the decimal.

>
> B. Secondly, could someone talk through the logic of why.
>
> N[Tanh - 1]
>
> equals 0, while
>
> N[Tanh[100000``1] - 1]
>
> equals -3.*10^-86859;
>

can't explain this one

> C. On a related issue, how do I see Pi to a certain number of digits.
> I figured out this hack:
>
> 1``100 Pi
>

Just use the N[expr,digits] function, e.g., if you wanted to see
several values of Pi you could:

Table[N[Pi,i],{i,5,50,10}] would give

{3.1416, 3.14159265358979, 3.141592653589793238462643, \
3.1415926535897932384626433832795029, \
3.14159265358979323846264338327950288419716940}

So you could use any value for "expr" in the N[expr, digits] function
call - not just for Pi or other constants.

Also note that the syntax for expressing precision should be
"digits`precision" (see "Precision" Help article) not
"digits``precision" according to the Help article on "Precision" -- in
fact I am puzzled why the `` syntax didn't give an error -- anyone
explain why it works both ways?? and why Aaron's expression above of
"N[Tanh[100000``1] - 1]" doesn't give an error??

> 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.
>

Think about it --  you can't make a less precise number more precise
by adding a more precise number to it. The precision of the result of
any expression will only be the least precise of all of the elements
that make up the expression.

The way the "NumericalPrecision" help article puts is that "One can
think of precision as providing a measure of the relative size of this
uncertainty. Accuracy gives a measure of the absolute size of the
uncertainty."