MathGroup Archive 2011

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

Search the Archive

Re: Chop in Mathematica 8.0.1

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117565] Re: Chop in Mathematica 8.0.1
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Wed, 23 Mar 2011 02:52:27 -0500 (EST)

On 22 Mar 2011, at 14:00, Andrzej Kozlowski wrote:

>
> On 22 Mar 2011, at 11:09, telefunkenvf14 wrote:
>
>> On Mar 21, 6:18 am, Andrzej Kozlowski <a... at mimuw.edu.pl> wrote:
>>> Chop does not seem to work properly in Mathematica 8.0.1:
>>>
>>> f[a_] := 2 I Pi Sin[a]/a
>>>
>>> In[2]:= f[1.]
>>>
>>> Out[2]= 0. + 5.287118128162912*I
>>>
>>> In[3]:= Chop[%]
>>>
>>> Out[3]= 0. + 5.287118128162912*I
>>>
>>> This is with
>>>
>>> In[4]:= $Version
>>>
>>> Out[4]= 8.0 for Mac OS X x86 (64-bit) (February 23, 2011)
>>>
>>> Mathematica 7.01 returns 5.287118128162912*I as expected.
>>>
>>> Can anyone confirm it? At the moment I can't see any simple work around..  .
>>>
>>> Andrzej Kozlowski
>>
>> I get the same behavior on Windows 7 for 7.0.1 and 8.0.1.
>>
>> Did notice the documentation on Chop in 8.0.1 includes a new
>> subsection on 'possible issues'... Seems like there should be some
>> type of 'show changes' indicator in the documentation.
>>
>> -------
>>> From the new subsection on possible issues:
>>
>> Machine complex numbers have machine reals for both real and imaginary
>> parts:
>>
>> In[1]:= 2. I
>> Out[1]= 0. + 2. I
>>
>> Consequently, Chop does not make the real part of machine complex
>> numbers an exact zero:
>>
>> In[2]:= Chop[10.^-12 + 2. I]
>> Out[2]= 0. + 2. I
>>
>> Small imaginary parts from machine complex numbers are eliminated to
>> make a machine real:
>>
>> In[3]:= Chop[2. + 10.^-12 I]
>> Out[3]= 2.
>>
>> -----
>>
>> It seems to me that 8.0.1 is the more desired behavior, no? (Maintains
>> precision; one can use Re or Im to select parts that remain, right?)
>>
>> -RG
>>
>
> I agree, except for one little thing. I don't see any advantage in the approximate zero real part of a machine complex number being *displayed*. It is certainly possible to change that (MakeBoxes can be used for this purpose) and it just isn't consistent with the traditional practice in mathematics. And, after all, isn't this what TraditionalForm is supposed to be for?
>
> Andrzej

I have to send a correction to the above. It is indeed possible to "fix" the above problem using MakeBoxes and get back the display of machine complex numbers in previous versions, but doing so can have disastrous consequences for Dynamic programs that make use of machine precision complex numbers (as I have just discovered). So it's not a good idea for users to attempt to "fix" such things themselves.
As for me, I can live with this, although it does look odd, especially to mathematicians not used to the quirky ways of mathematical software.

Andrzej Kozlowski


  • Prev by Date: Re: Question about a CountorPlot3D
  • Next by Date: Re: Using Nearest on a group of points
  • Previous by thread: Re: Chop in Mathematica 8.0.1
  • Next by thread: Re: Chop in Mathematica 8.0.1