MathGroup Archive 2001

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

Search the Archive

Re: FractionalPart

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31255] Re: [mg31232] FractionalPart
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Tue, 23 Oct 2001 04:53:34 -0400 (EDT)
  • References: <200110200827.EAA12211@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

The situation you describe has to do with the way Mathematica handles
numbers. Integers are exact, while reals are approximate. When you use
Log[a], where a is a list of integers, the whole expression becomes real,
and a very small error is introduced, in apparent contradiction to the
obvious. In your example below,

In[1]:=
FractionalPart[x[[5]]]
Out[1]=
1.

because

In[2]:=
IntegerPart[x[[5]]]
Out[2]=
4

The Help browser says "For exact numeric quantities, FractionalPart
internally uses numerical approximations to establish its result. This
process can be affected by the setting of the global variable
$MaxExtraPrecision. "

Tomas Garza
Mexico City
----- Original Message -----
From: "Juan" <erfa11 at hotmail.com>
To: mathgroup at smc.vnet.net
Subject: [mg31255] [mg31232] FractionalPart


> Hello.
> I am new in Mathematica(also in english), and I have this question:
> I would like to know the behavior of the function FractionalPart.
> See here:
>
> In[1]:= a=Range[9]^2
> Out[1]= {1,4,9,16,25,36,49,64,81}
>
> In[2]:= x=Exp[.5 Log[a]]
> Out[2]= {1,2.,3.,4.,5.,6.,7.,8.,9.}
>
> In[3]:= FractionalPart[x]
> Out[3]= {0,0.,4.444089x10^-16,0.,0.,1.,0.,0.,1.,1.77639x10^-15}
>
> But it shoud be 0., all of them,no?
>
> Thanks. Juan
>
>
> _________________________________________________________________
> Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp
>
>



  • Prev by Date: RE: FractionalPart
  • Next by Date: Re: Mathematica 4.1 under Windows XP
  • Previous by thread: FractionalPart
  • Next by thread: Re:FractionalPart