FW: Why is this rule not working in this scenario?



Hi all,


I am trying to extract any product which is found after first d(i,j) in the
following sum.
 

sum(d(i1,i2)*g(i2)*f(i2,i3)*d(i2,i3),i2,1,n)

I tried the following thing:

matchdeclare([i,j,k,l,q],all);

(%i15)   apply(defrule,[rd5,intosum('sum(d(i,j)*q,j,1,k)),1*q]);

                                                 k

                                                ====

                                                \

(%o15)                            rd5 :  >    d(i, j) q -> q

                                                /

                                                ====

                                                j = 1

(%i16) apply(apply1,[eq2,rd5]);

(%o16)                                  g(i2) f(i2, i3)

 
 

It works till here but as soon as I have product having another d; it
doesn't work. May be I am not using the right way.

(%i17) eq2:'sum(d(i1,i2)*g(i2)*f(i2,i3)*d(i2,i3),i2,1,n);

                           n

                          ====

                          \

(%o17)                 >       d(i1, i2) g(i2) d(i2, i3) f(i2, i3)

                          /

                          ====

                          i2 = 1

 

(%i18) apply(apply1,[eq2,rd5]);

                           n

                          ====

                          \

(%o18)                 >       d(i1, i2) g(i2) d(i2, i3) f(i2, i3)

                          /

                          ====

                          i2 = 1

 

Please suggest any alternative to do this.

Regards

Dileep