Matching and dropping terms



On 02/24/2011 09:24 AM, dlakelan wrote:

> or something like that. any hints on how to get this sort of thing to
> work? Everything I've tried tends to simply return false except in very
> simple test cases that have nothing to do with the real world application..


ARGH of course I just restarted maxima and used a blank file to do some 
testing and found the following worked, which didn't work before (here 
it's a rule instead of a matching but it's the same concept). I suspect 
that my Maxima was simply polluted with some extra variables that were 
evaluating to something I didn't expect.

(%i2) matchdeclare(a,true,[b,c], lambda([x],freeof(X,Y,x) or 
not(freeof('diff(X,y),'diff(Y,y),x))));
(%o2)                                done
(%i3) defrule(dropsmall,b*X + c*Y+a,a);
(%o3)                   dropsmall : c Y + b X + a -> a
(%i4) dropsmall('diff(X,y)*(1+5*q + (3+a)*X));
                                            dX
(%o4)                            (5 q + 1) --
                                            dy
(%i5) dropsmall('diff(X,y)*'diff(Y,y)*(1+5*q+(3+a)*X + (3+b)*Y));
                                           dX dY
(%o5)                           (5 q + 1) -- --
                                           dy dy