![[next]](next.gif)
![[previous]](previous.gif)
![[up]](up.gif)
![[top]](top.gif)
In previous sections we have learned various ways to make matrices. Now we discuss methods for manipulating matrices.
The principal way to extract a submatrix of a matrix is with submatrix.
i1 : R = ZZ/101[a .. o]; |
i2 : p = genericMatrix(R, a, 3, 5) |
i3 : submatrix(p,{1,2},{3,4}) |
A subset of columns can be extracted with _ and a subset of the rows can be extracted with ^.
i4 : p^{1,2} |
i5 : p_{3,4} |
Since ^ and _ have the same parsing precedence, and associate to the left by default, these operations can be combined without adding parentheses, giving a slower form of submatrix.
i6 : p^{1,2}_{3,4} |
i7 : p_{3,4}^{1,2} |
We can transpose a matrix.
i8 : transpose p |
We can test whether a matrix, regarded as a linear transformation, is injective or surfective.
i9 : isSurjective p |
i10 : isInjective p |
i11 : isInjective transpose p |
We can use diff to differentiate a matrix with respect to a variable and contract to contract.
i12 : q = matrix {{a^2,b^2,c^2},{a*b,b*c,a*c}} |
i13 : diff(a,q) |
i14 : contract(a,q) |
These operations have a meaning when the first argument is itself a polynomial, or even a matrix of polynomials.
i15 : r = matrix{{1,a,a^2,a^3}} |
i16 : diff(transpose r,r) |
i17 : contract(transpose r,r) |
For more information about matrices, see Matrix.
![[next]](next.gif)
![[previous]](previous.gif)
![[up]](up.gif)
![[top]](top.gif)