Sponsored links: Algebra eBooks
 

Related

ptriangularize

? ptriangularize;

Calculate

ptriangularize

? ptriangularize;

Calculate

ptriangularize

Run Example
(%i1)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) 
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],                n:D[i][5],                o:D[i][6],		eq[i]: (j*v + k*w + l*x + m*y + n*z = o)			)		);
                                     j = 3

                                     k = 4

                                     l = 5

                                    m = - 2

                                    n = - 4

                                   o = - 10

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

                                     j = 0

                                          1
                                    k = - -
                                          3

                                        22
                                    l = --
                                        3

                                         13
                                   m = - --
                                         3

                                         7
                                     n = -
                                         3

                                         44
                                   o = - --
                                         3

                         7 z   13 y   22 x   w     44
                         --- - ---- + ---- - - = - --
                          3     3      3     3     3

                                     j = 0

                                     k = 0

                                   l = - 74

                                    m = 44

                                   n = - 23

                                    o = 154

                          - 23 z + 44 y - 74 x = 154

                                     j = 0

                                     k = 0

                                     l = 0

                                        49
                                    m = --
                                        37

                                        246
                                    n = ---
                                        37

                                         143
                                   o = - ---
                                         37

                             246 z   49 y     143
                             ----- + ---- = - ---
                              37      37      37

                                     j = 0

                                     k = 0

                                     l = 0

                                     m = 0

                                        2399
                                  n = - ----
                                         49

                                       1968
                                   o = ----
                                        49

                                  2399 z   1968
                                - ------ = ----
                                    49      49

(%o14)                               done
(%i15) 
Run Example
eq[1]: [y + z = 2];
(%o1)                             [z + y = 2]
(%i2) eq[2]: [2*x + 3*z = 5];
(%o2)                           [3 z + 2 x = 5]
(%i3) eq[3]: [x + y +z = 3];
(%o3)                           [z + y + x = 3]
(%i4) M1: augcoefmatrix (eq[1], [x, y, z]);
(%o4)                          [ 0  1  1  - 2 ]
(%i5) M2: augcoefmatrix (eq[2], [x, y, z]);
(%o5)                          [ 2  0  3  - 5 ]
(%i6) M3: augcoefmatrix (eq[3], [x, y, z]);
(%o6)                          [ 1  1  1  - 3 ]
(%i7) A: matrix ([M1],[M2],[M3]);
                             [ [ 0  1  1  - 2 ] ]
                             [                  ]
(%o7)                        [ [ 2  0  3  - 5 ] ]
                             [                  ]
                             [ [ 1  1  1  - 3 ] ]
(%i8) B: mat_unblocker (A);
                               [ 0  1  1  - 2 ]
                               [              ]
(%o8)                          [ 2  0  3  - 5 ]
                               [              ]
                               [ 1  1  1  - 3 ]
(%i9) a: B[1][1];
(%o9)                                  0
(%i10) b: B[2][1];
(%o10)                                 2
(%i11) PE: max(a,b);
(%o11)                                 2
(%i12) if b >
 a then C : rowswap (B, 1, 2);
                               [ 2  0  3  - 5 ]
                               [              ]
(%o12)                         [ 0  1  1  - 2 ]
                               [              ]
                               [ 1  1  1  - 3 ]
(%i13) D: ptriangularize (C, z);
                              [ 2  0   3   - 5 ]
                              [                ]
                              [ 0  1   1   - 2 ]
(%o13)                        [                ]
                              [         3   3  ]
                              [ 0  0  - -   -  ]
                              [         2   2  ]
(%i14) for i : 1 step (i + 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*x + k*y + l*z = m)));
                                     j = 2

                                     k = 0

                                     l = 3

                                    m = - 5

                                3 z + 2 x = - 5

                                     j = 0

                                     k = 0

                                          3
                                    l = - -
                                          2

                                         3
                                     m = -
                                         2

                                     3 z   3
                                   - --- = -
                                      2    2

(%o14)                               done
(%i15) display(j:D[2][1],k:D[2][2],l:D[2][3],m:D[2][4],eq[2]: (j*x + k*y + l*z = m));
                                     j = 0

                                     k = 1

                                     l = 1

                                    m = - 2

                                  z + y = - 2

(%o15)                               done
(%i16) display(eq[1]);
                                3 z + 2 x = - 5

(%o16)                               done
(%i17) display(eq[2]);
                                  z + y = - 2

(%o17)                               done
(%i18) display(eq[3]);
                                     3 z   3
                                   - --- = -
                                      2    2

(%o18)                               done
(%i19) F: eliminate([eq[1], eq[2], eq[3]], [x,y]);
(%o19)                           [- 3 (z + 1)]
(%i20) z: solve(F, z);
(%o20)                             [z = - 1]
(%i21) y: solve(eq[2], y);
(%o21)                           [y = - z - 2]
(%i22) x: solve(eq[1], x);
                                       3 z + 5
(%o22)                          [x = - -------]
                                          2
(%i23) 

Related Help

Help for Ptriangularize