To and from matrices:
i1 : m = matrix{{1,2,3},{4,5,6}}
o1 = | 1 2 3 |
| 4 5 6 |
2 3
o1 : Matrix ZZ <--- ZZ
|
i2 : n = mutableMatrix m
o2 = | 1 2 3 |
| 4 5 6 |
o2 : MutableMatrix
|
i3 : m2 = matrix n
o3 = | 1 2 3 |
| 4 5 6 |
2 3
o3 : Matrix ZZ <--- ZZ
|
i4 : m2 - m == 0
o4 = true
|
Modifying and accessing entries. Remember that the upper left entry is (0,0), not (1,1)!
i5 : n_(0,0) = 212314323
o5 = 212314323
|
i6 : n_(0,0)
o6 = 212314323
|
i7 : n
o7 = | 212314323 2 3 |
| 4 5 6 |
o7 : MutableMatrix
|
Number of rows, columns, and the ring:
i8 : numrows n
o8 = 2
|
i9 : numColumns n
o9 = 3
|
i10 : numcols n
o10 = 3
|
i11 : ring n
o11 = ZZ
o11 : Ring
|
row and column operations
Some other methods for creating mutable matrices.
i12 : mutableIdentity(RR_100,5)
o12 = | 1 0 0 0 0 |
| 0 1 0 0 0 |
| 0 0 1 0 0 |
| 0 0 0 1 0 |
| 0 0 0 0 1 |
o12 : MutableMatrix
|
i13 : mutableMatrix(QQ,3,5)
o13 = 0
o13 : MutableMatrix
|
i14 : randomMutableMatrix(4,4,.5,100)
o14 = | -35 0 0 0 |
| 100 0 0 0 |
| 0 0 82 18 |
| -14 0 0 -98 |
o14 : MutableMatrix
|