[Maxima] rules for non-commutative-multiplication
l.butler at ed.ac.uk
Tue Feb 16 08:55:57 CST 2010
On Tue, 16 Feb 2010, Reinhard Oldenburg wrote:
< Hallo all,
< I ran into problems when setting rules for the non-commutative multiplication
< operator .
< It seems that rules don't take advantage of associativity.
< I tried to implement three-dimensional geometric algebra with the
< following commands (comment: Of course I now that one should use matchdeclare
< to avoid repetion of similair lines, but I want to make the rules to be easily
< understandable by students):
< tellsimpafter(e.e,-e.e)$ tellsimpafter(e.e,-e.e)$
< With this, e.e simplifies as expected to -e.e but
< e.e.e does not. How can one trick tellsimpafter into taking
< advantage of associativity?
< Any hints?
Reinhard, this is a good problem.
First, the problem is not associativity, but rather that the default
(dotassoc:true) automatically converts a.b.c to a.(b.c). Note that you
do not see this in the output. You can see that this will frustrate
application of your rules.
So, I looked at the last example in ? tellsimpafter. It looks
impressive, but it also does not implement all the simplifications
needed. So, after a bit of experimentation, here is what I came up
gt (i, j) := integerp(j) and i < j;
matchdeclare (i, integerp, j, gt(i));
tellsimp (X^^i, X^mod(i,2));
tellsimp (e[i] . e[j], -e[j] . e[i]);
I put in the print statements to track the simplifier, and I left them
in because you might like to see how the simplifier works through the
Also, note that I use tellsimp, not tellsimpafter. If you use the latter, you don't get
all the simplifications needed.
You will see that both triples are correctly simplified and the
simplification rules are really quite natural to read.
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the Maxima