Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Chop in Mathematica 8.0.1

36 views
Skip to first unread message

Andrzej Kozlowski

unread,
Mar 21, 2011, 7:13:03 AM3/21/11
to
Hmm... perhaps this is not a bug but a deliberate new design?

Just evaluating

1.1 I

returns

0. +1.1

It seems a purely cosmetic issue but it does look a rather
"untraditional". Can anyone confirm that this is indeed an intentional
change?

Andrzej Kozlowski

On 20 Mar 2011, at 12:44, Andrzej Kozlowski 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


Andrzej Kozlowski

unread,
Mar 21, 2011, 7:18:36 AM3/21/11
to

Syd Geraghty

unread,
Mar 22, 2011, 6:07:03 AM3/22/11
to
Hi Andrzeg,

In[1]:= 1.1 I

Out[1]= 0. + 1.1 I


In[2]:= 1.1 I // TraditionalForm

Out[2]//TraditionalForm= 0. +1.1 i


Cheers .... Syd

Syd Geraghty B.Sc, M.Sc.

sydge...@mac.com

Mathematica 8.0 for Mac OS X x86 (64-bit) (February 23, 2011)
ReleaseID: 8.0.1.0 (2063982, 2063639)
MacOS X V 10.6.5 Snow Leopard
MacBook Pro 2.33 GHz Intel Core 2 Duo 2GB RAM

On Mar 21, 2011, at 7:12 AM, Andrzej Kozlowski wrote:

> Hmm... perhaps this is not a bug but a deliberate new design?
>
> Just evaluating
>
> 1.1 I
>
> returns
>
> 0. +1.1
>
> It seems a purely cosmetic issue but it does look a rather
> "untraditional". Can anyone confirm that this is indeed an intentional
> change?
>
> Andrzej Kozlowski
>
>
>
> On 20 Mar 2011, at 12:44, Andrzej Kozlowski wrote:
>

Matthias Bode

unread,
Mar 22, 2011, 6:07:14 AM3/22/11
to
Hola Andrzej:

In[1]:= f[a_] := 2*I*Pi*(Sin[a]/a)
f[1.]
Chop[%]
$Version

Out[2]= 0. + 5.287118128162912*I

Out[3]= 0. + 5.287118128162912*I

Out[4]= "8.0 for Microsoft Windows (32-bit) (February 24, 2011)"

In reality version 8.0.1.

Best regards,

MATTHIAS BODE
S 17.35775=B0, W 066.14577=B0
2'740 m
AMSL.

> Date: Mon, 21 Mar 2011 06:18:18 -0500
> From: ak...@mimuw.edu.pl
> Subject: Chop in Mathematica 8.0.1
> To: math...@smc.vnet.net

Szabolcs Horvát

unread,
Mar 22, 2011, 6:07:35 AM3/22/11
to

Hello Andrzej,

Is it possible that this is just a change in how complex numbers are
displayed? Consider

{0 + I, 1. I, 1 + 0. I}

(the 2nd and 3rd are machine precision)

It appears that the real part of non-exact numbers is always displayed,
even if it is (0.).


Oliver Ruebenkoenig

unread,
Mar 22, 2011, 6:08:07 AM3/22/11
to
On Mon, 21 Mar 2011, Andrzej Kozlowski wrote:

> Hmm... perhaps this is not a bug but a deliberate new design?
>
> Just evaluating
>
> 1.1 I
>
> returns
>
> 0. +1.1
>
> It seems a purely cosmetic issue but it does look a rather
> "untraditional". Can anyone confirm that this is indeed an intentional
> change?
>
> Andrzej Kozlowski
>

For example,

Developer`PackedArrayQ@Developer`ToPackedArray[{1. + I, 1.1 I}]

Oliver


>
>
> On 20 Mar 2011, at 12:44, Andrzej Kozlowski 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
>
>
>

David Bailey

unread,
Mar 22, 2011, 6:08:50 AM3/22/11
to
The same problem happens with 64-bit Windows amd 8.0.1 .

This seems to be deliberate - see the first item under "Possible Issues"
in the help for Chop.

David Bailey
http://www.dbaileyconsultancy.co.uk


telefunkenvf14

unread,
Mar 22, 2011, 6:10:27 AM3/22/11
to

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

Murray Eisenberg

unread,
Mar 22, 2011, 6:10:48 AM3/22/11
to
Same thing for same version (8.0.1) but under Windows XP -- except that,
evidently, you've increased the numerical display precision from its
normal default.

On 3/21/2011 7:18 AM, Andrzej Kozlowski 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
>

