1 @c -----------------------------------------------------------------------------
3 @c License : GNU General Public License (GPL)
5 @c Original : diag.texi revision 1.6
7 @c Revision : 08.04.2011
9 @c This file is part of Maxima -- GPL CAS based on DOE-MACSYMA
10 @c -----------------------------------------------------------------------------
13 * Functions and Variables for diag::
16 @c -----------------------------------------------------------------------------
17 @node Functions and Variables for diag, , diag, diag
18 @section Functions and Variables for diag
19 @c -----------------------------------------------------------------------------
21 @c -----------------------------------------------------------------------------
22 @deffn {Function} diag (@var{lm})
24 Constructs a square matrix with the matrices of @var{lm} in the diagonal.
25 @var{lm} is a list of matrices or scalars.
31 (%i2) a1:matrix([1,2,3],[0,4,5],[0,0,6])$
32 (%i3) a2:matrix([1,1],[1,0])$
33 (%i4) diag([a1,x,a2]);
51 To use this function write first @code{load("diag")}.
54 @c -----------------------------------------------------------------------------
55 @deffn {Function} JF (@var{lambda}, @var{n})
57 Returns the Jordan cell of order @var{n} with eigenvalue @var{lambda}.
87 To use this function write first @code{load("diag")}.
90 @c -----------------------------------------------------------------------------
91 @deffn {Function} jordan (@var{mat})
93 Returns the Jordan form of matrix @var{mat}, but codified in a Maxima list.
94 To get the corresponding matrix, call function @code{dispJordan} using as
95 argument the output of @code{jordan}.
101 (%i3) a:matrix([2,0,0,0,0,0,0,0],
107 [-34,7,1,-2,-1,1,2,0],
108 [145,-17,-16,3,9,-2,0,3])$
110 (%o4) [[2, 3, 3, 1], [3, 1]]
129 To use this function write first @code{load("diag")}. See also @code{dispJordan}
130 and @code{minimalPoly}.
133 @c -----------------------------------------------------------------------------
134 @deffn {Function} dispJordan (@var{l})
136 Returns the Jordan matrix associated to the codification given by the Maxima
137 list @var{l}, which is the output given by function @code{jordan}.
143 (%i2) b1:matrix([0,0,1,1,1],
162 To use this function write first @code{load("diag")}. See also @code{jordan}
163 and @code{minimalPoly}.
166 @c -----------------------------------------------------------------------------
167 @deffn {Function} minimalPoly (@var{l})
169 Returns the minimal polynomial associated to the codification given by the
170 Maxima list @var{l}, which is the output given by function @code{jordan}.
176 (%i2) a:matrix([2,1,2,0],
181 (%o3) [[- 1, 1], [1, 3]]
182 (%i4) minimalPoly(%);
184 (%o4) (x - 1) (x + 1)
187 To use this function write first @code{load("diag")}. See also @code{jordan}
188 and @code{dispJordan}.
191 @c -----------------------------------------------------------------------------
192 @deffn {Function} ModeMatrix (@var{A},@var{l})
194 Returns the matrix @var{M} such that @math{(M^^-1).A.M=J}, where @var{J} is
195 the Jordan form of @var{A}. The Maxima list @var{l} is the codified form of
196 the Jordan form as returned by function @code{jordan}.
202 (%i2) a:matrix([2,1,2,0],
208 (%o3) [[- 1, 1], [1, 3]]
209 (%i4) M: ModeMatrix(a,%);
229 (%i5) is( (M^^-1).a.M = dispJordan(%o3) );
233 Note that @code{dispJordan(%o3)} is the Jordan form of matrix @code{a}.
235 To use this function write first @code{load("diag")}. See also @code{jordan}
236 and @code{dispJordan}.
239 @c -----------------------------------------------------------------------------
240 @deffn {Function} mat_function (@var{f},@var{mat})
242 Returns @math{f(mat)}, where @var{f} is an analytic function and @var{mat}
243 a matrix. This computation is based on Cauchy's integral formula, which states
244 that if @code{f(x)} is analytic and
245 @code{mat = diag([JF(m1,n1), ..., JF(mk,nk)])}, then @code{f(mat) =
246 ModeMatrix * diag([f(JF(m1,n1)), ..., f(JF(mk,nk))]) * ModeMatrix^^(-1)}.
247 Note that there are about 6 or 8 other methods for this calculation.
248 Some examples follow.
250 To use this function write first @code{load("diag")}.
256 (%i2) b2:matrix([0,1,0], [0,0,1], [-1,-3,-3])$
257 (%i3) mat_function(exp,t*b2);
260 (%o3) matrix([-------- + t %e + %e ,
264 t (- ----- - ----- + %e ) + t (2 %e - -----)
269 + 2 %e , t (%e - -----) + t (----- - -----)
273 + %e ], [- --------, - t (- ----- - ----- + %e ),
278 - t (----- - -----)], [-------- - t %e ,
282 t (- ----- - ----- + %e ) - t (2 %e - -----),
287 t (----- - -----) - t (%e - -----)])
295 [ -------------------- ]
299 (%o4) Col 1 = [ t %e ]
329 Col 3 = [ (t - 2 t) %e ]
330 [ - ---------------- ]
335 [ -------------------- ]
343 (%i5) b1:matrix([0,0,1,1,1],
350 (%i6) mat_function(exp,t*b1);
366 (%i7) minimalPoly(jordan(b1));
370 (%i8) ident(5)+t*b1+1/2*(t^2)*b1^^2;
387 (%i9) mat_function(exp,%i*t*b1);
391 [ 1 0 %i t %i t %i t - -- ]
394 (%o9) [ 0 1 0 %i t %i t ]
403 (%i10) mat_function(cos,t*b1)+%i*mat_function(sin,t*b1);
408 [ 1 0 %i t %i t %i t - -- ]
411 (%o10) [ 0 1 0 %i t %i t ]
424 (%i11) a1:matrix([2,1,0,0,0,0],
430 (%i12) fpow(x):=block([k],declare(k,integer),x^k)$
431 (%i13) mat_function(fpow,a1);
435 [ k k - 1 ] [ k - 1 ]
438 [ k - 1 ] [ k k - 1 ]
439 [ - k 3 ] [ 3 + k 3 ]
443 (%o13) Col 1 = [ ] Col 2 = [ ]
460 [ k k - 1 ] [ k - 1 ]
463 Col 3 = [ k - 1 ] Col 4 = [ k k - 1 ]
464 [ - k 3 ] [ 3 + k 3 ]
481 Col 5 = [ 0 ] Col 6 = [ ]
492 @c --- End of file diag.de.texi ------------------------------------------------