I am looking at commutator algebra and want to
pull out numbers and declared scalars from the
commutator symbol comm(x,y).
Here I am only trying to pull out numerical factors.
(%i1) matchdeclare (aa, all,bb, all,cc, all,dd, all)$
/* try just using the predicate numberp */
(%i2) matchdeclare (mm, numberp)$
(%i3) tellsimpafter (comm (mm*aa, bb), mm*comm (aa, bb))$
(%i4) tellsimpafter (comm (aa, mm*bb), mm*comm (aa, bb))$
/* it works for first arg but not the second */
(%i5) comm (2*a, b);
(%o5) 2*comm (a, b)
(%i6) comm (a, 2*b);
(%o6) comm (a, 2*b)
/* include specifically the predicate integerp */
(%i7) matchdeclare (nn, integerp)$
(%i8) tellsimpafter (comm (nn*aa, bb), nn*comm (aa, bb))$
(%i9) tellsimpafter (comm (aa, nn*bb), nn*comm (aa, bb))$
/* now pulls out a factor of 2 from each arg */
(%i10) comm (2*a, b);
(%o10) 2*comm (a, b)
(%i11) comm (a, 2*b);
(%o11) 2*comm (a, b)
/* and pulls out factor of 1/2 from first arg
but not the second */
(%i12) comm (a/2, b);
(%o12) comm (a, b)/2
(%i13) comm (a, b/2);
(%o13) comm (a, b/2)
/* include numberp division rule for second arg */
(%i14) tellsimpafter (comm (aa, bb/mm), comm (aa, bb)/mm)$
/* still doesn't work on second arg */
(%i15) comm (a, b/2);
(%o15) comm (a, b/2)
/* include integerp division rule for second arg */
(%i16) tellsimpafter (comm (aa, bb/nn), comm (aa, bb)/nn)$
/* still doesn't work on second arg */
(%i17) comm (a, b/2);
(%o17) comm (a, b/2)
So I must not be using the syntax correctly here??
Ted Woollett