Re: Undiscovered Bug?
- To: mathgroup at smc.vnet.net
- Subject: [mg46910] Re: Undiscovered Bug?
- From: drbob at bigfoot.com (Bobby R. Treat)
- Date: Sun, 14 Mar 2004 23:54:25 -0500 (EST)
- References: <c2u50r$f8i$1@smc.vnet.net> <c31cbv$7l5$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
It's still not an error; just an interface you haven't learned. It would be less confusing if Part and ReplacePart used the same notation for parts, but they don't, so... We just have to adjust. indices = {2, 1, 1, 0, 2, 2, 0}; (x/y)[[indices]] (Times^2*x^2)/y^3 ReplacePart[x/y, a, List /@ indices] a[a, a] List /@ indices {{2}, {1}, {1}, {0}, {2}, {2}, {0}} This gives the error you want: (x/y)[[Sequence @@ indices]] Bobby Harold.Noffke at wpafb.af.mil (Harold Noffke) wrote in message news:<c31cbv$7l5$1 at smc.vnet.net>... > MathGroup: > > Thanks to all for help with Part documentation ... > > "When expr is a list, expr[[{i1, i2, ... in ]] gives a list of > parts. In general, the head of expr is applied to the list of parts." > > ReplacePart's behavior, however, produces a different result ... > > Recall, we had for Part ... > > In[5]:= (x/y)[[{2, 1, 1, 0, 2, 2, 0}]] > > 2 2 > Times x > Out[5]= --------- > 3 > y > > But, we have for ReplacePart ... > > In[1]:= ReplacePart[(x/y), a, {2, 1, 1, 0, 2, 2, 0}] > > x > ReplacePart::partw: Part {2, 1, 1, 0, 2, 2, 0} of - does not > exist. > y > > Maybe I'm still missing something, but it seems to me Part should be > revised to detect the same errors as ReplacePart. > > Regards, > Harold