MathGroup Archive 2002

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

Search the Archive

RE: Re: Accuracy and Precision

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36924] RE: [mg36903] Re: Accuracy and Precision
  • From: "DrBob" <drbob at bigfoot.com>
  • Date: Wed, 2 Oct 2002 03:32:06 -0400 (EDT)
  • Reply-to: <drbob at bigfoot.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Consider the total differential of f, with respect to the inexact
numbers:

Clear[a, b, x, y, f]
f[a_, b_, x_, y_] := x*b^6 + a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2) + 
   y*b^8 + a/(2*b)
Simplify[Dt[f[a, b, x, y]] /. {Dt[a] -> da, Dt[b] -> db, Dt[x] -> dx, 
     Dt[y] -> dy} /. {a -> 77617, b -> 33096, x -> 333.75, y -> 5.5}]

-2.0400456966858126*^32*da + 
  4.784331242850472*^32*db + 
  1.3141745343712155*^27*dx + 
  1.4394747892125385*^36*dy

f is sensitive to inaccuracy in the various numbers to widely varying
degrees.  Since the "correct" answer is small, we need a LOT of
precision in the inputs to get there.  If any of the inputs are merely
machine precision numbers, we have NO precision in the result.

The second and third terms are nearly the same magnitude with different
signs.  Even worse, the first term almost perfectly fills the gap:

a = 77617; b = 33096;
(33375/100)*b^6
438605750846393161930703831040

a^2*(11*a^2*b^2 - b^6 - 121*b^4 - 2)
-7917111779274712207494296632228773890

(55/10)*b^8
7917111340668961361101134701524942848

% + %% + %%%
-2

Bobby Treat

-----Original Message-----
From: Peter Kosta [mailto:pkosta2002 at yahoo.com] 
To: mathgroup at smc.vnet.net
Subject: [mg36924] [mg36903] Re: Accuracy and Precision

Thanks to all who adviced me on the correct use of 
SetAccuracy. However, I still don't understand why 
the order in which we set the accuracies for f, a, 
and b matters.

In[1]:=
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 = SetAccuracy[77617., Infinity]; 
b = SetAccuracy[33096., Infinity]; 

In[4]:=
f

Out[4]=
-(54767/66192)

In[5]:=
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] 

Out[5]=
1180591620717411303424

Similarily:

In[1]:=
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), 50]; 
a = SetAccuracy[77617., 100]; 
b = SetAccuracy[33096., 100]; 

In[4]:=
f

Out[4]=
-0.8273960599468212641107299556`11.4133

In[5]:=
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]; 

Out[5]=
1.180591620717411303424`121.0721*^21

-PK





  • Prev by Date: Re: Re: Using Text Cells
  • Next by Date: Re: Using Text Cells
  • Previous by thread: Re: Accuracy and Precision
  • Next by thread: Re: Accuracy and Precision