MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Accuracy and Precision

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36861] Re: [mg36853] Accuracy and Precision
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Mon, 30 Sep 2002 03:02:59 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Well, first of of all, your using SetAccuracy and SetPrecision does 
nothing at all here, since they do not change the value of a or b. You 
should use a = SetAccuracy[a, Infinity] etc. But even then you won't 
get the same answer as  when you use exact numbers because of the way 
you evaluate f. Here is the order of evaluation that will give you the 
same answer, and should explain what is going on:

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), Infinity];

a = 77617.;


  b = 33096.;

a = SetAccuracy[a, Infinity]; b = SetAccuracy[b, Infinity];

f

   54767
-(-----)
   66192

Andrzej Kozlowski
Toyama International University
JAPAN



On Sunday, September 29, 2002, at 03:55 PM, Peter Kosta wrote:

> Could someone explain what is going on here, please?
>
> In[1]:=
> a = 77617.; b = 33096.;
>
> In[2]:=
> SetAccuracy[a, Infinity]; SetAccuracy[b, Infinity];
> SetPrecision[a, Infinity]; SetPrecision[b, Infinity];
>
> In[4]:=
> f := 333.75*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 5.5*b^8 + 
> a/(2*b)
>
> In[5]:=
> SetAccuracy[f, Infinity]; SetPrecision[f, Infinity];
>
> In[6]:=
> f
>
> Out[6]=
> -1.1805916207174113*^21
>
> In[7]:=
> a = 77617; b = 33096;
>
> In[8]:=
> g := (33375/100)*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 
> (55/10)*b^8 + a/(2*b)
>
> In[9]:=
> g
>
> Out[9]=
> -(54767/66192)
>
> In[10]:=
> N[%]
>
> Out[10]=
> -0.8273960599468214
>
> Thanks,
>
> PK
>
>
>



  • Prev by Date: Re: Accuracy and Precision
  • Next by Date: Re: A Bessel integral
  • Previous by thread: Re: Accuracy and Precision
  • Next by thread: RE: Accuracy and Precision