[Date Index]
[Thread Index]
[Author Index]
Re: Re: Accuracy and Precision
*To*: mathgroup at smc.vnet.net
*Subject*: [mg37022] Re: [mg36983] Re: Accuracy and Precision
*From*: Daniel Lichtblau <danl at wolfram.com>
*Date*: Sun, 6 Oct 2002 05:33:39 -0400 (EDT)
*References*: <20021005010210.39660.qmail@web13007.mail.yahoo.com>
*Sender*: owner-wri-mathgroup at wolfram.com
Peter Kosta wrote:
>
> --- Daniel Lichtblau <danl at wolfram.com> wrote:
> > Peter Kosta wrote:
> > >
> > > The more I play with the example the more
> > depressing it gets. Start
> > > with floating point numbers but explicitly
> > arbitrary-precision ones.
> > >
> > > In[1]:=
> > > a=77617.00000000000000000000000000000;
> > > b=33095.00000000000000000000000000000;
> > >
> > > In[3]:=
> > > \!\(333.7500000000000000000000000000000\ b\^6 +
> > a\^2\ \((11\ a\^2\
> > > b\^2 - \
> > > b\^6 - 121\ b\^4 - 2)\) +
> > 5.500000000000000000000000000000\ b\^8 +
> > > a\/\(2\
> > > b\)\)
> > >
> > > Out[3]=
> > >
> >
> \!\(\(-4.78339168666055402578083604864320577443814`26.6715*^32\)\)
> > >
> > > In[4]:=
> > > Accuracy[%]
> > >
> > > Out[4]=
> > > -6
> > >
> > > Due to the manual section 3.1.6:
> > >
> > > "When you do calculations with arbitrary-precision
> > numbers, as
> > > discussed in the previous section, Mathematica
> > always keeps track of
> > > the precision of your results, and gives only
> > those digits which are
> > > known to be correct, given the precision of your
> > input. When you do
> > > calculations with machine-precision numbers,
> > however, Mathematica
> > > always gives you a machineprecision result,
> > whether or not all the
> > > digits in the result can, in fact, be determined
> > to be correct on the
> > > basis of your input. "
> > >
> > > Because I started with arbitrary-precision numbers
> > Mathematica should display
> > > only those digits that are correct, that is none.
> >
> > No, 26 digits are correct
>
> Here is the number:
> -0.8273960599468213681
>
> Here is the same number computed by Mathematica with 26
> "correct" digits:
> -4.78339168666055402578083604864320577443814×10^32
>
> It looks like I have been using some wrong definition
> of "correct.":-)
>
> You just proved that Precision is useless as a measure
> how good your numerical result is.
>
> [...]
I rather hope I proved nothing of the sort. Also I'm afraid Mathematica
kept better track of the numbers than you did. As for definitions of
"correct", rather than remark on yours I'll just expose what I meant
with specific numerical examples below.
You did not actually say why you thought -0.8273960599468213681 would be
the appropriate result. So I'll go through the computation in exact
arithmetic (I have to admit I am puzzled as to why you did not do this).
First I'll rewrite your expression using more variables.
a = 77617.00000000000000000000000000000;
b = 33095.00000000000000000000000000000;
c = 333.7500000000000000000000000000000;
d = 5.500000000000000000000000000000;
In[6]:= InputForm[val = c*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) +
d*b^8 + a/(2*b)]
Out[6]//InputForm=
-4.78339168666055402578083604864320577443814`26.6715*^32
This is what I got. Now we'll redo in exact arithmetic.
rata = Rationalize[a];
ratb = Rationalize[b];
ratc = Rationalize[c];
ratd = Rationalize[d];
In[12]:= InputForm[exactval = ratc*ratb^6 + rata^2*
(11*rata^2*ratb^2 - ratb^6 -121*ratb^4 - 2) + ratd*ratb^8 +
rata/(2*ratb)]
Out[12]//InputForm= -63322539148012414193286707611938758031/132380
In[13]:= InputForm[N[exactval]]
Out[13]//InputForm= -4.783391686660554*^32
I think it is reasonable to claim that these agree.
I dug through some early posts on the topic and came across a value for
b at one time that was one larger (this supports my long-held suspicion
that numbers slowly decay in discrete increments...).
In[14]:= b2 = 33096.00000000000000000000000000000;
In[15]:= InputForm[val2 = c*b2^6 + a^2*(11*a^2*b2^2 - b2^6 - 121*b2^4 -
2) +
d*b2^8 + a/(2*b2)]
Out[15]//InputForm= -0.827469148`-0.3833
What this reveals is a number that Mathematica claims has NO trustworty
digits. The InputForm also reveals the untrustworthy digits, and, sure
enough, it comes close to what you have called the "correct" value, and
specifically they agree to four places. My opinion is that the
Mathematica significance arithmetic is doing, shall I say, precisely as
it ought.
Daniel Lichtblau
Wolfram Research
Prev by Date:
**Re: Re: Accuracy and Precision**
Next by Date:
**Re: RE: RE: Accuracy and Precision**
Previous by thread:
**Re: Re: Accuracy and Precision**
Next by thread:
**Re: Accuracy and Precision**
| |