CoCalc Shared FilesPersonal / check.ipynb
Author: Peter Francis
Views : 9
In [38]:
def HighestEntry(Matrix):
List = sorted([Matrix[0,0],Matrix[0,1],Matrix[1,0],Matrix[1,1]])
return List[3]

def LowestEntry(Matrix):
List = sorted([Matrix[0,0],Matrix[0,1],Matrix[1,0],Matrix[1,1]])
return List[0]

In [46]:
count1 = 0
count2 = 0

for a in [-20..20]:
A_1 =  matrix(QQ,[[a+0,a+1],[a+2,a+3]])
A_2 =  matrix(QQ,[[a+0,a+1],[a+3,a+2]])
A_3 =  matrix(QQ,[[a+0,a+2],[a+1,a+3]])
A_4 =  matrix(QQ,[[a+0,a+2],[a+3,a+1]])
A_5 =  matrix(QQ,[[a+0,a+3],[a+1,a+2]])
A_6 =  matrix(QQ,[[a+0,a+3],[a+2,a+1]])
A_7 =  matrix(QQ,[[a+1,a+2],[a+3,a+0]])
A_8 =  matrix(QQ,[[a+1,a+2],[a+0,a+3]])
A_9 =  matrix(QQ,[[a+1,a+3],[a+2,a+0]])
A_10 = matrix(QQ,[[a+1,a+3],[a+0,a+2]])
A_11 = matrix(QQ,[[a+1,a+0],[a+2,a+3]])
A_12 = matrix(QQ,[[a+1,a+0],[a+3,a+2]])
A_13 = matrix(QQ,[[a+2,a+0],[a+1,a+3]])
A_14 = matrix(QQ,[[a+2,a+0],[a+3,a+1]])
A_15 = matrix(QQ,[[a+2,a+1],[a+0,a+3]])
A_16 = matrix(QQ,[[a+2,a+1],[a+3,a+0]])
A_17 = matrix(QQ,[[a+2,a+3],[a+1,a+0]])
A_18 = matrix(QQ,[[a+2,a+3],[a+0,a+1]])
A_19 = matrix(QQ,[[a+3,a+0],[a+2,a+1]])
A_20 = matrix(QQ,[[a+3,a+0],[a+1,a+2]])
A_21 = matrix(QQ,[[a+3,a+1],[a+2,a+0]])
A_22 = matrix(QQ,[[a+3,a+1],[a+0,a+2]])
A_23 = matrix(QQ,[[a+3,a+2],[a+1,a+0]])
A_24 = matrix(QQ,[[a+3,a+2],[a+0,a+1]])
A = [A_1,A_2,A_3,A_4,A_5,A_6,A_7,A_8,A_9,A_10,A_11,A_12,A_13,A_14,A_15,A_16,A_17,A_18,A_19,A_20,A_21,A_22,A_23,A_24]

for b in [-20..20]:
B_1 =  matrix(QQ,[[b+0,b+1],[b+2,b+3]])
B_2 =  matrix(QQ,[[b+0,b+1],[b+3,b+2]])
B_3 =  matrix(QQ,[[b+0,b+2],[b+1,b+3]])
B_4 =  matrix(QQ,[[b+0,b+2],[b+3,b+1]])
B_5 =  matrix(QQ,[[b+0,b+3],[b+1,b+2]])
B_6 =  matrix(QQ,[[b+0,b+3],[b+2,b+1]])
B_7 =  matrix(QQ,[[b+1,b+2],[b+3,b+0]])
B_8 =  matrix(QQ,[[b+1,b+2],[b+0,b+3]])
B_9 =  matrix(QQ,[[b+1,b+3],[b+2,b+0]])
B_10 = matrix(QQ,[[b+1,b+3],[b+0,b+2]])
B_11 = matrix(QQ,[[b+1,b+0],[b+2,b+3]])
B_12 = matrix(QQ,[[b+1,b+0],[b+3,b+2]])
B_13 = matrix(QQ,[[b+2,b+0],[b+1,b+3]])
B_14 = matrix(QQ,[[b+2,b+0],[b+3,b+1]])
B_15 = matrix(QQ,[[b+2,b+1],[b+0,b+3]])
B_16 = matrix(QQ,[[b+2,b+1],[b+3,b+0]])
B_17 = matrix(QQ,[[b+2,b+3],[b+1,b+0]])
B_18 = matrix(QQ,[[b+2,b+3],[b+0,b+1]])
B_19 = matrix(QQ,[[b+3,b+0],[b+2,b+1]])
B_20 = matrix(QQ,[[b+3,b+0],[b+1,b+2]])
B_21 = matrix(QQ,[[b+3,b+1],[b+2,b+0]])
B_22 = matrix(QQ,[[b+3,b+1],[b+0,b+2]])
B_23 = matrix(QQ,[[b+3,b+2],[b+1,b+0]])
B_24 = matrix(QQ,[[b+3,b+2],[b+0,b+1]])
B=[B_1,B_2,B_3,B_4,B_5,B_6,B_7,B_8,B_9,B_10,B_11,B_12,B_13,B_14,B_15,B_16,B_17,B_18,B_19,B_20,B_21,B_22,B_23,B_24]

