Help matching variables and their indices



On 2013-02-25, Mike Valenzuela <mickle.mouse at gmail.com> wrote:

> I have tried something similar using the following:
> (%i6) matchdeclare([aa,bb,ii,jj],true)$
> (%i7) matchdeclare([xx,yy], symbolp)$
> (%i8) defrule(sum_power_collapse,
> msum(xx[ii],ii,aa,bb)*msum(xx[jj],jj,aa,bb), msum(xx[ii],ii,aa,bb)^2)$
> % defmatch: xx[aa] will be matched uniquely since sub-parts would otherwise
> be ambigious.
>
> (%i9) apply1( msum(x[i],i,b,c)*msum(x[j],j,b,c), sum_power_collapse);
> (%o9) msum(x[i],a,b,c)*msum(x[j],j,b,c)
>
> I had hoped the outcome would have been: msum(x[i],a,b,c)^2.

Hmm, I am getting the expected result. Maxima 5.30.0.

(%i1) matchdeclare([aa,bb,ii,jj],true)$
(%i2) matchdeclare([xx,yy], symbolp)$
(%i3) defrule(sum_power_collapse,
msum(xx[ii],ii,aa,bb)*msum(xx[jj],jj,aa,bb), msum(xx[ii],ii,aa,bb)^2)$
(%i4) display2d : false $
(%i5) apply1( msum(x[i],i,b,c)*msum(x[j],j,b,c), sum_power_collapse);
(%o5) msum(x[j],j,b,c)^2

What is your Maxima version? Sorry for the late reply.

best

Robert Dodier