MathGroup Archive 2002

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

Search the Archive

RE: Q: Strange Mathematica 3.0.1.1 Behaviour

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34483] RE: [mg34459] Q: Strange Mathematica 3.0.1.1 Behaviour
  • From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
  • Date: Thu, 23 May 2002 03:32:27 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

> -----Original Message-----
> From: terryisnow at yahoo.com [mailto:terryisnow at yahoo.com]
To: mathgroup at smc.vnet.net
> Sent: Wednesday, May 22, 2002 8:46 AM
> Subject: [mg34483] [mg34459] Q: Strange Mathematica 3.0.1.1 Behaviour
> 
> 
> Hi,
> 
> In the course of the simulation's that I run, I sometimes get numbers
> that look
> like 0 but don't behave like 0 in certain contexts. Here's a typical
> example,...
> 
> In[3]:= x
>                 4
> Out[3]= 0. x 10
> 
> In[4]:= currentMinima
>                    4
> Out[4]= 2.075 x 10
> 
> In[5]:= 5 > x
> Out[5]= True
> 
> In[6]:= x > 5
> Out[6]= False
> 
> In[7]:= 5 > currentMinima
> Out[7]= False
> 
> In[8]:= currentMinima > 5
> Out[8]= True
> 
> In[9]:= currentMinima > x
> Out[9]= False
> 
> In[10]:= x > currentMinima
> Out[10]= False
> 
> Can anyone explain to me why the second to last result is not True?
> I have the DumpSave file with the binary values of 'x' and
> currentMinima if anyone wants to take a closer look.
> Any help would be appreciated!
> 
> Regards,
> terry
> 

Terry,

yes strange. Mathematica handles approximate real numbers with any number of
digits. Any such number not only has a value, but also a certain
precision/accuracy. When doing calculations for the results accompanying
precisions/accuracies are estimated in a very conservative fashion. So after
many operations the accuray may become so small, that the incertainty for
the value may be larger than the value itself. Then you'll have such a
strange zero. 

We can easily demonstrate this:

In[1]:= x = .0``-4.5*^4

               4
Out[1]= 0. x 10

(* this is not copied but shows the visual appearance in StandardForm *)

This is a zero but with a great uncertainty of +/-10^4.5
You will see the precision resp. accuracy of a number when printing in
InputForm:

In[2]:= x // InputForm
Out[2]//InputForm= 0``-4.5

Now we have:

In[3]:= 2.075*^4 > x
Out[3]= False

In[4]:= 2.075*^4 < x
Out[4]= False

The "real" value of x may both be larger than 20750. (at In[3]) or smaller
than 20750. (at In[4]). So Mathematica avoids the affirmative. 

In[5]:= 5 > x
Out[5]= True

This case is somewhat different, since 5 is an integer (which has infinite
precision), so the   inaccuracy of x is not respected (there is no sense in
it, at least this was Wolfram's choice). However take a real 5. :

In[8]:= 5. > x  (* 5 here a machine-precision number with precision of
$MachinePrecision *)
Out[8]= False

In[9]:= $MachinePrecision
Out[9]= 16

In[10]:= 5.`20000 > x  (* precision of this 5 is 20000 decimal places *)
Out[10]= False


Read section 3.1

--
Hartmut



  • Prev by Date: RE: Plotting mulitple lists on one log plot
  • Next by Date: RE: Speeding up hierarchical sorting
  • Previous by thread: Q: Strange Mathematica 3.0.1.1 Behaviour
  • Next by thread: Plotting mulitple lists on one log plot