Merge branch 'rtoy-wrap-option-args'
[maxima.git] / doc / info / de / diag.de.texi
blob3c589f1a1d93328a99ba267d656f396feb9c2624
1 @c -----------------------------------------------------------------------------
2 @c File     : diag.de.texi
3 @c License  : GNU General Public License (GPL)
4 @c Language : German
5 @c Original : diag.texi revision 1.6
6 @c Date     : 08.11.2010
7 @c Revision : 08.04.2011
8 @c 
9 @c This file is part of Maxima -- GPL CAS based on DOE-MACSYMA
10 @c -----------------------------------------------------------------------------
12 @menu
13 * Functions and Variables for diag::
14 @end menu
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.
27 Example:
29 @example
30 (%i1) load("diag")$
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]);
34 @end example
35 @example
36 @group
37                    [ 1  2  3  0  0  0 ]
38                    [                  ]
39                    [ 0  4  5  0  0  0 ]
40                    [                  ]
41                    [ 0  0  6  0  0  0 ]
42 (%o4)              [                  ]
43                    [ 0  0  0  x  0  0 ]
44                    [                  ]
45                    [ 0  0  0  0  1  1 ]
46                    [                  ]
47                    [ 0  0  0  0  1  0 ]
48 @end group
49 @end example
51 To use this function write first @code{load("diag")}.
52 @end deffn
54 @c -----------------------------------------------------------------------------
55 @deffn {Function} JF (@var{lambda}, @var{n})
57 Returns the Jordan cell of order @var{n} with eigenvalue @var{lambda}.
59 Example:
61 @example
62 (%i1) load("diag")$
63 (%i2) JF(2,5);
64 @end example
65 @example
66 @group
67                     [ 2  1  0  0  0 ]
68                     [               ]
69                     [ 0  2  1  0  0 ]
70                     [               ]
71 (%o2)               [ 0  0  2  1  0 ]
72                     [               ]
73                     [ 0  0  0  2  1 ]
74                     [               ]
75                     [ 0  0  0  0  2 ]
76 @end group
77 @end example
78 @example
79 (%i3) JF(3,2);
80 @group
81                          [ 3  1 ]
82 (%o3)                    [      ]
83                          [ 0  3 ]
84 @end group
85 @end example
87 To use this function write first @code{load("diag")}.
88 @end deffn
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}.
97 Example:
99 @example
100 (%i1) load("diag")$
101 (%i3) a:matrix([2,0,0,0,0,0,0,0],
102                [1,2,0,0,0,0,0,0],
103                [-4,1,2,0,0,0,0,0],
104                [2,0,0,2,0,0,0,0],
105                [-7,2,0,0,2,0,0,0],
106                [9,0,-2,0,1,2,0,0],
107                [-34,7,1,-2,-1,1,2,0],
108                [145,-17,-16,3,9,-2,0,3])$
109 (%i34) jordan(a);
110 (%o4)             [[2, 3, 3, 1], [3, 1]]
111 (%i5) dispJordan(%);
112                 [ 2  1  0  0  0  0  0  0 ]
113                 [                        ]
114                 [ 0  2  1  0  0  0  0  0 ]
115                 [                        ]
116                 [ 0  0  2  0  0  0  0  0 ]
117                 [                        ]
118                 [ 0  0  0  2  1  0  0  0 ]
119 (%o5)           [                        ]
120                 [ 0  0  0  0  2  1  0  0 ]
121                 [                        ]
122                 [ 0  0  0  0  0  2  0  0 ]
123                 [                        ]
124                 [ 0  0  0  0  0  0  2  0 ]
125                 [                        ]
126                 [ 0  0  0  0  0  0  0  3 ]
127 @end example
129 To use this function write first @code{load("diag")}. See also @code{dispJordan}
130 and @code{minimalPoly}.
131 @end deffn
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}.
139 Example:
141 @example
142 (%i1) load("diag")$
143 (%i2) b1:matrix([0,0,1,1,1],
144                 [0,0,0,1,1],
145                 [0,0,0,0,1],
146                 [0,0,0,0,0],
147                 [0,0,0,0,0])$
148 (%i3) jordan(b1);
149 (%o3)                  [[0, 3, 2]]
150 (%i4) dispJordan(%);
151                     [ 0  1  0  0  0 ]
152                     [               ]
153                     [ 0  0  1  0  0 ]
154                     [               ]
155 (%o4)               [ 0  0  0  0  0 ]
156                     [               ]
157                     [ 0  0  0  0  1 ]
158                     [               ]
159                     [ 0  0  0  0  0 ]
160 @end example
162 To use this function write first @code{load("diag")}. See also @code{jordan} 
163 and @code{minimalPoly}.
164 @end deffn
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}.
172 Example:
174 @example
175 (%i1) load("diag")$
176 (%i2) a:matrix([2,1,2,0],
177                [-2,2,1,2],
178                [-2,-1,-1,1],
179                [3,1,2,-1])$
180 (%i3) jordan(a);
181 (%o3)               [[- 1, 1], [1, 3]]
182 (%i4) minimalPoly(%);
183                             3
184 (%o4)                (x - 1)  (x + 1)
185 @end example
187 To use this function write first @code{load("diag")}. See also @code{jordan} 
188 and @code{dispJordan}.
189 @end deffn
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}.
198 Example:
200 @example
201 (%i1) load("diag")$
202 (%i2) a:matrix([2,1,2,0],
203           [-2,2,1,2],
204           [-2,-1,-1,1],
205           [3,1,2,-1])$
207 (%i3) jordan(a);
208 (%o3)               [[- 1, 1], [1, 3]]
209 (%i4) M: ModeMatrix(a,%);
210 @end example
211 @example
212 @group
213                   [  1    - 1   1   1 ]
214                   [                   ]
215                   [   1               ]
216                   [ - -   - 1   0   0 ]
217                   [   9               ]
218                   [                   ]
219 (%o4)             [   13              ]
220                   [ - --   1   - 1  0 ]
221                   [   9               ]
222                   [                   ]
223                   [  17               ]
224                   [  --   - 1   1   1 ]
225                   [  9                ]
226 @end group
227 @end example
228 @example
229 (%i5) is(  (M^^-1).a.M = dispJordan(%o3)  );
230 (%o5)                      true
231 @end example
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}.
237 @end deffn
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")}.
252 Example 1:
254 @example
255 (%i1) load("diag")$
256 (%i2) b2:matrix([0,1,0], [0,0,1], [-1,-3,-3])$
257 (%i3) mat_function(exp,t*b2);
258                2   - t
259               t  %e          - t     - t
260 (%o3) matrix([-------- + t %e    + %e   ,
261                  2
262         - t     - t                           - t
263  2    %e      %e        - t           - t   %e
264 t  (- ----- - ----- + %e   ) + t (2 %e    - -----)
265         t       2                             t
266                t
267                          - t          - t     - t
268        - t       - t   %e        2  %e      %e
269  + 2 %e   , t (%e    - -----) + t  (----- - -----)
270                          t            2       t
271                2   - t            - t     - t
272      - t      t  %e        2    %e      %e        - t
273  + %e   ], [- --------, - t  (- ----- - ----- + %e   ),
274                  2                t       2
275                                          t
276         - t     - t      2   - t
277    2  %e      %e        t  %e          - t
278 - t  (----- - -----)], [-------- - t %e   ,
279         2       t          2
280         - t     - t                           - t
281  2    %e      %e        - t           - t   %e
282 t  (- ----- - ----- + %e   ) - t (2 %e    - -----),
283         t       2                             t
284                t
285       - t     - t                 - t
286  2  %e      %e            - t   %e
287 t  (----- - -----) - t (%e    - -----)])
288       2       t                   t
289 @end example
290 @example
291 (%i4) ratsimp(%);
292 @group
293                [   2              - t ]
294                [ (t  + 2 t + 2) %e    ]
295                [ -------------------- ]
296                [          2           ]
297                [                      ]
298                [         2   - t      ]
299 (%o4)  Col 1 = [        t  %e         ]
300                [      - --------      ]
301                [           2          ]
302                [                      ]
303                [     2          - t   ]
304                [   (t  - 2 t) %e      ]
305                [   ----------------   ]
306                [          2           ]
307 @end group
308 @end example
309 @example
310 @group
311          [      2        - t    ]
312          [    (t  + t) %e       ]
313          [                      ]
314  Col 2 = [     2            - t ]
315          [ - (t  - t - 1) %e    ]
316          [                      ]
317          [     2          - t   ]
318          [   (t  - 3 t) %e      ]
319 @end group
320 @end example
321 @example
322 @group
323          [        2   - t       ]
324          [       t  %e          ]
325          [       --------       ]
326          [          2           ]
327          [                      ]
328          [      2          - t  ]
329  Col 3 = [    (t  - 2 t) %e     ]
330          [  - ----------------  ]
331          [           2          ]
332          [                      ]
333          [   2              - t ]
334          [ (t  - 4 t + 2) %e    ]
335          [ -------------------- ]
336          [          2           ]
337 @end group
338 @end example
340 Example 2:
342 @example
343 (%i5) b1:matrix([0,0,1,1,1],
344                 [0,0,0,1,1],
345                 [0,0,0,0,1],
346                 [0,0,0,0,0],
347                 [0,0,0,0,0])$
348 @end example
349 @example
350 (%i6) mat_function(exp,t*b1);
351 @group
352                   [              2     ]
353                   [             t      ]
354                   [ 1  0  t  t  -- + t ]
355                   [             2      ]
356                   [                    ]
357 (%o6)             [ 0  1  0  t    t    ]
358                   [                    ]
359                   [ 0  0  1  0    t    ]
360                   [                    ]
361                   [ 0  0  0  1    0    ]
362                   [                    ]
363                   [ 0  0  0  0    1    ]
364 @end group
365 @end example
366 (%i7) minimalPoly(jordan(b1));
367                              3
368 (%o7)                       x
369 @example
370 (%i8) ident(5)+t*b1+1/2*(t^2)*b1^^2;
371 @group
372                   [              2     ]
373                   [             t      ]
374                   [ 1  0  t  t  -- + t ]
375                   [             2      ]
376                   [                    ]
377 (%o8)             [ 0  1  0  t    t    ]
378                   [                    ]
379                   [ 0  0  1  0    t    ]
380                   [                    ]
381                   [ 0  0  0  1    0    ]
382                   [                    ]
383                   [ 0  0  0  0    1    ]
384 @end group
385 @end example
386 @example
387 (%i9) mat_function(exp,%i*t*b1);
388 @group
389              [                           2 ]
390              [                          t  ]
391              [ 1  0  %i t  %i t  %i t - -- ]
392              [                          2  ]
393              [                             ]
394 (%o9)        [ 0  1   0    %i t    %i t    ]
395              [                             ]
396              [ 0  0   1     0      %i t    ]
397              [                             ]
398              [ 0  0   0     1        0     ]
399              [                             ]
400              [ 0  0   0     0        1     ]
401 @end group
402 @end example
403 (%i10) mat_function(cos,t*b1)+%i*mat_function(sin,t*b1);
404 @example
405 @group
406               [                           2 ]
407               [                          t  ]
408               [ 1  0  %i t  %i t  %i t - -- ]
409               [                          2  ]
410               [                             ]
411 (%o10)        [ 0  1   0    %i t    %i t    ]
412               [                             ]
413               [ 0  0   1     0      %i t    ]
414               [                             ]
415               [ 0  0   0     1        0     ]
416               [                             ]
417               [ 0  0   0     0        1     ]
418 @end group
419 @end example
421 Example 3:
423 @example
424 (%i11) a1:matrix([2,1,0,0,0,0],
425                  [-1,4,0,0,0,0],
426                  [-1,1,2,1,0,0],
427                  [-1,1,-1,4,0,0],
428                  [-1,1,-1,1,3,0],
429                  [-1,1,-1,1,1,2])$
430 (%i12) fpow(x):=block([k],declare(k,integer),x^k)$
431 (%i13) mat_function(fpow,a1);
432 @end example
433 @example
434 @group
435                 [  k      k - 1 ]         [      k - 1    ]
436                 [ 3  - k 3      ]         [   k 3         ]
437                 [               ]         [               ]
438                 [       k - 1   ]         [  k      k - 1 ]
439                 [  - k 3        ]         [ 3  + k 3      ]
440                 [               ]         [               ]
441                 [       k - 1   ]         [      k - 1    ]
442                 [  - k 3        ]         [   k 3         ]
443 (%o13)  Col 1 = [               ] Col 2 = [               ]
444                 [       k - 1   ]         [      k - 1    ]
445                 [  - k 3        ]         [   k 3         ]
446                 [               ]         [               ]
447                 [       k - 1   ]         [      k - 1    ]
448                 [  - k 3        ]         [   k 3         ]
449                 [               ]         [               ]
450                 [       k - 1   ]         [      k - 1    ]
451                 [  - k 3        ]         [   k 3         ]
452 @end group
453 @end example
454 @example
455 @group
456          [       0       ]         [       0       ]
457          [               ]         [               ]
458          [       0       ]         [       0       ]
459          [               ]         [               ]
460          [  k      k - 1 ]         [      k - 1    ]
461          [ 3  - k 3      ]         [   k 3         ]
462          [               ]         [               ]
463  Col 3 = [       k - 1   ] Col 4 = [  k      k - 1 ]
464          [  - k 3        ]         [ 3  + k 3      ]
465          [               ]         [               ]
466          [       k - 1   ]         [      k - 1    ]
467          [  - k 3        ]         [   k 3         ]
468          [               ]         [               ]
469          [       k - 1   ]         [      k - 1    ]
470          [  - k 3        ]         [   k 3         ]
471 @end group
472 @end example
473 @example
474 @group
475          [    0    ]
476          [         ]         [ 0  ]
477          [    0    ]         [    ]
478          [         ]         [ 0  ]
479          [    0    ]         [    ]
480          [         ]         [ 0  ]
481  Col 5 = [    0    ] Col 6 = [    ]
482          [         ]         [ 0  ]
483          [    k    ]         [    ]
484          [   3     ]         [ 0  ]
485          [         ]         [    ]
486          [  k    k ]         [  k ]
487          [ 3  - 2  ]         [ 2  ]
488 @end group
489 @end example
490 @end deffn
492 @c --- End of file diag.de.texi ------------------------------------------------