The following code will prepare a list of two by two matrices over Z_2 and will show the group multiplication in it. Copy paste the code to a SageMath cell and try! But remember, the spacing can be a problem for the *for *loops.

If you have some problem in copy pasting, please see the code hosted at this SageMath cell server page:

########## Code begins ###############
modulo = 2
#Initialize the ring
R = IntegerModRing(modulo)
# Make a list of cartesian products. These will be the rows for the 2 by 2 matrices
cp = [list(a) for a in cartesian_product([R, R])]
# Do you want to check what this cp is?
#show ("The list of rows : ",cp)
m2by2 = []
# Form the matrices by taking two elements from cp at a time
for i in range(0,len(cp)):
for j in range(0,len(cp)):
m2by2.append(matrix(R,[cp[i],cp[j]]))
# If you want to confirm the 2 by 2 matrices, then (memory consuming, may hang Sage)
#show(m2by2)
#The multiplication
#To avoid truncating of output
#html('<!--notruncate-->')
for i in range(0,len(m2by2)):
for j in range(0,len(m2by2)):
prod = m2by2[i]*m2by2[j]
show( m2by2[i],'*',m2by2[j],'=',prod)
########## Code ends ###############

### Like this:

Like Loading...

## Published by Vishnu Namboothiri K

A Mathematics teacher working in Government College(s!) in Kerala.
View all posts by Vishnu Namboothiri K