Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: TestPlace
Views: 17
1
def coeff(F):
2
C=[]
3
C.append(int(F.coefficient({b:0,c:0,d:0,x:0,y:0,z:0})))
4
C.append(int(F.coefficient({b:1,c:0,d:0,x:0,y:0,z:0})))
5
C.append(int(F.coefficient({b:0,c:1,d:0,x:0,y:0,z:0})))
6
C.append(int(F.coefficient({b:0,c:0,d:1,x:0,y:0,z:0})))
7
C.append(int(F.coefficient({b:0,c:0,d:0,x:1,y:0,z:0})))
8
C.append(int(F.coefficient({b:0,c:0,d:0,x:0,y:1,z:0})))
9
C.append(int(F.coefficient({b:0,c:0,d:0,x:0,y:0,z:1})))
10
return C
11
12
def ExtractIneqs(L):
13
#INEQS = [((g*g.transpose()-matrix.identity(3))*P).trace() for g in L]
14
INEQS=[(g.transpose()*P*g-P).trace() for g in L]
15
ineqs=[[0,0,0,0,1,0,0],[0,0,0,0,0,1,0],[0,0,0,0,0,0,1]]
16
for F in INEQS:
17
ineqs.append(coeff(F))
18
return ineqs
19
20
21
22
23
24
25
S.<b,c,d,x,y,z>=ZZ[]
26
27
P=matrix([[x,b,c],[b,y,d],[c,d,z]])
28
29
BS = []
30
for bs in GL(3,ZZ).gens():
31
BS.append(matrix(bs.gap().sage()))
32
33
L = []
34
for ii in range(3):
35
for jj in range(3):
36
for kk in range(3):
37
for ll in range(3):
38
gi = (BS[1]^ii) * (BS[0]^jj) * (BS[2]^kk) * (BS[3]^ll)
39
L.append(gi)
40
L.append(gi^-1)
41
L.append(gi.transpose())
42
L.append((gi.transpose())^-1)
43
44
poly=Polyhedron(ieqs=ExtractIneqs(L), base_ring=ZZ)
45
46
47
48
L2 = []
49
for ii in range(4):
50
for jj in range(4):
51
for kk in range(4):
52
for ll in range(4):
53
gi = (BS[1]^ii) * (BS[0]^jj) * (BS[3]^kk) * (BS[2]^ll)
54
L2.append(gi)
55
L2.append(gi^-1)
56
L2.append(gi.transpose())
57
L2.append((gi.transpose())^-1)
58
59
60
poly2=Polyhedron(ieqs=ExtractIneqs(L2), base_ring=ZZ)
61
62
63
64
65
66
print("threebythree:\n")
67
print("Poly1:")
68
print(poly)
69
print("Poly2:")
70
print(poly2)
71
print("\nTwo polys are the same?")
72
print(poly == poly2)
73
74
print("\nPoly1:")
75
for i in poly.Vrepresentation():
76
print(i)
77
for i in poly2.Hrepresentation():
78
print(i)
79
80
print("\nPoly2:")
81
for i in poly2.Vrepresentation():
82
print(i)
83
for i in poly2.Hrepresentation():
84
print(i)
85