Algebra structure



Hi Allan,

I know this discussion has had some evolution since you
wrote this, but anyway --

> (1) a # b is additive in a and additive in b.

> (2) * has higher precedence than #, so that a # b*c 
> means a # (b*c), and # has higher precedence than +,-.

OK, this much can be handled by the following. As you've
already noticed, I think, declare ("##", additive) isn't
what you want. Incidentally using tellsimpafter instead
of let makes the application of these rules automatic. 

The 2nd & 3rd arguments to infix are precedence values.
Addition/subtraction is 100 and multiplication/division is 120.

  infix ("##", 110, 110);
  matchdeclare (aa, true, ss, sump);
  sump(e) := not atom(e) and op(e) = "+";
  simp:false;
  tellsimpafter (ss ## aa, map (lambda ([xx], xx ## aa), ss));
  tellsimpafter (aa ## ss, map (lambda ([xx], aa ## xx), ss));
  simp:true;

which yields stuff like

  (a + b) ## c  =>  b ## c + a ## c
  a ## (b + c)  =>  a ## c + a ## b
  (a + b) ## (c + d)  =>  b ## (d + c) + a ## (d + c)
  ''%  =>  b ## d + b ## c + a ## d + a ## c

Maxima needs encouragement to apply both rules, above.
Below, precedence is * > ## > +.

  [op (a ## b + c), args (a ## b + c)]  =>  [+, [c, a ## b]]
  [op (a ## b * c), args (a ## b * c)]  =>  [##, [a, b c]]

> (3) We're given an n x n matrix M whose entries are elements of L.
> (4) With biadditivity, if a,b are elements of L then a # b is
> reducible, [...] I need to be able to tell Maxima that this 
> simplifies to m1*m2*M[i,j].

I think this can be handled as well. How does one identify
elements of L ? Given a and b, how does one find m1, m2,
and M[i,j] ? The simplification rule would look like this,
I think:

  matchdeclare ([aa, bb], is_in_L);
  is_in_L (expr) := /* dunno what goes here */;
  tellsimpafter (aa ## bb, monomial_product (aa, bb, M));
  monomial_product (a, b, M) := /* dunno what goes here */;

This is an interesting problem. Hope this helps,

Robert Dodier

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com