Sponsored links: Algebra eBooks
 

Related

mat_unblocker

? mat_unblocker;

Calculate

mat_unblocker-matrix

A : matrix ([1, 2], [...

...

...

Calculate

mat_unblocker

? mat_unblocker;

Calculate

mat_unblocker-matrix

A : matrix ([1, 2], [...

...

...

Calculate

mat_unblocker

Run Example
(%i1)/*	Eileen M. Dioquino	2010-36416	exer 8: Gauss Jordan*//*	Given Equations*/	eq[1]: [3*x1 + 4*x2 + 5*x3 - 2*x4 - 4*x5 = 10];
(%o1)              [- 4 x5 - 2 x4 + 5 x3 + 4 x2 + 3 x1 = 10]
(%i2) 	eq[2]: [-2*x1 - 3*x2 + 4*x3 - 3*x4 + 5*x5 = 8];
(%o2)               [5 x5 - 3 x4 + 4 x3 - 3 x2 - 2 x1 = 8]
(%i3) 	eq[3]: [4*x1 + 2*x2 + 6*x3 - 2*x4 - 5*x5 = 6];
(%o3)              [- 5 x5 - 2 x4 + 6 x3 + 2 x2 + 4 x1 = 6]
(%i4) 	eq[4]: [6*x1 + 2*x2 + 8*x3 - x4 - x5 = 9];
(%o4)                [- x5 - x4 + 8 x3 + 2 x2 + 6 x1 = 9]
(%i5) 	eq[5]: [5*x1 + 3*x2 + 7*x3 + 9*x4 + x5 = 0];
(%o5)                [x5 + 9 x4 + 7 x3 + 3 x2 + 5 x1 = 0]
(%i6) /*	Loop for getting the augmented coeffient matrix of each equations*/	for i: 1 step 1 while i <
 6 do(    		display(M[i]: augcoefmatrix (eq[i], [x1, x2, x3, x4, x5]))	);
                       M  = [ 3  4  5  - 2  - 4  - 10 ]
                        1

                       M  = [ - 2  - 3  4  - 3  5  - 8 ]
                        2

                        M  = [ 4  2  6  - 2  - 5  - 6 ]
                         3

                        M  = [ 6  2  8  - 1  - 1  - 9 ]
                         4

                           M  = [ 5  3  7  9  1  0 ]
                            5

(%o6)                                done
(%i7) /*	Combine matrices to form the main one*/	A: matrix ([M[1]], [M[2]], [M[3]], [M[4]], [M[5]]);
                       [ [ 3  4  5  - 2  - 4  - 10 ]  ]
                       [                              ]
                       [ [ - 2  - 3  4  - 3  5  - 8 ] ]
                       [                              ]
(%o7)                  [  [ 4  2  6  - 2  - 5  - 6 ]  ]
                       [                              ]
                       [  [ 6  2  8  - 1  - 1  - 9 ]  ]
                       [                              ]
                       [     [ 5  3  7  9  1  0 ]     ]
(%i8) 	B: mat_unblocker (A);
                        [  3    4   5  - 2  - 4  - 10 ]
                        [                             ]
                        [ - 2  - 3  4  - 3   5   - 8  ]
                        [                             ]
(%o8)                   [  4    2   6  - 2  - 5  - 6  ]
                        [                             ]
                        [  6    2   8  - 1  - 1  - 9  ]
                        [                             ]
                        [  5    3   7   9    1    0   ]
(%i9) /*	Compare first row elements for first pivoting*/	a: B[1][1];
(%o9)                                  3
(%i10) 	b: B[2][1];
(%o10)                                - 2
(%i11) 	c: B[3][1];
(%o11)                                 4
(%i12) 	d: B[4][1];
(%o12)                                 6
(%i13) 	e: B[5][1];
(%o13)                                 5
(%i14) 	PE: max(a,b,c,d,e);
(%o14)                                 6
(%i15) 	/*get the row number of PE*/	C : rowswap (B, 1, 4);
                        [  6    2   8  - 1  - 1  - 9  ]
                        [                             ]
                        [ - 2  - 3  4  - 3   5   - 8  ]
                        [                             ]
(%o15)                  [  4    2   6  - 2  - 5  - 6  ]
                        [                             ]
                        [  3    4   5  - 2  - 4  - 10 ]
                        [                             ]
                        [  5    3   7   9    1    0   ]
(%i16) 	display(C);
                          [  6    2   8  - 1  - 1  - 9  ]
                          [                             ]
                          [ - 2  - 3  4  - 3   5   - 8  ]
                          [                             ]
                      C = [  4    2   6  - 2  - 5  - 6  ]
                          [                             ]
                          [  3    4   5  - 2  - 4  - 10 ]
                          [                             ]
                          [  5    3   7   9    1    0   ]

(%o16)                               done
(%i17) 	/*normalize matrix*/	for i: 1 step 1 while i <
 6 do(	C[1][i]: C[1][i]/PE	);
(%o17)                               done
(%i18) 	display(C);
                          [       1   4    1    1       ]
                          [  1    -   -  - -  - -  - 9  ]
                          [       3   3    6    6       ]
                          [                             ]
                          [ - 2  - 3  4  - 3   5   - 8  ]
                      C = [                             ]
                          [  4    2   6  - 2  - 5  - 6  ]
                          [                             ]
                          [  3    4   5  - 2  - 4  - 10 ]
                          [                             ]
                          [  5    3   7   9    1    0   ]

(%o18)                               done
(%i19) 
Run Example
kill(all);
(%o0)                                done
(%i1) depend(x_1,s);
(%o1)                           depend(x_1, s)
(%i2) depend(x_2,s);
(%o2)                           depend(x_2, s)
(%i3) M: matrix([m_1, 0],[0, m_2]);
                                 [ m_1   0  ]
(%o3)                            [          ]
                                 [  0   m_2 ]
(%i4) C: matrix([c_1+c_2, -c_2],[-c_2, c_2]);
                             [ c_2 + c_1  - c_2 ]
(%o4)                        [                  ]
                             [   - c_2     c_2  ]
(%i5) K: matrix([k_1+k_2, -k_2],[-k_2, k_2]);
                             [ k_2 + k_1  - k_2 ]
(%o5)                        [                  ]
                             [   - k_2     k_2  ]
(%i6) F: matrix([F_1(s)],[F_2(s)]);
                                  [ F_1(s) ]
(%o6)                             [        ]
                                  [ F_2(s) ]
(%i7) X: matrix([x_1(s)],[x_2(s)]);
                                  [ x_1(s) ]
(%o7)                             [        ]
                                  [ x_2(s) ]
(%i8) dotdistrib: true;
(%o8)                                true
(%i9) eqn: F = M.(s^2*X) + C.(s*X) + K.X;
      [ F_1(s) ]                                              2
(%o9) [        ] = matrix([- c_2 s x_2(s) - k_2 x_2(s) + m_1 s  x_1(s)
      [ F_2(s) ]
 + (c_2 + c_1) s x_1(s) + (k_2 + k_1) x_1(s)], 
      2
[m_2 s  x_2(s) + c_2 s x_2(s) + k_2 x_2(s) - c_2 s x_1(s) - k_2 x_1(s)])
(%i10) Z: mat_unblocker(matrix([coeff(rhs(eqn),x_1(s)), coeff(rhs(eqn),x_2(s))]));
         [      2                                                   ]
         [ m_1 s  + (c_2 + c_1) s + k_2 + k_1     - c_2 s - k_2     ]
(%o10)   [                                                          ]
         [                                          2               ]
         [           - c_2 s - k_2             m_2 s  + c_2 s + k_2 ]
(%i11) H: invert(Z);
                     2                       2
(%o11) matrix([(m_2 s  + c_2 s + k_2)/((m_1 s  + (c_2 + c_1) s + k_2 + k_1)
       2
 (m_2 s  + c_2 s + k_2) + (- c_2 s - k_2) (c_2 s + k_2)), 
                     2                                    2
(c_2 s + k_2)/((m_1 s  + (c_2 + c_1) s + k_2 + k_1) (m_2 s  + c_2 s + k_2)
 + (- c_2 s - k_2) (c_2 s + k_2))], [(c_2 s + k_2)
        2                                    2
/((m_1 s  + (c_2 + c_1) s + k_2 + k_1) (m_2 s  + c_2 s + k_2)
                                         2
 + (- c_2 s - k_2) (c_2 s + k_2)), (m_1 s  + (c_2 + c_1) s + k_2 + k_1)
        2                                    2
/((m_1 s  + (c_2 + c_1) s + k_2 + k_1) (m_2 s  + c_2 s + k_2)
 + (- c_2 s - k_2) (c_2 s + k_2))])
(%i12) N: adjoint(Z);
         [      2                                                   ]
         [ m_2 s  + c_2 s + k_2             c_2 s + k_2             ]
(%o12)   [                                                          ]
         [                            2                             ]
         [     c_2 s + k_2       m_1 s  + (c_2 + c_1) s + k_2 + k_1 ]
(%i13) d: determinant(Z);
             2                                    2
(%o13) (m_1 s  + (c_2 + c_1) s + k_2 + k_1) (m_2 s  + c_2 s + k_2)
                                                                              2
                                                             - (- c_2 s - k_2)
(%i14) 
Run Example
eq[1]: [3*v + 4*w + 5*x - 2*y - 4*z = 10];
(%o1)                [- 4 z - 2 y + 5 x + 4 w + 3 v = 10]
(%i2) eq[2]: [-2*v - 3*w + 4*x - 3*y + 5*z = 8];
(%o2)                  [5 z - 3 y + 4 x - 3 w - 2 v = 8]
(%i3) eq[3]: [4*v + 2*w + 6*x - 2*y - 5*z = 6];
(%o3)                 [- 5 z - 2 y + 6 x + 2 w + 4 v = 6]
(%i4) eq[4]: [6*v + 2*w + 8*x - y - z = 9];
(%o4)                   [- z - y + 8 x + 2 w + 6 v = 9]
(%i5) eq[5]: [5*v + 3*w + 7*x + 9*y + z = 0];
(%o5)                   [z + 9 y + 7 x + 3 w + 5 v = 0]
(%i6) for i:1 step 1 while i<
6 do(    display(M[i]: augcoefmatrix (eq[i], [v, w, x, y, z])));
                       M  = [ 3  4  5  - 2  - 4  - 10 ]
                        1

                       M  = [ - 2  - 3  4  - 3  5  - 8 ]
                        2

                        M  = [ 4  2  6  - 2  - 5  - 6 ]
                         3

                        M  = [ 6  2  8  - 1  - 1  - 9 ]
                         4

                           M  = [ 5  3  7  9  1  0 ]
                            5

(%o6)                                done
(%i7) A: matrix ([M[1]], [M[2]], [M[3]], [M[4]], [M[5]]);
                       [ [ 3  4  5  - 2  - 4  - 10 ]  ]
                       [                              ]
                       [ [ - 2  - 3  4  - 3  5  - 8 ] ]
                       [                              ]
(%o7)                  [  [ 4  2  6  - 2  - 5  - 6 ]  ]
                       [                              ]
                       [  [ 6  2  8  - 1  - 1  - 9 ]  ]
                       [                              ]
                       [     [ 5  3  7  9  1  0 ]     ]
(%i8) B: mat_unblocker (A);
                        [  3    4   5  - 2  - 4  - 10 ]
                        [                             ]
                        [ - 2  - 3  4  - 3   5   - 8  ]
                        [                             ]
(%o8)                   [  4    2   6  - 2  - 5  - 6  ]
                        [                             ]
                        [  6    2   8  - 1  - 1  - 9  ]
                        [                             ]
                        [  5    3   7   9    1    0   ]
(%i9) a: B[1][1];
(%o9)                                  3
(%i10) b: B[2][1];
(%o10)                                - 2
(%i11) PE: max(a,b);
(%o11)                                 3
(%i12) if b >
 a then C : rowswap (B, 1, 2)    else C: B;
                        [  3    4   5  - 2  - 4  - 10 ]
                        [                             ]
                        [ - 2  - 3  4  - 3   5   - 8  ]
                        [                             ]
(%o12)                  [  4    2   6  - 2  - 5  - 6  ]
                        [                             ]
                        [  6    2   8  - 1  - 1  - 9  ]
                        [                             ]
                        [  5    3   7   9    1    0   ]
(%i13) D: ptriangularize (C, z);
                     [ 3   4    5    - 2    - 4    - 10  ]
                     [                                   ]
                     [      1   22     13    7       44  ]
                     [ 0  - -   --   - --    -     - --  ]
                     [      3   3      3     3       3   ]
                     [                                   ]
                     [ 0   0   - 74   44    - 23    154  ]
(%o13)               [                                   ]
                     [                49    246      143 ]
                     [ 0   0    0     --    ---    - --- ]
                     [                37    37       37  ]
                     [                                   ]
                     [                       2399  1968  ]
                     [ 0   0    0     0    - ----  ----  ]
                     [                        49    49   ]
(%i14) for i : 1 step 1 while i <
 6 do(	display(		j:D[i][1],		k:D[i][2],		l:D[i][3],		m:D[i][4],		eq[i]: (j*v + k*w + l*x + m*y + n*z = o)			)		);
                                     j = 3

                                     k = 4

                                     l = 5

                                    m = - 2

                        n z - 2 y + 5 x + 4 w + 3 v = o

                                     j = 0

                                          1
                                    k = - -
                                          3

                                        22
                                    l = --
                                        3

                                         13
                                   m = - --
                                         3

                                 13 y   22 x   w
                           n z - ---- + ---- - - = o
                                  3      3     3

                                     j = 0

                                     k = 0

                                   l = - 74

                                    m = 44

                             n z + 44 y - 74 x = o

                                     j = 0

                                     k = 0

                                     l = 0

                                        49
                                    m = --
                                        37

                                      49 y
                                n z + ---- = o
                                       37

                                     j = 0

                                     k = 0

                                     l = 0

                                     m = 0

                                    n z = o

(%o14)                               done
(%i15) 

Related Help

Help for Mat_unblocker