matchdeclare and tellsimpafter



On Nov. 19, Barton Willis wrote:
-------------------------------------

Quick example:

(%i1) load(simplifying)$

(%i2) simp_comm(a,b) := block([ac : numfactor(a), bc : numfactor(b)],
  a : a / ac,
  b : b / bc,
  if ordergreatp(a,b) then (
     [a,b] : [b,a],
     ac : - ac),
  ac * bc * simpfunmake('comm, [a,b]))$
(%i3) simplifying('comm,'simp_comm)$
(%i4) comm(b / 7,a / 5);
(%o4) -comm(a,b)/35

cornbread is in the oven...

---------------------------------
This is a great utility. Is there documentation
for simplifying.lisp?


When I include declare(comm,multiadditive),
I get the expansion ok but I haven't checked
enough cases.

I would also like to factor out declared scalars,
as I try to do below.

Finally I need to add rules (or else...) to get products of
faux-matrix objects to expand correctly after pulling out
numbers and scalars and expanding with the linear in
each arg property supplied by multiadditive.

(%i1) load(simplifying);
(%o1) 
"C:/PROGRA~1/MA81BB~1.1/share/maxima/5.22.1/share/contrib/simplifying.lisp"
(%i2) simp_comm(a,b) := block([ac : numfactor(a), bc : numfactor(b)],
  a : a / ac,
  b : b / bc,
  if ordergreatp(a,b) then (
     [a,b] : [b,a],
     ac : - ac),
  ac * bc * simpfunmake('comm, [a,b]))$
(%i3) simplifying('comm,'simp_comm)$
(%i4) comm(b / 7,a / 5);
(%o4) -comm(a,b)/35
(%i5) comm(a,b);
(%o5) comm(a,b)
(%i6) comm(2*a,b);
(%o6) 2*comm(a,b)
(%i7) comm(a,2*b);
(%o7) 2*comm(a,b)
(%i8) comm(b,a);
(%o8) -comm(a,b)
(%i9) comm(a+b,c);
(%o9) comm(b+a,c)
(%i10) load(multiadditive);
(%o10) 
"C:/PROGRA~1/MA81BB~1.1/share/maxima/5.22.1/share/contrib/multiadditive.lisp"
(%i11) declare(comm,multiadditive)$
(%i12) comm(a+b,c);
(%o12) comm(b,c)+comm(a,c)
(%i13) comm(a+b,c+d);
(%o13) comm(b,d)+comm(b,c)+comm(a,d)+comm(a,c)
(%i14) comm(c+d,a+b);
(%o14) -comm(b,d)-comm(b,c)-comm(a,d)-comm(a,c)
(%i15) declare([s1,s2,s3,s4],scalar)$
(%i16) comm (s1*a,b);
(%o16) comm(s1*a,b)
(%i17) comm(2*a+b,c);
(%o17) comm(b,c)+2*comm(a,c)
(%i18) comm(2*a+b/3,c);
(%o18) comm(b,c)/3+2*comm(a,c)
(%i19) comm (a.a,b);
(%o19) comm(a^^2,b)
(%i20) comm(a*a,b);
(%o20) comm(a^2,b)
(%i21) comm (a.b,c);
(%o21) comm(a . b,c)