RE: Undiscovered Bug?
- To: mathgroup at smc.vnet.net
- Subject: [mg46880] RE: [mg46862] Undiscovered Bug?
- From: "David Park" <djmp at earthlink.net>
- Date: Fri, 12 Mar 2004 23:39:26 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Harold,
There's a way to make sense out of it. Take this example...
Part[x + y + z, {1, 3}]
x + z
Part took the 1st and 3rd parts and inserted them in the head of the
expression, Plus.
Part[x + y + z, {2, 2}]
2 y
Part took the 2nd part, and the 2nd part again and inserted them in the head
of the expression, Plus.
So with...
Part[x/y, {2, 2}]
1/y^2
Part took the 2nd part, 1/y, and the 2nd part again and inserted them in the
head of the expression, Times.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Harold Noffke [mailto:Harold.Noffke at wpafb.af.mil]
To: mathgroup at smc.vnet.net
MathGroup:
In Mathematica 5.0.1 with Windows 2000, I mistakenly used the [[{}]]
operator on x/y. I was expecting an error, but I kept getting unusual
results as shown in In/Out's 2 to 5 below.
Have I stumbled on a bug, or is there a way to make sense out of this?
In[1]:= TreeForm[x/y]
Out[1]//TreeForm= Times[x, | ]
Power[y, -1]
In[2]:= (x/y)[[{2,2}]]
Out[2]= -2
y
In[3]:= (x/y)[[{1,2,1}]]
2
x
Out[3]= --
y
In[4]:= (x/y)[[{2, 2, 2, 2}]]
-4
Out[4]= y
In[5]:= (x/y)[[{2, 1, 1, 0, 2, 2, 0}]]
2 2
Times x
Out[5]= ---------
3
y
Regards,
Harold