Processing math: 100%

Table of Contents

Sub

Matrix.Sub(M,n) takes a Matrix M and returns the upper left submatrix of size n×n.

Matrix.Sub(M,r,c) takes a Matrix M and returns the upper left submatrix of size r×c.

Matrix.Sub(M, r0, r, c0, c) takes a Matrix M and returns a submatrix of size r×c, where the 1,1 element of the new matrix coincides with the r0,c0 element of M. Note that in this case the first entry of a row or a column is indexed 1, not 0.

Example

Input

Example.Quanty
M = {{11,12,13,14,15,16,17},
     {21,22,23,24,25,26,27},
     {31,32,33,34,35,36,37},
     {41,42,43,44,45,46,47},
     {51,52,53,54,55,56,57}}
 
print("")
print("Matrix.Sub(M,3)")
print(Matrix.Sub(M,3))
 
print("")
print("Matrix.Sub(M,2,4)")
print(Matrix.Sub(M,2,4))
 
print("")
print("Matrix.Sub(M,1,2,3,4)")
print(Matrix.Sub(M,1,2,3,4))

Result

Matrix.Sub(M,3)
{ { 11 , 12 , 13 } , 
  { 21 , 22 , 23 } , 
  { 31 , 32 , 33 } }
 
Matrix.Sub(M,2,4)
{ { 11 , 12 , 13 , 14 } , 
  { 21 , 22 , 23 , 24 } }
 
Matrix.Sub(M,1,2,3,4)
{ { 13 , 14 , 15 , 16 } , 
  { 23 , 24 , 25 , 26 } }

Table of contents

Print/export