1
Every square matrix can be expressed as a linear combination of
2
commuting projection matrices plus a nilpotent matrix. Specifically,
3
given a square matrix M, there are scalars z1, z2, ... zn and matrices
4
P1, P2, ... , Pn, D, such that
6
(1) M = z1 P1 + z2 P2 + ... + zn Pn + D,
7
(2) spectrum(M) = {z1,z2, ..., zn},
8
(3) Pi Pj = Pj Pi = kron_delta(i,j) Pi, for 1 <= i,j <= n,
10
(5) D Pi = Pi D, for 1 <= i <= n,
11
(6) P1 + P2 + ... + Pn = I.
13
We call (1) the spectral representation of M. Recall that a matrix
14
is D is nilpotent means that there is a positive integer k such that
17
The spectral representation of a matrix is not a continuous function of
18
the matrix arguments. Here is an example
20
(C1) spectral_rep(matrix([1,0],[0,x]));
22
Proviso: assuming x-1 # 0
23
[ 0 0 ] [ 1 0 ] [ 0 0 ]
24
(D1) [[x, 1], [[ ], [ ]], [ ]]
25
[ 0 1 ] [ 0 0 ] [ 0 0 ]
27
Maxima does give a warning that it has assumed that x does not equal 1.
28
Unfortunately, the assumption x-1 # 0 isn't available to the user. When
29
x = 1, the spectral representation is
31
(C2) spectral_rep(matrix([1,0],[0,1]));
34
(D2) [[1], [[ ]], [ ]]
42
When mat is a square matrix, return a list of the form
44
[[z1,z2, ... zn], [P1, P2, ... ,Pn], D],
46
where z1 P1 + z2 P2 + ... + zn Pn + D is the spectral representation of M.
50
When mat is a square matrix, return exp(mat * t). The second argument
51
is optional and it defaults to 1.
53
matrixfun(lambda-expr, mat)
55
When mat is a square matrix and lambda-expr is a Maxima lambda expression,
56
extend the function lambda-expr to matrices and return lambda-expr(mat).
57
Thus matrixfun(lambda([x],x^2), mat) == mat . mat and
58
matrixfun(lambda([x], 1/x), mat) == mat^^-1.
60
If the lambda-expr involves an unknown function, you may need to load
61
pdiff; otherwise, you'll get an error. Here is an example
63
(C1) load("matexp.lisp")$
64
(C2) m : matrix([1,2],[0,1])$
65
(C3) matrixfun(lambda([x], f(x)),m);
67
Attempt to differentiate with respect to a number:
68
1 -- an error. Quitting. To debug this try debugmode(true);
70
(C5) matrixfun(lambda([x], f(x)),m);
79
Barton Willis wrote matexp. This code is covered by the GNU public
80
license. Please send bug reports to the Maxima mailing list.