{{indexmenu_n>999}} ====== Sub ====== ### Matrix.Sub($M$,$n$) takes a Matrix $M$ and returns the upper left submatrix of size $n\times n$. Matrix.Sub($M$,$r$,$c$) takes a Matrix $M$ and returns the upper left submatrix of size $r \times c$. Matrix.Sub($M$, $r_0$, $r$, $c_0$, $c$) takes a Matrix $M$ and returns a submatrix of size $r \times c$, where the $1,1$ element of the new matrix coincides with the $r_0,c_0$ element of $M$. Note that in this case the first entry of a row or a column is indexed $1$, not $0$. ### ===== Example ===== ==== Input ==== 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 ===== {{indexmenu>.#1|msort}}