Sponsored links: Algebra eBooks
 

Related

augcoefmatrix-if-while

a(x1,x2,x3):= 15*x1 +...

b(x1,x2,x3):= 4*x1 - ...

c(x1,x2,x3):= x1 + 2*...

Calculate

augcoefmatrix

m: [2*x - (a - 2)*y =...

augcoefmatrix (m, [x...

Calculate

augcoefmatrix-mat_unblocker

eq1: [y + z = 2];

eq2: [2*x + 3*z = 5];

eq3: [x + y +z = 3];

Calculate

augcoefmatrix-is-rowswap

Sis:[a*x+y+z=1, x+a*y...

Sis:augcoefmatrix(Si...

Sis:rowswap(Sis,1,2);

Calculate

augcoefmatrix-display-do-mat_unblocker-max-ptriangularize-rowswap

eq[1]: [3*v + 4*w + 5...

eq[2]: [-2*v - 3*w + ...

eq[3]: [4*v + 2*w + 6...

Calculate

augcoefmatrix-col-mat_unblocker

eq1: [y + z = 2];

eq2: [2*x + 3*z = 5];

eq3: [x + y +z = 3];

Calculate

augcoefmatrix-display-do-mat_unblocker-max-ptriangularize-rowswap

eq[1]: [3*v + 4*w + 5...

eq[2]: [-2*v - 3*w + ...

eq[3]: [4*v + 2*w + 6...

Calculate

augcoefmatrix-display-do-eliminate-mat_unblocker-max-ptriangularize-rowswap-solve

eq[1]: [y + z = 2];

eq[2]: [2*x + 3*z = 5];

eq[3]: [x + y +z = 3];

Calculate

augcoefmatrix-coefmatrix-col-load-matrix-simpsum-sum

load(linearalgebra);

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

N : matrix ([-1,3], [...

Calculate

augcoefmatrix

Run Example
(%i1)p: c[1]*x+c[0];
(%o1)                              c  x + c
                                    1      0
(%i2) l1: [0,1,2,3];
(%o2)                            [0, 1, 2, 3]
(%i3) l2: [0,1,3,2];
(%o3)                            [0, 1, 3, 2]
(%i4) eqlist: makelist(subst([x=l1[ii]],p)-l2[ii],ii,1,4);
(%o4)           [c , c  + c  - 1, 2 c  + c  - 3, 3 c  + c  - 2]
                  0   1    0         1    0         1    0
(%i5) m: augcoefmatrix(eqlist,[c[0],c[1]]);
                                 [ 1  0   0  ]
                                 [           ]
                                 [ 1  1  - 1 ]
(%o5)                            [           ]
                                 [ 1  2  - 3 ]
                                 [           ]
                                 [ 1  3  - 2 ]
(%i6) m: triangularize(m);
                                 [ 1  0   0  ]
                                 [           ]
                                 [ 0  1  - 1 ]
(%o6)                            [           ]
                                 [ 0  0  - 1 ]
                                 [           ]
                                 [ 0  0   0  ]
(%i7) 
Run Example
sphere_error:(x[i]-a)^2 + (y[i]-b)^2 + (z[i]-c)^2 - r2;
                                  2           2           2
(%o1)              - r2 + (z  - c)  + (y  - b)  + (x  - a)
                            i           i           i
(%i2) sphere_error_square:sphere_error^2;
                                  2           2           2 2
(%o2)             (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
                            i           i           i
(%i3) declare(sum,linear);
(%o3)                                done
(%i4) sphere_error_sum:sum(sphere_error_square, i, 1, n);
                n
               ====
               \                     2           2           2 2
(%o4)           >    (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
               /               i           i           i
               ====
               i = 1
(%i5) sphere_da: diff(sphere_error_sum, a);
              n
             ====
             \                              2           2           2
(%o5)    - 4  >    (x  - a) (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
             /       i                i           i           i
             ====
             i = 1
(%i6) sphere_db: diff(sphere_error_sum, b);
              n
             ====
             \                              2           2           2
(%o6)    - 4  >    (y  - b) (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
             /       i                i           i           i
             ====
             i = 1
(%i7) sphere_dc: diff(sphere_error_sum, c);
              n
             ====
             \                              2           2           2
(%o7)    - 4  >    (z  - c) (- r2 + (z  - c)  + (y  - b)  + (x  - a) )
             /       i                i           i           i
             ====
             i = 1
(%i8) sphere_dr2: diff(sphere_error_sum, r2);
                     n                 n                 n
                    ====              ====              ====
                    \             2   \             2   \             2
(%o8) - 2 (- n r2 +  >    (z  - c)  +  >    (y  - b)  +  >    (x  - a) )
                    /       i         /       i         /       i
                    ====              ====              ====
                    i = 1             i = 1             i = 1
(%i9) sphere_da_exp: expand(sphere_da=0);
                       n
                      ====
                      \                   2          2        3
(%o9) - 4 a n r2 + 4 ( >    x ) r2 + 4 a c  n + 4 a b  n + 4 a  n
                      /      i
                      ====
                      i = 1
      n                 n              n                   n
     ====              ====           ====                ====
     \         2       \      2       \                   \
 - 4  >    x  z  + 4 a  >    z  + 8 c  >    x  z  - 8 a c  >    z
     /      i  i       /      i       /      i  i         /      i
     ====              ====           ====                ====
     i = 1             i = 1          i = 1               i = 1
      n                 n              n                   n            n
     ====              ====           ====                ====         ====
     \         2       \      2       \                   \            \      3
 - 4  >    x  y  + 4 a  >    y  + 8 b  >    x  y  - 8 a b  >    y  - 4  >    x
     /      i  i       /      i       /      i  i         /      i     /      i
     ====              ====           ====                ====         ====
     i = 1             i = 1          i = 1               i = 1        i = 1
         n               n               n                n
        ====            ====            ====             ====
        \      2      2 \             2 \              2 \
 + 12 a  >    x  - 4 c   >    x  - 4 b   >    x  - 12 a   >    x  = 0
        /      i        /      i        /      i         /      i
        ====            ====            ====             ====
        i = 1           i = 1           i = 1            i = 1
(%i10) sphere_db_exp: expand(sphere_db=0);
                        n
                       ====
                       \                   2        3        2
(%o10) - 4 b n r2 + 4 ( >    y ) r2 + 4 b c  n + 4 b  n + 4 a  b n
                       /      i
                       ====
                       i = 1
      n                 n              n                   n            n
     ====              ====           ====                ====         ====
     \         2       \      2       \                   \            \      3
 - 4  >    y  z  + 4 b  >    z  + 8 c  >    y  z  - 8 b c  >    z  - 4  >    y
     /      i  i       /      i       /      i  i         /      i     /      i
     ====              ====           ====                ====         ====
     i = 1             i = 1          i = 1               i = 1        i = 1
         n            n                 n                  n
        ====         ====              ====               ====
        \      2     \      2          \                2 \
 + 12 b  >    y  - 4  >    x  y  + 8 a  >    x  y  - 4 c   >    y
        /      i     /      i  i       /      i  i        /      i
        ====         ====              ====               ====
        i = 1        i = 1             i = 1              i = 1
          n               n              n                n
         ====            ====           ====             ====
       2 \             2 \              \      2         \
 - 12 b   >    y  - 4 a   >    y  + 4 b  >    x  - 8 a b  >    x  = 0
         /      i        /      i       /      i         /      i
         ====            ====           ====             ====
         i = 1           i = 1          i = 1            i = 1
(%i11) sphere_dc_exp: expand(sphere_dc=0);
                        n                                               n
                       ====                                            ====
                       \                 3        2          2         \      3
(%o11) - 4 c n r2 + 4 ( >    z ) r2 + 4 c  n + 4 b  c n + 4 a  c n - 4  >    z
                       /      i                                        /      i
                       ====                                            ====
                       i = 1                                           i = 1
         n            n                 n               n
        ====         ====              ====            ====
        \      2     \      2          \               \      2
 + 12 c  >    z  - 4  >    y  z  + 8 b  >    y  z  - 4  >    x  z
        /      i     /      i  i       /      i  i     /      i  i
        ====         ====              ====            ====
        i = 1        i = 1             i = 1           i = 1
        n                   n               n               n
       ====                ====            ====            ====
       \                 2 \             2 \             2 \
 + 8 a  >    x  z  - 12 c   >    z  - 4 b   >    z  - 4 a   >    z
       /      i  i         /      i        /      i        /      i
       ====                ====            ====            ====
       i = 1               i = 1           i = 1           i = 1
        n                n              n                n
       ====             ====           ====             ====
       \      2         \              \      2         \
 + 4 c  >    y  - 8 b c  >    y  + 4 c  >    x  - 8 a c  >    x  = 0
       /      i         /      i       /      i         /      i
       ====             ====           ====             ====
       i = 1            i = 1          i = 1            i = 1
(%i12) augcoefmatrix([sphere_da_subst, sphere_db_subst, sphere_dc_subst], [a, b, c]);
                         [ 0  0  0  sphere_da_subst ]
                         [                          ]
(%o12)                   [ 0  0  0  sphere_db_subst ]
                         [                          ]
                         [ 0  0  0  sphere_dc_subst ]
(%i13) 
Run Example
/*	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) 

Related Help

Help for Augcoefmatrix