Ahhh, thank you Leo Butler. I assume this handles recursive rules too? I'll
be needing to put in the matrix chain rule too.
Maybe I'll start developing a package putting in most of the rules from the
matrix cookbook.
On 2012-02-18 9:00 AM, "Leo Butler" <l_butler at users.sourceforge.net> wrote:
Mike Valenzuela <mickle.mouse at gmail.com> writes:
> [1:multipart/alternative Hide]
> [1/1:text/plain Hide]
> I've been working on a particularly tricky problem and wanted to check my
> math. The problem simp...
Maxima has the capability to have simplification rules added to its
built-in simplifier. Here are some:
(%i1) kill(all)$
(%i1) display2d:false $
(%i2) matchdeclare(X,lambda([u],get(u,matrixp))) $
(%i3) matchdeclare(t,atom) $
(%i4) put(B,true,matrixp) $
(%i5) depends([A,B],x) $
(%i6) tellsimp('diff(X^^(-1),t),-X^^(-1) . diff(X,t) . X^^(-1));
(%i7) tellsimp('diff('transpose(X),t),transpose(diff(X,t)));
tellsimp is a command that adds simplification rules; matchdeclare lets
us apply these rules selectively.
Now, we can try things out:
(%i8) diff(B,x);
(%o8) 'diff(B,x,1)
(%i9) diff(B^^(-1),x);
(%o9) -B^^(-1) . ('diff(B,x,1)) . B^^(-1)
The correct answer.
(%i10) diff(A,x);
(%o10) 'diff(A,x,1)
(%i11) diff(A^^(-1),x);
(%o11) 'diff(A^^(-1),x,1)
Because we have not told Maxima that A is a matrix, the simplifier
leaves the expression unevaluated.
(%i12) diff(transpose(B),x);
(%o12) 'transpose('diff(B,x,1))
Again, the correct answer.
(%i13) diff(transpose(B). A . B, x);
(%o13) 'transpose('diff(B,x,1)) . A . B+'transpose(B) . ('diff(A,x,1))
. B
+'transpose(B) . A . 'diff(B,x,1)
Looks good, to..
(%i14) diff(transpose(B). C . B, x);
(%o14) 'transpose('diff(B,x,1)) . C . B+'transpose(B) . C . 'diff(B,x,1)
Looks good (Maxima treats C as a constant, unlike in %o13).
--
Leo Butler <l_butler at users.sourceforge.net>
SDF Public Access UNIX System - http://sdf.lonestar.org