Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: TestPlace
Views: 21
A.<u,v,w>=QuaternionAlgebra(2,3) A.maximal_order() Id=identity_matrix(2) U=matrix([[sqrt(2),0],[0,-sqrt(2)]]) V=matrix([[0,1],[3,0]]) W=U*V E0=Id E1=U E2=(1/2)*Id+(1/2)*U+(1/2)*V E3=(1/2)*U+(1/2)*W Ba=[E0,E1,E2,E3] # Robust way to generate the list of matrices maxm = 2 #set the range L = [] for i in range(-maxm,maxm): for j in range(-maxm,maxm): for k in range(-maxm,maxm): for l in range(-maxm,maxm): temp = i*Ba[0] + j*Ba[1] + k*Ba[2] + l*Ba[3] if temp.determinant() == 1: L.append(temp) print(str(len(L)) + " matrices are selected in special linear group for polyhedron 1") maxm = 3 L2 = [] for i in range(-maxm,maxm): for j in range(-maxm,maxm): for k in range(-maxm,maxm): for l in range(-maxm,maxm): temp = i*Ba[0] + j*Ba[1] + k*Ba[2] + l*Ba[3] if temp.determinant() == 1: L2.append(temp) print(str(len(L2)) + " matrices are selected in special linear group for polyhedron 2")
Order of Quaternion Algebra (2, 3) with base ring Rational Field with basis (1, u, 1/2 + 1/2*u + 1/2*v, 1/2*u + 1/2*w) 41 matrices are selected in special linear group 1 96 matrices are selected in special linear group 2
INEQS=[g*g.transpose() - identity_matrix(2) for g in L] ineqs=[] for F in INEQS: #C = [0,F[0,0],2*F[0,1],F[1,1]] #P = [[a,b],[b,c]] C = [F[1,1],F[0,0] - F[1,1],2*F[0,1]] #P = [[a,b],[b,1-a]] ineqs.append(C) INEQS2=[g*g.transpose() - identity_matrix(2) for g in L2] ineqs2=[] for F in INEQS2: #C = [0,F[0,0],2*F[0,1],F[1,1]] #P = [[a,b],[b,c]] C = [F[1,1],F[0,0] - F[1,1],2*F[0,1]] #P = [[a,b],[b,1-a]] ineqs2.append(C) poly=Polyhedron(ieqs=ineqs,base_ring = AA) poly2=Polyhedron(ieqs=ineqs2,base_ring = AA) print("\nPolyhedron 1: ") print(poly) print("\nPolyhedron 2: ") print(poly2) print("\nTwo polyhedrons are the same ?") print(poly == poly2) print("\nVertices are:") for j in poly.Vrepresentation(): #print(j) print("(" + str(j[0].radical_expression()) + " , " + str(j[1].radical_expression()) + ")") poly.plot()
Polyhedron 1: A 2-dimensional polyhedron in AA^2 defined as the convex hull of 6 vertices Polyhedron 2: A 2-dimensional polyhedron in AA^2 defined as the convex hull of 6 vertices Two polyhedrons are the same ? True Vertices are: (-1/4*sqrt(1/2) + 3/4 , -1/4*sqrt(1/2) - 1/4) (-3/14*sqrt(2) + 9/14 , 0) (1/4*sqrt(1/2) + 3/4 , 1/4*sqrt(1/2) - 1/4) (3/14*sqrt(2) + 9/14 , 0) (-1/4*sqrt(1/2) + 3/4 , 1/4*sqrt(1/2) + 1/4) (1/4*sqrt(1/2) + 3/4 , -1/4*sqrt(1/2) + 1/4)
def convertVertice(Vrep,trace1 = True): mList = [] for i in Vrep: if trace1: a = i[0].radical_expression() b = i[1].radical_expression() temp = matrix([[a,b],[b,1-a]]) else: a = i[0].radical_expression() b = i[1].radical_expression() c = i[2].radical_expression() temp = matrix([[a,b],[b,c]]) mList.append(temp) return(mList) matrixList = convertVertice(poly.Vrepresentation(),True) print("\nVertices in matrix form:") for i in matrixList: print(i) print("\n")
Vertices in matrix form: [-1/4*sqrt(1/2) + 3/4 -1/4*sqrt(1/2) - 1/4] [-1/4*sqrt(1/2) - 1/4 1/4*sqrt(1/2) + 1/4] [-3/14*sqrt(2) + 9/14 0] [ 0 3/14*sqrt(2) + 5/14] [ 1/4*sqrt(1/2) + 3/4 1/4*sqrt(1/2) - 1/4] [ 1/4*sqrt(1/2) - 1/4 -1/4*sqrt(1/2) + 1/4] [ 3/14*sqrt(2) + 9/14 0] [ 0 -3/14*sqrt(2) + 5/14] [-1/4*sqrt(1/2) + 3/4 1/4*sqrt(1/2) + 1/4] [ 1/4*sqrt(1/2) + 1/4 1/4*sqrt(1/2) + 1/4] [ 1/4*sqrt(1/2) + 3/4 -1/4*sqrt(1/2) + 1/4] [-1/4*sqrt(1/2) + 1/4 -1/4*sqrt(1/2) + 1/4]
RRmatlist=[M.change_ring(RR) for M in matrixList] for r in RRmatlist: print(r) print("\n")
[ 0.573223304703363 -0.426776695296637] [-0.426776695296637 0.426776695296637] [0.339811379491480 0.000000000000000] [0.000000000000000 0.660188620508520] [ 0.926776695296637 -0.0732233047033631] [-0.0732233047033631 0.0732233047033631] [ 0.945902906222806 0.000000000000000] [ 0.000000000000000 0.0540970937771939] [0.573223304703363 0.426776695296637] [0.426776695296637 0.426776695296637] [ 0.926776695296637 0.0732233047033631] [0.0732233047033631 0.0732233047033631]
E1;E2;E3
[ sqrt(2) 0] [ 0 -sqrt(2)] [ 1/2*sqrt(2) + 1/2 1/2] [ 3/2 -1/2*sqrt(2) + 1/2] [ 1/2*sqrt(2) 1/2*sqrt(2)] [-3/2*sqrt(2) -1/2*sqrt(2)]