### Related

r2: x^2 + y^2;

r: sqrt(r2);

cosr: x / r;

Calculate

##### diagmatrix-matrix

K = matrix( [1.000,...

W = matrix( [0.316,...

Q = matrix( [0.000,...

Calculate

##### diagmatrix-matrix

x: matrix ([a, a,0,0]...

i: diagmatrix (4, 1);

j: matrix ( [1,1,1,1]...

Calculate

/* defino los flags *...

ratchristof: true;

Calculate

##### diagmatrix

a: diagmatrix(10,0);

a[1,1]: 1;

a[2,2]: 1;

Calculate

##### diagmatrix-matrix

A:matrix([0,-1/L1,0],...

cpolinom = det(diagm...

Calculate

##### diagmatrix-expand-jacobian-matrix-phi-ratsimp-sin

A:matrix([0,-1/L1,0],...

B:matrix([1/L1, 0], [...

x:matrix([i_inv],[u_c...

Calculate

##### diagmatrix-matrix

x: matrix ([a, a,0,0]...

i: diagmatrix (4, 1);

j: matrix ( [1,1,1,1]...

Calculate

##### diagmatrix-matrix-mod-solve

M: matrix ([7, 3, 4, ...

K : mod(M,11);

D:diagmatrix(4,1)*k;

Calculate

/* defino los flags *...

ratchristof: true;

Calculate

### diagmatrix

Run Example
(%i1)A:matrix([0,-1/L1,0],     [1/C,0,-1/C],     [0,1/L,-Rg/L]);
[      1        ]
[ 0  - --   0   ]
[      L1       ]
[               ]
[ 1          1  ]
(%o1)                          [ -   0    - -  ]
[ C          C  ]
[               ]
[     1      Rg ]
[ 0   -    - -- ]
[     L      L  ]
(%i2) B:matrix([1/L1, 0], [0,0], [0,-1/L]);
[ 1       ]
[ --   0  ]
[ L1      ]
[         ]
(%o2)                             [ 0    0  ]
[         ]
[       1 ]
[ 0   - - ]
[       L ]
(%i3) x:matrix([i_inv],[u_c],[i_g]);
[ i_inv ]
[       ]
(%o3)                              [  u_c  ]
[       ]
[  i_g  ]
(%i4) u:matrix([u_inv],[u1*sin(theta+phi)]);
[        u_inv        ]
(%o4)                       [                     ]
[ sin(theta + phi) u1 ]
(%i5) Ad: diagmatrix(3,1) + A*T + (A*T).(A*T)/2;
[        2                                 2            ]
[       T             T                   T             ]
[ 1 - ------        - --                ------          ]
[     2 C L1          L1                2 C L1          ]
[                                                       ]
[                 2     2                               ]
[                T     T                                ]
[             - ---- - ---                 2            ]
[     T         C L1   C L             Rg T    T        ]
(%o5)      [     -       ------------ + 1         ----- - -        ]
[     C            2                   2 C L   C        ]
[                                                       ]
[                                 2  2    2             ]
[                               Rg  T    T              ]
[                               ------ - ---            ]
[     2                  2         2     C L            ]
[    T           T   Rg T         L            Rg T     ]
[   -----        - - -----      ------------ - ---- + 1 ]
[   2 C L        L      2            2          L       ]
[                    2 L                                ]
(%i6) Bd: (diagmatrix(3,1) + A*T^2/2).B;
[   1                 ]
[   --         0      ]
[   L1                ]
[                     ]
[    2         2      ]
[   T         T       ]
[ ------     -----    ]
(%o6)                       [ 2 C L1     2 C L    ]
[                     ]
[                   2 ]
[               Rg T  ]
[           1 - ----- ]
[                2 L  ]
[   0     - --------- ]
[               L     ]
2           2
T       i_g T    u_c T   u_inv
(%o7) matrix([i_inv (1 - ------) + ------ - ----- + -----],
2 C L1    2 C L1    L1      L1
2     2
T     T
- ---- - ---                 2               2                        2
C L1   C L             Rg T    T    u_inv T    sin(theta + phi) u1 T
[u_c (------------ + 1) + i_g (----- - -) + -------- + ----------------------
2                   2 C L   C     2 C L1            2 C L
2  2    2
Rg  T    T                                              2
------ - ---                                        Rg T
2     C L               sin(theta + phi) u1 (1 - -----)
i_inv T           L            Rg T                                  2 L
+ -------], [i_g (------------ - ---- + 1) - -------------------------------
C                 2          L                         L
2           2
T   Rg T     i_inv T
+ u_c (- - -----) + --------])
L      2      2 C L
2 L
(%i8) k(i_inv,u_c,i_g,Rg,L,phi):= h;
(%o8)                 k(i_inv, u_c, i_g, Rg, L, phi) := h
(%i9) k;
(%o9)                                  k
(%i10) j: jacobian([h],[i_inv,u_c,i_g,Rg,L,phi]);
[         T        ]
[        2   ]  [       - --       ]
[       T    ]  [         L1       ]
[ 1 - ------ ]  [                  ]
[     2 C L1 ]  [     2     2      ]
[            ]  [    T     T       ]
[     T      ]  [ - ---- - ---     ]
(%o10) matrix([[     -      ], [   C L1   C L     ],
[     C      ]  [ ------------ + 1 ]
[            ]  [      2           ]
[     2      ]  [                  ]
[    T       ]  [            2     ]
[   -----    ]  [    T   Rg T      ]
[   2 C L    ]  [    - - -----     ]
[    L      2      ]
[        2 L       ]
[            2            ]
[           T             ]
[         ------          ]
[         2 C L1          ]
[                         ]
[            2            ]
[        Rg T    T        ]
[        ----- - -        ]
[        2 C L   C        ],
[                         ]
[   2  2    2             ]
[ Rg  T    T              ]
[ ------ - ---            ]
[    2     C L            ]
[   L            Rg T     ]
[ ------------ - ---- + 1 ]
[      2          L       ]
[                         0                         ]
[                                                   ]
[                           2                       ]
[                      i_g T                        ]
[                      ------                       ]
[                      2 C L                        ],
[                                                   ]
[          2             2                        2 ]
[      Rg T    T    u_c T    sin(theta + phi) u1 T  ]
[ i_g (----- - -) - ------ + ---------------------- ]
[        2     L        2                2          ]
[       L            2 L              2 L           ]
2                        2           2
u_c T    sin(theta + phi) u1 T    i_g Rg T
matrix([0], [------ - ---------------------- - ---------],
2                2                 2
2 C L            2 C L             2 C L
2        2  2
T     2 Rg  T                                         2
---- - --------                                    Rg T
2       3              sin(theta + phi) u1 (1 - -----)
C L       L       Rg T                              2 L
[i_g (--------------- + ----) + -------------------------------
2            2                    2
L                    L
2                2                           2
Rg T    T     i_inv T    Rg sin(theta + phi) u1 T
+ u_c (----- - --) - -------- - -------------------------]),
3      2          2                 3
L      L      2 C L               2 L
[                 0                 ]
[                                   ]
[                           2       ]
[      cos(theta + phi) u1 T        ]
[      ----------------------       ]
[              2 C L                ]
[                                   ]])
[                                2  ]
[                            Rg T   ]
[   cos(theta + phi) u1 (1 - -----) ]
[                             2 L   ]
[ - ------------------------------- ]
[                  L                ]
(%i11) diff(h,i_inv);
[        2   ]
[       T    ]
[ 1 - ------ ]
[     2 C L1 ]
[            ]
[     T      ]
(%o11)                          [     -      ]
[     C      ]
[            ]
[     2      ]
[    T       ]
[   -----    ]
[   2 C L    ]
(%i12) D: diagmatrix(3,vals[1]);
[ vals     0      0   ]
[     1               ]
[                     ]
(%o12)                      [   0    vals     0   ]
[            1        ]
[                     ]
[   0      0    vals  ]
[                   1 ]
(%i13) vecs*exp(D)*vecs^-1;
[   vals                    ]
[       1                   ]
[ %e          1        1    ]
[                           ]
[            vals           ]
(%o13)                   [                1          ]
[    1     %e          1    ]
[                           ]
[                     vals  ]
[                         1 ]
[    1        1     %e      ]
(%i14)
Run Example
A: diagmatrix(10,2);
[ 2  0  0  0  0  0  0  0  0  0 ]
[                              ]
[ 0  2  0  0  0  0  0  0  0  0 ]
[                              ]
[ 0  0  2  0  0  0  0  0  0  0 ]
[                              ]
[ 0  0  0  2  0  0  0  0  0  0 ]
[                              ]
[ 0  0  0  0  2  0  0  0  0  0 ]
(%o1)                  [                              ]
[ 0  0  0  0  0  2  0  0  0  0 ]
[                              ]
[ 0  0  0  0  0  0  2  0  0  0 ]
[                              ]
[ 0  0  0  0  0  0  0  2  0  0 ]
[                              ]
[ 0  0  0  0  0  0  0  0  2  0 ]
[                              ]
[ 0  0  0  0  0  0  0  0  0  2 ]
(%i2)
Run Example
P:diagmatrix(16,0);
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
(%o1)         [                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
(%i2) P[1,5]:P[5,1]:1;
(%o2)                                  1
(%i3) P;
[ 0  0  0  0  1  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
(%o3)         [                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
[                                                ]
[ 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ]
(%i4)

### Related Help

Help for Diagmatrix