Re: Undiscovered Bug?

*To*: mathgroup at smc.vnet.net*Subject*: [mg46890] Re: Undiscovered Bug?*From*: drbob at bigfoot.com (Bobby R. Treat)*Date*: Fri, 12 Mar 2004 23:40:12 -0500 (EST)*References*: <c2rnrf$p4h$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Part[expr,{a,b,c,d}] returns: Head[expr][expr[[a]],expr[[b]],expr[[c]],expr[[d]]] So, look at your final example: (x/y)[[{2, 1, 1, 0, 2, 2, 0}]] (Times^2*x^2)/y^3 To explain it, we first need to see what the expression really is: x/y//FullForm Times[x,Power[y,-1]] The Head is Times, (x/y)[[2]] is Power[y,-1], (x/y)[[1]] is x, and (x/y)[[0]] is Times. So the result is: Times[Power[y,-1],x,x,Times,Power[y,-1],Power[y,-1],Times] and that simplifies to the answer above. Bobby Harold.Noffke at wpafb.af.mil (Harold Noffke) wrote in message news:<c2rnrf$p4h$1 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