Sponsored links: Algebra eBooks
 

Related

locate_matrix_entry

? locate_matrix_entry;

Calculate

locate_matrix_entry

? locate_matrix_entry ;

Calculate

locate_matrix_entry

? locate_matrix_entry;

Calculate

locate_matrix_entry

? locate_matrix_entry ;

Calculate

locate_matrix_entry

Run Example
(%i1)? locate_matrix_entry ;

 -- Function: locate_matrix_entry (<M>, <r_1>, <c_1>, <r_2>, <c_2>,
          <f>, <rel>)
     The first argument must be a matrix; the arguments <r_1> through
     <c_2> determine a sub-matrix of <M> that consists of rows <r_1>
     through <r_2> and columns <c_1> through <c_2>.

     Find a entry in the sub-matrix <M> that satisfies some property.
     Three cases:

     (1) `<rel> = 'bool' and <f> a predicate:

     Scan the sub-matrix from left to right then top to bottom, and
     return the index of the first entry that satisfies the predicate
     <f>. If no matrix entry satisfies <f>, return `false'.

     (2) `<rel> = 'max' and <f> real-valued:

     Scan the sub-matrix looking for an entry that maximizes <f>.
     Return the index of a maximizing entry.

     (3) `<rel> = 'min' and <f> real-valued:

     Scan the sub-matrix looking for an entry that minimizes <f>.
     Return the index of a minimizing entry.


(%o1)                                true
(%i2) 
Run Example
eq1: [y + z = 2];
(%o1)                             [z + y = 2]
(%i2) eq2: [2*x + 3*z = 5];
(%o2)                           [3 z + 2 x = 5]
(%i3) eq3: [x + y +z = 3];
(%o3)                           [z + y + x = 3]
(%i4) M1: augcoefmatrix (eq1, [x, y, z]);
(%o4)                          [ 0  1  1  - 2 ]
(%i5) M2: augcoefmatrix (eq2, [x, y, z]);
(%o5)                          [ 2  0  3  - 5 ]
(%i6) M3: augcoefmatrix (eq3, [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) PE: locate_matrix_entry (B, 1, 1, 2, 4, f, 'min);
(%o9)                               [1, 1]
(%i10) 
Run Example
eq1: [y + z = 2];
(%o1)                             [z + y = 2]
(%i2) eq2: [2*x + 3*z = 5];
(%o2)                           [3 z + 2 x = 5]
(%i3) eq3: [x + y +z = 3];
(%o3)                           [z + y + x = 3]
(%i4) M1: augcoefmatrix (eq1, [x, y, z]);
(%o4)                          [ 0  1  1  - 2 ]
(%i5) M2: augcoefmatrix (eq2, [x, y, z]);
(%o5)                          [ 2  0  3  - 5 ]
(%i6) M3: augcoefmatrix (eq3, [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) PE: locate_matrix_entry (B, 1, 1, 2, 4, f, 'max);
(%o9)                               [1, 1]
(%i10) 

Related Help

Help for Locate_matrix_entry