for i in [0..23]:
for j in [0..23]:
C = A[i]*B[j]
C_List = sorted([C[0,0], C[0,1], C[1,0], C[1,1]])
count1 = count1 + 1
if (C_List[0] +1 == C_List[1]) and (C_List[1] +1 == C_List[2]) and (C_List[2] +1 == C_List[3]):
count2 = count2 + 1
show(count2,'.........',A[i],B[j],'=',C)

$1 \verb|.........| \left(\begin{array}{rr} -20 & -18 \\ -17 & -19 \end{array}\right) \left(\begin{array}{rr} -2 & -1 \\ -3 & -4 \end{array}\right) \verb|=| \left(\begin{array}{rr} 94 & 92 \\ 91 & 93 \end{array}\right)$
$2 \verb|.........| \left(\begin{array}{rr} -20 & -18 \\ -17 & -19 \end{array}\right) \left(\begin{array}{rr} -1 & -2 \\ -4 & -3 \end{array}\right) \verb|=| \left(\begin{array}{rr} 92 & 94 \\ 93 & 91 \end{array}\right)$
$3 \verb|.........| \left(\begin{array}{rr} -19 & -17 \\ -18 & -20 \end{array}\right) \left(\begin{array}{rr} -4 & -3 \\ -1 & -2 \end{array}\right) \verb|=| \left(\begin{array}{rr} 93 & 91 \\ 92 & 94 \end{array}\right)$
$4 \verb|.........| \left(\begin{array}{rr} -19 & -17 \\ -18 & -20 \end{array}\right) \left(\begin{array}{rr} -3 & -4 \\ -2 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 91 & 93 \\ 94 & 92 \end{array}\right)$
$5 \verb|.........| \left(\begin{array}{rr} -18 & -20 \\ -19 & -17 \end{array}\right) \left(\begin{array}{rr} -4 & -3 \\ -1 & -2 \end{array}\right) \verb|=| \left(\begin{array}{rr} 92 & 94 \\ 93 & 91 \end{array}\right)$
$6 \verb|.........| \left(\begin{array}{rr} -18 & -20 \\ -19 & -17 \end{array}\right) \left(\begin{array}{rr} -3 & -4 \\ -2 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 94 & 92 \\ 91 & 93 \end{array}\right)$
$7 \verb|.........| \left(\begin{array}{rr} -17 & -19 \\ -20 & -18 \end{array}\right) \left(\begin{array}{rr} -2 & -1 \\ -3 & -4 \end{array}\right) \verb|=| \left(\begin{array}{rr} 91 & 93 \\ 94 & 92 \end{array}\right)$
$8 \verb|.........| \left(\begin{array}{rr} -17 & -19 \\ -20 & -18 \end{array}\right) \left(\begin{array}{rr} -1 & -2 \\ -4 & -3 \end{array}\right) \verb|=| \left(\begin{array}{rr} 93 & 91 \\ 92 & 94 \end{array}\right)$
$9 \verb|.........| \left(\begin{array}{rr} -20 & -18 \\ -17 & -19 \end{array}\right) \left(\begin{array}{rr} -1 & 0 \\ -2 & -3 \end{array}\right) \verb|=| \left(\begin{array}{rr} 56 & 54 \\ 55 & 57 \end{array}\right)$
$10 \verb|.........| \left(\begin{array}{rr} -20 & -18 \\ -17 & -19 \end{array}\right) \left(\begin{array}{rr} 0 & -1 \\ -3 & -2 \end{array}\right) \verb|=| \left(\begin{array}{rr} 54 & 56 \\ 57 & 55 \end{array}\right)$
$11 \verb|.........| \left(\begin{array}{rr} -19 & -17 \\ -18 & -20 \end{array}\right) \left(\begin{array}{rr} -3 & -2 \\ 0 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 57 & 55 \\ 54 & 56 \end{array}\right)$
$12 \verb|.........| \left(\begin{array}{rr} -19 & -17 \\ -18 & -20 \end{array}\right) \left(\begin{array}{rr} -2 & -3 \\ -1 & 0 \end{array}\right) \verb|=| \left(\begin{array}{rr} 55 & 57 \\ 56 & 54 \end{array}\right)$
$13 \verb|.........| \left(\begin{array}{rr} -18 & -20 \\ -19 & -17 \end{array}\right) \left(\begin{array}{rr} -3 & -2 \\ 0 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 54 & 56 \\ 57 & 55 \end{array}\right)$
$14 \verb|.........| \left(\begin{array}{rr} -18 & -20 \\ -19 & -17 \end{array}\right) \left(\begin{array}{rr} -2 & -3 \\ -1 & 0 \end{array}\right) \verb|=| \left(\begin{array}{rr} 56 & 54 \\ 55 & 57 \end{array}\right)$
$15 \verb|.........| \left(\begin{array}{rr} -17 & -19 \\ -20 & -18 \end{array}\right) \left(\begin{array}{rr} -1 & 0 \\ -2 & -3 \end{array}\right) \verb|=| \left(\begin{array}{rr} 55 & 57 \\ 56 & 54 \end{array}\right)$
$16 \verb|.........| \left(\begin{array}{rr} -17 & -19 \\ -20 & -18 \end{array}\right) \left(\begin{array}{rr} 0 & -1 \\ -3 & -2 \end{array}\right) \verb|=| \left(\begin{array}{rr} 57 & 55 \\ 54 & 56 \end{array}\right)$
$17 \verb|.........| \left(\begin{array}{rr} -20 & -19 \\ -18 & -17 \end{array}\right) \left(\begin{array}{rr} -2 & -1 \\ 1 & 0 \end{array}\right) \verb|=| \left(\begin{array}{rr} 21 & 20 \\ 19 & 18 \end{array}\right)$
$18 \verb|.........| \left(\begin{array}{rr} -20 & -19 \\ -18 & -17 \end{array}\right) \left(\begin{array}{rr} -1 & -2 \\ 0 & 1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 20 & 21 \\ 18 & 19 \end{array}\right)$
$19 \verb|.........| \left(\begin{array}{rr} -20 & -19 \\ -18 & -17 \end{array}\right) \left(\begin{array}{rr} 0 & 1 \\ -1 & -2 \end{array}\right) \verb|=| \left(\begin{array}{rr} 19 & 18 \\ 17 & 16 \end{array}\right)$
$20 \verb|.........| \left(\begin{array}{rr} -20 & -19 \\ -18 & -17 \end{array}\right) \left(\begin{array}{rr} 1 & 0 \\ -2 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 18 & 19 \\ 16 & 17 \end{array}\right)$
$21 \verb|.........| \left(\begin{array}{rr} -20 & -19 \\ -17 & -18 \end{array}\right) \left(\begin{array}{rr} -1 & 1 \\ 0 & -2 \end{array}\right) \verb|=| \left(\begin{array}{rr} 20 & 18 \\ 17 & 19 \end{array}\right)$
$22 \verb|.........| \left(\begin{array}{rr} -20 & -19 \\ -17 & -18 \end{array}\right) \left(\begin{array}{rr} 1 & -1 \\ -2 & 0 \end{array}\right) \verb|=| \left(\begin{array}{rr} 18 & 20 \\ 19 & 17 \end{array}\right)$
$23 \verb|.........| \left(\begin{array}{rr} -20 & -18 \\ -19 & -17 \end{array}\right) \left(\begin{array}{rr} -2 & -1 \\ 1 & 0 \end{array}\right) \verb|=| \left(\begin{array}{rr} 22 & 20 \\ 21 & 19 \end{array}\right)$
$24 \verb|.........| \left(\begin{array}{rr} -20 & -18 \\ -19 & -17 \end{array}\right) \left(\begin{array}{rr} -1 & -2 \\ 0 & 1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 20 & 22 \\ 19 & 21 \end{array}\right)$
$25 \verb|.........| \left(\begin{array}{rr} -20 & -18 \\ -19 & -17 \end{array}\right) \left(\begin{array}{rr} 0 & 1 \\ -1 & -2 \end{array}\right) \verb|=| \left(\begin{array}{rr} 18 & 16 \\ 17 & 15 \end{array}\right)$
$26 \verb|.........| \left(\begin{array}{rr} -20 & -18 \\ -19 & -17 \end{array}\right) \left(\begin{array}{rr} 1 & 0 \\ -2 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 16 & 18 \\ 15 & 17 \end{array}\right)$
$27 \verb|.........| \left(\begin{array}{rr} -19 & -17 \\ -20 & -18 \end{array}\right) \left(\begin{array}{rr} -2 & -1 \\ 1 & 0 \end{array}\right) \verb|=| \left(\begin{array}{rr} 21 & 19 \\ 22 & 20 \end{array}\right)$
$28 \verb|.........| \left(\begin{array}{rr} -19 & -17 \\ -20 & -18 \end{array}\right) \left(\begin{array}{rr} -1 & -2 \\ 0 & 1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 19 & 21 \\ 20 & 22 \end{array}\right)$
$29 \verb|.........| \left(\begin{array}{rr} -19 & -17 \\ -20 & -18 \end{array}\right) \left(\begin{array}{rr} 0 & 1 \\ -1 & -2 \end{array}\right) \verb|=| \left(\begin{array}{rr} 17 & 15 \\ 18 & 16 \end{array}\right)$
$30 \verb|.........| \left(\begin{array}{rr} -19 & -17 \\ -20 & -18 \end{array}\right) \left(\begin{array}{rr} 1 & 0 \\ -2 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 15 & 17 \\ 16 & 18 \end{array}\right)$
$31 \verb|.........| \left(\begin{array}{rr} -19 & -20 \\ -18 & -17 \end{array}\right) \left(\begin{array}{rr} -2 & 0 \\ 1 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 18 & 20 \\ 19 & 17 \end{array}\right)$
$32 \verb|.........| \left(\begin{array}{rr} -19 & -20 \\ -18 & -17 \end{array}\right) \left(\begin{array}{rr} 0 & -2 \\ -1 & 1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 20 & 18 \\ 17 & 19 \end{array}\right)$
$33 \verb|.........| \left(\begin{array}{rr} -19 & -20 \\ -17 & -18 \end{array}\right) \left(\begin{array}{rr} -2 & -1 \\ 1 & 0 \end{array}\right) \verb|=| \left(\begin{array}{rr} 18 & 19 \\ 16 & 17 \end{array}\right)$
$34 \verb|.........| \left(\begin{array}{rr} -19 & -20 \\ -17 & -18 \end{array}\right) \left(\begin{array}{rr} -1 & -2 \\ 0 & 1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 19 & 18 \\ 17 & 16 \end{array}\right)$
$35 \verb|.........| \left(\begin{array}{rr} -19 & -20 \\ -17 & -18 \end{array}\right) \left(\begin{array}{rr} 0 & 1 \\ -1 & -2 \end{array}\right) \verb|=| \left(\begin{array}{rr} 20 & 21 \\ 18 & 19 \end{array}\right)$
$36 \verb|.........| \left(\begin{array}{rr} -19 & -20 \\ -17 & -18 \end{array}\right) \left(\begin{array}{rr} 1 & 0 \\ -2 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 21 & 20 \\ 19 & 18 \end{array}\right)$
$37 \verb|.........| \left(\begin{array}{rr} -18 & -20 \\ -17 & -19 \end{array}\right) \left(\begin{array}{rr} -2 & -1 \\ 1 & 0 \end{array}\right) \verb|=| \left(\begin{array}{rr} 16 & 18 \\ 15 & 17 \end{array}\right)$
$38 \verb|.........| \left(\begin{array}{rr} -18 & -20 \\ -17 & -19 \end{array}\right) \left(\begin{array}{rr} -1 & -2 \\ 0 & 1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 18 & 16 \\ 17 & 15 \end{array}\right)$
$39 \verb|.........| \left(\begin{array}{rr} -18 & -20 \\ -17 & -19 \end{array}\right) \left(\begin{array}{rr} 0 & 1 \\ -1 & -2 \end{array}\right) \verb|=| \left(\begin{array}{rr} 20 & 22 \\ 19 & 21 \end{array}\right)$
$40 \verb|.........| \left(\begin{array}{rr} -18 & -20 \\ -17 & -19 \end{array}\right) \left(\begin{array}{rr} 1 & 0 \\ -2 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 22 & 20 \\ 21 & 19 \end{array}\right)$
$41 \verb|.........| \left(\begin{array}{rr} -18 & -17 \\ -19 & -20 \end{array}\right) \left(\begin{array}{rr} -2 & 0 \\ 1 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 19 & 17 \\ 18 & 20 \end{array}\right)$
$42 \verb|.........| \left(\begin{array}{rr} -18 & -17 \\ -19 & -20 \end{array}\right) \left(\begin{array}{rr} 0 & -2 \\ -1 & 1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 17 & 19 \\ 20 & 18 \end{array}\right)$
$43 \verb|.........| \left(\begin{array}{rr} -18 & -17 \\ -20 & -19 \end{array}\right) \left(\begin{array}{rr} -2 & -1 \\ 1 & 0 \end{array}\right) \verb|=| \left(\begin{array}{rr} 19 & 18 \\ 21 & 20 \end{array}\right)$
$44 \verb|.........| \left(\begin{array}{rr} -18 & -17 \\ -20 & -19 \end{array}\right) \left(\begin{array}{rr} -1 & -2 \\ 0 & 1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 18 & 19 \\ 20 & 21 \end{array}\right)$
$45 \verb|.........| \left(\begin{array}{rr} -18 & -17 \\ -20 & -19 \end{array}\right) \left(\begin{array}{rr} 0 & 1 \\ -1 & -2 \end{array}\right) \verb|=| \left(\begin{array}{rr} 17 & 16 \\ 19 & 18 \end{array}\right)$
$46 \verb|.........| \left(\begin{array}{rr} -18 & -17 \\ -20 & -19 \end{array}\right) \left(\begin{array}{rr} 1 & 0 \\ -2 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 16 & 17 \\ 18 & 19 \end{array}\right)$
$47 \verb|.........| \left(\begin{array}{rr} -17 & -19 \\ -18 & -20 \end{array}\right) \left(\begin{array}{rr} -2 & -1 \\ 1 & 0 \end{array}\right) \verb|=| \left(\begin{array}{rr} 15 & 17 \\ 16 & 18 \end{array}\right)$
$48 \verb|.........| \left(\begin{array}{rr} -17 & -19 \\ -18 & -20 \end{array}\right) \left(\begin{array}{rr} -1 & -2 \\ 0 & 1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 17 & 15 \\ 18 & 16 \end{array}\right)$
$49 \verb|.........| \left(\begin{array}{rr} -17 & -19 \\ -18 & -20 \end{array}\right) \left(\begin{array}{rr} 0 & 1 \\ -1 & -2 \end{array}\right) \verb|=| \left(\begin{array}{rr} 19 & 21 \\ 20 & 22 \end{array}\right)$
$50 \verb|.........| \left(\begin{array}{rr} -17 & -19 \\ -18 & -20 \end{array}\right) \left(\begin{array}{rr} 1 & 0 \\ -2 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 21 & 19 \\ 22 & 20 \end{array}\right)$
$51 \verb|.........| \left(\begin{array}{rr} -17 & -18 \\ -19 & -20 \end{array}\right) \left(\begin{array}{rr} -2 & -1 \\ 1 & 0 \end{array}\right) \verb|=| \left(\begin{array}{rr} 16 & 17 \\ 18 & 19 \end{array}\right)$
$52 \verb|.........| \left(\begin{array}{rr} -17 & -18 \\ -19 & -20 \end{array}\right) \left(\begin{array}{rr} -1 & -2 \\ 0 & 1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 17 & 16 \\ 19 & 18 \end{array}\right)$
$53 \verb|.........| \left(\begin{array}{rr} -17 & -18 \\ -19 & -20 \end{array}\right) \left(\begin{array}{rr} 0 & 1 \\ -1 & -2 \end{array}\right) \verb|=| \left(\begin{array}{rr} 18 & 19 \\ 20 & 21 \end{array}\right)$
$54 \verb|.........| \left(\begin{array}{rr} -17 & -18 \\ -19 & -20 \end{array}\right) \left(\begin{array}{rr} 1 & 0 \\ -2 & -1 \end{array}\right) \verb|=| \left(\begin{array}{rr} 19 & 18 \\ 21 & 20 \end{array}\right)$
WARNING: Some output was deleted.
In [40]:
show(count1)
show(count2)
show(RR(count2/count1))

$3545$
$1$
$0.000282087447108604$
In [ ]:
lowestInA = LowestEntry(A[i])
lowestInB = LowestEntry(B[j])
highestInA = HighestEntry(A[i])
highestInB = HighestEntry(B[j])
if Alowest > lowestInA:
count2 = count2 + 1
show(count2,'.........',A[i],B[j],'=',C)
Alowest = lowestInA
if Blowest > lowestInB:
count2 = count2 + 1
show(count2,'.........',A[i],B[j],'=',C)
Blowest = lowestInB
if Ahighest < highestInA:
count2 = count2 + 1
show(count2,'.........',A[i],B[j],'=',C)
Alowest = lowestInA
if Bhighest < lowestInB:

In [ ]: