Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Accuracy and Precision

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36870] Re: Accuracy and Precision
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Mon, 30 Sep 2002 03:03:15 -0400 (EDT)
  • References: <an68le$tb$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Peter,
I hope that the following example will help - it is a matter or when things
evaluate.
The a in SetAccuracy[a, Infinity], below, evaluates before SetAccuracy acts,
so we get
SetAccuracy[2.3, Infinity]. The value of a is not changed.


    a = 2.3;
    aa = SetAccuracy[a, Infinity]

        2589569785738035/1125899906842624

But,

    a

        2.3

Whereas

    aa

        2589569785738035/1125899906842624

--
Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565


"Peter Kosta" <pkosta2002 at yahoo.com> wrote in message
news:an68le$tb$1 at smc.vnet.net...
> 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: Accuracy and Precision
  • Previous by thread: Re: Accuracy and Precision
  • Next by thread: Re: Accuracy and Precision