Discussion:
Can Maxima be used to simplify symbolic matrix algebra statements?
Rudolph van der Merwe
2003-07-07 22:18:59 UTC
Permalink
Can Maxima be used to simplify symbolic linear algebra statements?

I.e. something that can reduce a matrix statement such as (using Matlab
notation),

A*(B + inv(A)) * inv(A*B + I) to I ?

Or even better, using concepts such as the matrix-inversion-lemma, being
able to reduce

(inv(B) + C*inv(D)*C') * (B - B*C*inv(D + C'*B*C)*C'*B to I ?

I have a couple of pages full of nasty matrix algebra equations I'm
trying to wrestle into a form that makes some intuitive sense.

If tried using statements such as

(C1) declare([A,B,C],nonscalar);

and

(C2) simplify(A . (A^^-1 + B));

but not with much luck.

How should Maxima be used to address this general problem?

Thanks
Rudolph
Richard Fateman
2003-07-08 00:03:01 UTC
Permalink
You can define all the transformation rules that you have
in mind using defrule,
But you should not use "*" but ".". The dot
stands for non-commutative multiplication. If you use *,
then macsyma assumes the operands can commute. But a.b is
not the same as b.a .

The simplify command usually does nothing special because
all the results are already run through the simplifier.

Try the expand command.


RJF
Post by Rudolph van der Merwe
Can Maxima be used to simplify symbolic linear algebra statements?
I.e. something that can reduce a matrix statement such as (using Matlab
notation),
A*(B + inv(A)) * inv(A*B + I) to I ?
Or even better, using concepts such as the matrix-inversion-lemma, being
able to reduce
(inv(B) + C*inv(D)*C') * (B - B*C*inv(D + C'*B*C)*C'*B to I ?
I have a couple of pages full of nasty matrix algebra equations I'm
trying to wrestle into a form that makes some intuitive sense.
If tried using statements such as
(C1) declare([A,B,C],nonscalar);
and
(C2) simplify(A . (A^^-1 + B));
but not with much luck.
How should Maxima be used to address this general problem?
Thanks
Rudolph
_______________________________________________
Maxima mailing list
http://www.math.utexas.edu/mailman/listinfo/maxima
Stavros Macrakis
2003-07-14 18:45:49 UTC
Permalink
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

Loading...