[Date Index]
[Thread Index]
[Author Index]
Re: Re: Accuracy and Precision
*To*: mathgroup at smc.vnet.net
*Subject*: [mg37076] Re: [mg37058] Re: Accuracy and Precision
*From*: Peter Kosta <pkosta2002 at yahoo.com>
*Date*: Tue, 8 Oct 2002 07:17:39 -0400 (EDT)
*Sender*: owner-wri-mathgroup at wolfram.com
--- Daniel Lichtblau <danl at wolfram.com> wrote:
> Peter Kosta wrote:
> >
> > Andrzej Kozlowski <andrzej at tuins.ac.jp> wrote in
> message news:<anp065$qtb$1 at smc.vnet.net>...
> > > On Friday, October 4, 2002, at 06:01 PM, DrBob
> wrote:
> > >
> > >[...]
> > >
> > > I would say this is correct and show that
> SetPrecision is very useful
> > > indeed. It tells you (what of course you ought
> to already know in this
> > > case anyway) that machine precision will not
> give you a realiable
> > > answer in this case. If you know your numbers
> with a great deal of
> > > accuracy you can get an accurate answer:
> > >
> > > In[24]:=
> > > f = SetAccuracy[333.75*b^6 + a^2*(11*a^2*b^2 -
> b^6 -
> > > 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100];
> > > a=SetPrecision[77617.,100]; b =
> SetPrecision[33096.,100];
> > >
> > >
> > > In[26]:=
> > > {f, Precision[f]}
> > >
> > > Out[26]=
> > >
>
{-0.82739605994682136814116509547981629199903311578438481991\
> > > 781484167246798617832`61.2597, 61}
> > >
> >
> > Congratulations! You just requested accuracy of
> 100 for f and got 61 (
> > to convince yourself add Accuracy[f] to In[26]).
> If In[24] one
> > replaces SetAccuracy by SetPrecision the result is
> similar.
> >
> > PK
> > [...]
>
> One has (initially) an accuracy of 100 for an
> expression that contains
> variables.
>
> In[25]:= Clear[a,b,f]
>
> In[26]:= f = SetAccuracy[333.75*b^6 +
> a^2*(11*a^2*b^2 - b^6 -
> 121*b^4 - 2) + 5.5*b^8 + a/(2*b), 100];
>
> In[27]:= Accuracy[f]
> Out[27]= 100.
>
> Now we assign values to some indeterminants in f.
>
> In[28]:= a = SetPrecision[77617.,100]; b =
> SetPrecision[33096.,100];
>
> In[29]:= {f, Precision[f], Accuracy[f]}
> Out[29]=
>
{-0.8273960599468213681411650954798162919990331157843848199178148,
>
> 61.2599, 61.3422}
>
> The precision and accuracy has dropped. This is all
> according to
> standard numerical analysis regarding cancellation
> error. You'll find it
> in any textbook on the topic.
>
Assume that I want accuracy and precision of 100 for
f. You advice me to make experiments to find out, what
should be the initial precision and accuracy of a and
b to reach the requested accuracy and precision for f.
Notice, that you cannot just repeat I[26], we saw
already what happens. I have to re-type I[24], I[25],
I[26], I[27], I[28], and I[29] as many times as needed
to get f with accuracy and precision 100.
Dan, you simply advocate to do MANUAL WORK that should
be done by machine.
Let's suppose that in the above example I just want 60
digits not 61. Precisely, I want 60 digits and nothing
or zeros afterwards. Let's see if I could use
SetAccuracy.
In[30]:=
SetAccuracy[%, 60]
Out[30]=
-0.82739605994682136814116509547981629199903311578438481991781
In[31]:=
% // FullForm
Out[30]//FullForm=
-0.827396059946821368141165095479816291999033115784384819917814841672467988`\
59.9177
Oops, it did not work (as expected). Let's highlight
with mouse the expression in Out[30] and copy to a new
cell. Oops, we got
-0.827396059946821368141165095479816291999033115784384819917814841672467988`\
59.9177
again. Let's change Out[30] to a text cell and then
copy.
In[31]:=
-0.82739605994682136814116509547981629199903311578438481991781
Out[31]=
-0.82739605994682136814116509547981629199903311578438481991781
Success? Not so fast.
In[32]:=
% // FullForm
Out[32]//FullForm=
-0.827396059946821368141165095479816291999033115784384819917809999999999998635\
08`59.2041
Dan, is there any simple way to get what I want?
As I repeated already number of times, at this stage
of the development of computer technology, software
should do it for me (!). We both know that this is
doable. Some of the textbooks that you just advised me
to read describe it. As a developer of Mathematica,
tell us why do you consider this to be a bad idea?
Peter Kosta
> As for what happens when you artificially raise
> precision (or accuracy)
> of machine numbers far beyond that guaranteed by
> their internal
> representation, that falls into to category of
> garbage in, garbage out.
> It is, howoever, valid to use SetPrecision to raise
> precision in
> (typically iterative) algorithms where significance
> arithmetic might be
> unduly pessimistic due to incorrect assumptions
> about uncorollatedness
> of numerical error. Examples of such usage have
> appeared in this news
> group.
>
>
> Daniel Lichtblau
> Wolfram Research
__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com
Prev by Date:
**Re: Re: Accuracy and Precision**
Next by Date:
**Re: trouble with pattern matching & manipulating**
Previous by thread:
**Re: Re: Accuracy and Precision**
Next by thread:
**Re: Re: Re: Accuracy and Precision**
| |