--
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305

Bob Hanlon

unread,
Mar 22, 2011, 6:11:52 AM3/22/11
to
I see the same but I'm running on the same OS.

$Version

"8.0 for Mac OS X x86 (64-bit) (February 23, 2011)"

f[a_] := 2 I Pi Sin[a]/a

f[1.] // Chop

0. + 5.287118128162912*I


Bob Hanlon

---- Andrzej Kozlowski <ak...@mimuw.edu.pl> wrote:

=============

Peter Pein

unread,
Mar 22, 2011, 6:13:24 AM3/22/11
to

No,

fortunately it returns 0. + 1.1*I ;-)


Virgil Stokes

unread,
Mar 22, 2011, 6:14:34 AM3/22/11
to
On 21-Mar-2011 12:18, Andrzej Kozlowski 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 can confirm this for vers. 8.0.1.0 and vers. 7.0.1.0.
On a windows Vista 32-bit platform the Chop leaves 0. for the Real part in vers.
8.0.1.0 but not for vers. 7.0.1.0 --- as shown in the Andrzej's code.

--V


Dana DeLouis

unread,
Mar 22, 2011, 6:17:21 AM3/22/11
to
> f[a_] := 2 I Pi Sin[a]/a

Hi. I don't have a solution to the question, but this may work better at 0.

g[a_]:=2 I Pi Sinc[a]

g[0.]
0.\[VeryThinSpace]+6.283 I

vs. Power::infy:

f[0.]
Power::infy: Infinite expression 1/0. encountered.

= = = = = = = = = =
HTH : >)
Dana DeLouis

Andrzej Kozlowski

unread,
Mar 23, 2011, 3:52:54 AM3/23/11
to

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...@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

Andrzej Kozlowski

unread,
Mar 23, 2011, 3:57:54 AM3/23/11
to

On 22 Mar 2011, at 11:09, telefunkenvf14 wrote:

> On Mar 21, 6:18 am, Andrzej Kozlowski <a...@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. . .

Heike Gramberg

unread,
Mar 23, 2011, 3:59:42 AM3/23/11
to
In the "Possible Issues" section in the documentation of Chop it says that
"Machine complex numbers have machine reals for both real and imaginary parts", and that "Consequently, Chop does not make the real part of machine complex numbers an exact zero", so I guess it's intentional.

Heike

On 21 Mar 2011, at 11:12, Andrzej Kozlowski wrote:

> Hmm... perhaps this is not a bug but a deliberate new design?
>
> Just evaluating
>
> 1.1 I
>
> returns
>
> 0. +1.1
>
> It seems a purely cosmetic issue but it does look a rather
> "untraditional". Can anyone confirm that this is indeed an intentional
> change?
>
> Andrzej Kozlowski
>
>
>

Murray Eisenberg

unread,
Mar 24, 2011, 7:31:53 AM3/24/11
to
Seems to me its a lot safer to have that 0. displayed as additional
indication of machine arithmetic being used and hence possible precision
problems.

On 3/23/2011 3:56 AM, Andrzej Kozlowski wrote:
> On 22 Mar 2011, at 11:09, telefunkenvf14 wrote:
>

>> On Mar 21, 6:18 am, Andrzej Kozlowski<a...@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
>

--

DrMajorBob

unread,
Mar 24, 2011, 7:37:12 AM3/24/11
to
Intentional or not, I don't like it.

When I write 1.1 I, I do NOT imply that the real part is also approximate.

Bobby

On Wed, 23 Mar 2011 02:52:06 -0500, Heike Gramberg
<heike.g...@gmail.com> wrote:

> In the "Possible Issues" section in the documentation of Chop it says
> that

> "Machine complex numbers have machine reals for both real and imaginary

> parts", and that "Consequently, Chop does not make the real part of
> machine complex numbers an exact zero", so I guess it's intentional.
>
> Heike
>
> On 21 Mar 2011, at 11:12, Andrzej Kozlowski wrote:
>
>> Hmm... perhaps this is not a bug but a deliberate new design?
>>
>> Just evaluating
>>
>> 1.1 I
>>
>> returns
>>
>> 0. +1.1
>>
>> It seems a purely cosmetic issue but it does look a rather
>> "untraditional". Can anyone confirm that this is indeed an intentional
>> change?
>>
>> Andrzej Kozlowski
>>
>>
>>

>> On 20 Mar 2011, at 12:44, Andrzej Kozlowski 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
>>
>>
>


--
DrMaj...@yahoo.com

0 new messages