Re: Confused about precision vs accuracy
- To: mathgroup at smc.vnet.net
- Subject: [mg90398] Re: [mg90359] Confused about precision vs accuracy
- From: DrMajorBob <drmajorbob at att.net>
- Date: Tue, 8 Jul 2008 02:27:22 -0400 (EDT)
- References: <20643916.1215488336956.JavaMail.root@m08>
- Reply-to: drmajorbob at longhorns.com
(A) In science and engineering, "precision" describes a thermometer's
ability to get the same answer to several digits in many trials under the
same conditions -- even if that answer is wrong. "Accuracy" describes the
thermometer's ability to get (approximately) the RIGHT answer, even if the
error variance is fairly large. If you know a device is PRECISE, it can be
calibrated to determine its bias; subtract that bias, and you have a
measurement that is also ACCURATE.
A device whose measurement is unbiased but highly variable could be called
accurate, but not precise. The cure for this can be to average many
independent measurements.
In Mathematica, Accuracy[x] is the "effective number of digits to the
right of the decimal point in the number x". As Help will tell you,
"With uncertainty dx, Accuracy[x] is -Log[10,dx]."
For Precision, Help tells us
"With absolute uncertainty dx, Precision[x] is -Log[10,dx/x]."
So Accuracy is the number of FRACTIONAL digits we can trust, while
Preecision is the TOTAL number of digits we can trust. (In a sense. Your
simple summation of it in part A was pretty much correct.)
We're also told that
"For any approximate number x, Precision[x] is equal to
RealExponent[x]+Accuracy[x]."
and that Accuracy[x]==Precision[x]==Infinity when x is an exact number.
For instance,
Accuracy@Pi
\[Infinity]
(B) The different results with Tanh make no sense, and anybody who says
otherwise is full of it. Fortunately, it makes no earthly difference. Look
at the following, for instance:
N[Tanh[100000] - 1]
% // Precision
%% // Accuracy
%%% // RealDigits
0.
MachinePrecision
307.653
{{0}, -307}
N[Tanh[100000``1] - 1]
% // Precision
%% // Accuracy
%%% // RealDigits
-3.*10^-86859
0.69897
86859.3
{{3}, -86858}
The second result has less than ONE digit of precision, yet it has 86859
digits of accuracy! What does that mean???
Well, let's check the equation mentioned earlier:
x = N[Tanh[100000``1] - 1];
Precision[x]
RealExponent[x] + Accuracy[x]
% == %%
0.69897
0.69897
False
The apparently equal answers are NOT equal to machine precision, so the
boolean result was False.
Precision[x] // RealDigits
RealExponent[x] + Accuracy[x] // RealDigits
{{6, 9, 8, 9, 7, 0, 0, 0, 4, 3, 3, 9, 1, 8, 6, 5}, 0}
{{6, 9, 8, 9, 7, 0, 0, 0, 4, 3, 4, 8, 6, 6, 6, 4}, 0}
Trying the same thing for the first Tanh result:
x = N[Tanh[100000] - 1];
Precision[x]
MachinePrecision
$MachinePrecision
% // RealDigits
15.9546
{{1, 5, 9, 5, 4, 5, 8, 9, 7, 7, 0, 1, 9, 1, 0, 0}, 2}
As you can see, the equation from Help fails miserably in this case.
So... what can I say? IMHO, Precision and Accuracy are virtually
undocumented. If you're careful what you do with them, they can solve very
difficult problems for you. If you're NOT extremely careful, they'll give
you nonsense.
(C) This one is easy.
N[Pi, 100]
3.14159265358979323846264338327950288419716939937510582097494459230781\
6406286208998628034825342117068
(D) No, 10-ish makes far more sense.
Accuracy[1`10 + 1`100]
10.
Precision[1`10 + 1`100]
10.301
1`10 + 1`100 // RealDigits
{{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 1}
x = 1`10 + 1`100;
Precision@x
RealExponent[x] + Accuracy[x]
10.301
10.301
RealExponent[x]
0.30103
You're adding a number for whom you trust only 10 digits to another number
for which you trust 100 digits. Clearly, the sum has 10 (or less)
trustworthy digits. The large (11th digit) uncertainty overwhelms the
small (101st digit) uncertainty.
Bobby
On Mon, 07 Jul 2008 04:06:51 -0500, Aaron Fude <aaronfude at gmail.com> 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?)
>
> B. Secondly, could someone talk through the logic of why.
>
> N[Tanh[100000] - 1]
>
> equals 0, while
>
> 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
>
> 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.
>
> Many thanks in advnce!
>
> Aaron
>
>
--
DrMajorBob at longhorns.com