~ubuntu-branches/debian/squeeze/maxima/squeeze

« back to all changes in this revision

Viewing changes to share/linearalgebra/matrixexp.usage

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2006-10-18 14:52:42 UTC
  • mto: (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061018145242-vzyrm5hmxr8kiosf
ImportĀ upstreamĀ versionĀ 5.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
5
 
 
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,
 
9
(4) D is nilpotent,
 
10
(5) D Pi = Pi D, for 1 <= i <= n,
 
11
(6) P1 + P2 + ... + Pn = I.
 
12
 
 
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
 
15
D^k = 0.
 
16
 
 
17
The spectral representation of a matrix is not a continuous function of
 
18
the matrix arguments. Here is an example
 
19
 
 
20
(C1) spectral_rep(matrix([1,0],[0,x]));
 
21
 
 
22
Proviso: assuming x-1 # 0
 
23
                             [ 0  0 ]  [ 1  0 ]   [ 0  0 ]
 
24
(D1)               [[x, 1], [[      ], [      ]], [      ]]
 
25
                             [ 0  1 ]  [ 0  0 ]   [ 0  0 ]
 
26
 
 
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 
 
30
 
 
31
(C2) spectral_rep(matrix([1,0],[0,1]));
 
32
 
 
33
                                 [ 1  0 ]   [ 0  0 ]
 
34
(D2)                      [[1], [[      ]], [      ]]
 
35
                                 [ 0  1 ]   [ 0  0 ]
 
36
(C3) 
 
37
 
 
38
Functions:
 
39
 
 
40
spectral_rep(mat)
 
41
 
 
42
When mat is a square matrix, return a list of the form 
 
43
 
 
44
   [[z1,z2, ... zn], [P1, P2, ... ,Pn], D],
 
45
 
 
46
where z1 P1 + z2 P2 + ... + zn Pn + D is the spectral representation of M.
 
47
 
 
48
matrixexp(mat, t)
 
49
 
 
50
When mat is a square matrix, return exp(mat * t).  The second argument
 
51
is optional and it defaults to 1.
 
52
 
 
53
matrixfun(lambda-expr, mat)
 
54
 
 
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.  
 
59
 
 
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
 
62
 
 
63
(C1) load("matexp.lisp")$
 
64
(C2) m : matrix([1,2],[0,1])$
 
65
(C3) matrixfun(lambda([x], f(x)),m);
 
66
 
 
67
Attempt to differentiate with respect to a number:
 
68
1 -- an error.  Quitting.  To debug this try debugmode(true);
 
69
(C4) load("pdiff")$
 
70
(C5)  matrixfun(lambda([x], f(x)),m);
 
71
 
 
72
                              [ f(1)  2 f   (1) ]
 
73
(D5)                          [          (1)    ]
 
74
                              [                 ]
 
75
                              [  0      f(1)    ]
 
76
(C6) 
 
77
 
 
78
 
 
79
Barton Willis wrote matexp. This code is covered by the GNU public
 
80
license. Please send bug reports to the Maxima mailing list.