CoCalc Public Filesmatrix-finite-ring.sagewsOpen with one click!
Authors: harald @schil.ly, Testing CoCalc, Harald Schilly, Harald Schilly, HaraldTest SchillyTest, ℏal Snyder, William A. Stein
Views : 52
Compute Environment: Ubuntu 18.04 (Deprecated)

Matrix ring over finite ring

http://doc.sagemath.org/html/en/constructions/rings.html#matrix-rings

R = IntegerModRing(10) R
Ring of integers modulo 10
M = MatrixSpace(R, 4, 4) M
Full MatrixSpace of 4 by 4 dense matrices over Ring of integers modulo 10

notice, that 99 ends up being 9

m = M([[1, 2, 3, 4], [4, 1,99, 1], [0, 8, 1, 8], [0, 0, 1, 2]]) m
[1 2 3 4] [4 1 9 1] [0 8 1 8] [0 0 1 2]
m - 1
[0 2 3 4] [4 0 9 1] [0 8 0 8] [0 0 1 1]
m + m
[2 4 6 8] [8 2 8 2] [0 6 2 6] [0 0 2 4]
m * m
[9 8 8 8] [8 1 1 1] [2 6 1 2] [0 8 3 2]
m^3
[1 0 5 4] [2 5 5 3] [6 8 3 6] [2 2 7 6]
M(1)
[1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1]
2 * m + 9 * M(1)
[1 4 6 8] [8 1 8 2] [0 6 1 6] [0 0 2 3]
m2 = m.apply_map(lambda x : 2*x + 1) m2
[3 5 7 9] [9 3 9 3] [1 7 3 7] [1 1 3 5]
m3 = 2 * m + M(1) - m2 m3
[0 9 9 9] [9 0 9 9] [9 9 0 9] [9 9 9 0]
m3.is_symmetric()
True