Can Maxima be used to simplify symbolic matrix algebra statements?



Here are some notes on simplifying non-commutative operations in Maxima
along with a small package I wrote which may be helpful.  For example,
it simplifies some of the expressions in your original email, and can
also prove the Sherman-Morrison-Woodbury matrix inversion identity with
no manual intervention.

Maxima has limited built-in capabilities for simplifying non-commutative
operators.  To use them effectively, it is important to explicitly
declare scalar variables; in most cases, undeclared variables are
treated as non-scalar, but it is best to declare them explicitly, too.
It is also useful to check the various options starting DOT; the
defaults are all reasonable, except that I usually also turn on
Dotscrules.

There are share packages which may be relevant (affine and various
tensor), but I don't know anything about them.

Even for monomials (expressions involving only "*", ".", and "^^"),
Maxima has some limitations/bugs.  For example, though it does simplify
a.b.(a.b)^^-1 to 1, it does not do so for a.b.(c.a.b)^^-1 (instead, use
my workaround "dotexpand" function in the dotsimp package).  Even more
blatantly: a^^-1 . (a.b)^^2 or even (a^^-1 . a . b . a . b) do not
currently simplify to b.a.b (my bug report # 629716).  There are
workarounds for that, too -- dotexpand(dotexpand(xxx^^-1)^^-1) -- but
that is ridiculous.

For polynomials, the main value of Maxima is not the automatic
simplifications (which are not very powerful), but rather the
possibility of manipulating complicated expressions without error.

I have a very simple routine for some trivial cases of non-commutative
factoring which I call simpledotfactor (attached).  It turns out that
these trivial cases are enough to, for example, simplify your example:

Matlab: A*(B + inv(A)) * inv(A*B + I)
Maxima: A.(B + A^^-1)  . (A.B + 1)^^-1

and for that matter to prove the Sherman-Morrison-Woodbury matrix
inversion identity.  But it knows nothing about the transpose operator,
and can't help for your other problem.

My dotsimp package requires the union function from the new set package,
available from
http://www.unk.edu/acad/math/people/willisb/nset-1.0.tar.gz (presumably
at some point nset will be added to the share directories in CVS).

I hope you find this helpful -- I'm always interested in comments, bug
reports, and suggestions.

      -s

Stavros Macrakis

Attached file: dotsimp.mac