Pattern matching - new user question



Hi Richard

2009/10/1 Richard Fateman <fateman at cs.berkeley.edu>

>
> Try something like this..
>
>
> defmatch(b1,(AA|BB and CC));
>
> brule(p):=block([AA,BB,CC],if (b1(p)=false or ordergreatp(BB,AA)) then
> false
>                 else (BB|AA and CC)*(AA|CC)/(BB|CC));
>

 This looks promising but I can't get it to work.  Sorry if I'm missing
something obvious - I'm very new to maxima.

(%i2) defmatch(b1,(AA|BB and CC));
(%o2) b1

(%i3) brule(p):=block([AA,BB,CC],if (b1(p)=false or ordergreatp(BB,AA)) then
false
                else (BB|AA and CC)*(AA|CC)/(BB|CC));
(%o3) brule(p):=block([AA,BB,CC],if b1(p)=false or ordergreatp(BB,AA) then
false else ((BB | AA and CC)*(AA | CC))/BB | CC)

(%i4) brule(a|b and c);
(%o4) false

(%i5) apply1(a|b and c, brule);
(%o5) a | b and c

Regards
Nathaniel