Is it a bug or am I missing something? (Rules & Patterns)



On 9/25/06, dp2 at cise.ufl.edu <dp2 at cise.ufl.edu> wrote:

> (%i1) matchdeclare([_x,_n,_f,_p,_g,_q],all);
> (%o1) done
> (%i2) apply(defrule,[s2,sum(_f(_x)*_g(_x),_x,1,_n),S(_f*_g)]);
> (%o2) s2:sum(_f(_x)*_g(_x),_x,1,_n)->S(_f*_g)
> (%i3) apply1(sum(f(i1064)*g(i1064),i1064,1,N),s2);
> (%o3) sum(f(i1064)*g(i1064),i1064,1,N)

I believe that's a bug. I'll try to investigate later.
By the way, :lisp #'$s2 might shed some light on what's going on
(that displays the constructed rule function -- if you're working with
an interpreted Lisp, anyway).

> (%i4) apply(defrule,[s4,sum(_f(_x)^_p*_g(_x)^_q,_x,1,_n),S(_f^_p*_g^_q)]);
> (%o4) s4:sum(_f(_x)^_p*_g(_x)^_q,_x,1,_n)->S(_f^_p*_g^_q)
> (%i6) apply1(sum(f(i1064)^2*g(i1064)^3,i1064,1,N),s4);
> (%o6) S(f^2*g^3)

Hmm, that's an interesting rule. I like that.

Robert