########################################################## # Computing potential heights of xz-projections of Theta # ########################################################## # The following script computes the Grobner fans of the coefficients of the equation g(x,z) defining the xz-projection of the hyperelliptic genus 2 curve with Theta graph as minimal skeleton. # The input polynomials are obtained from "projectionxz.sing". The variables (x,z) are substituted for (x,y). # Our first task is to rewrite the coefficients (by replacing a3 by a4 + a34, where x34 = a3-a4.) # We load the auxiliary files for computation of Leading terms for weight orders and Grobner fans: load("macroslocalJInvariantComputationsAndPrimesWithBadReduction.sage") ######################################### # Generate the ambient ring and Weights # ######################################### # We take two of the branch points to be 0 and 'Infinity', so we need only consider 4 variables b5, b4, b3, and b2, giving the branch points: a5 = -b5^2, a4 = b4^2, a3 = b3^2, a2 = b2^2. As = [var("b5"),var("b4"),var("b34"), var("b2")] R = PolynomialRing(QQ,As) K = FractionField(R); # Our first task is to rewrite the coefficients, by replacing a3 by a4 + a34, where a34 = a3-a4. Since the initials of a3 and a4 agree, we may assume the same happens for b3 and b4 (otherwise, we would have replaced b4 with -b4). Then, a3-a4 = (b3-b4)(b3+b4). If we write b3-b4 = b34, we get a34 = b34*(b4+2b4). oldAs = [var("b5"),var("b4"),var("b3"),var("b34"), var("b2")] oldR = PolynomialRing(QQ,oldAs) oldK = FractionField(oldR); # K # Fraction Field of Multivariate Polynomial Ring in a5, a4, a3, x34, a2 over Rational Field ################ # Type II Cone # ################ # Recall: the variables of R are ordered a5,a3,a34,a2 # The following script constructs the Type II cone, with respect to the variables a5,a4,a34,a2: # Its defining inequalities are: # a5 - a4 >= 0 # a4 - a34>=0 # a4 - a2 >= 0 TypeIICone = Polyhedron(ieqs=[(0,1,-1,0,0),(0,0,1,-1,0),(0,0,1,0,-1)]) # TypeIICone.Hrepresentation() # (An inequality (0, 1, -1, 0) x + 0 >= 0, # An inequality (0, 1, 0, -1) x + 0 >= 0, # An inequality (1, -1, 0, 0) x + 0 >= 0) # TypeIICone.rays() # (A ray in the direction (0, -1, -1, -1), A ray in the direction (0, 0, 0, -1), A ray in the direction (0, 0, -1, 0)) # TypeIICone.lines() # (A line in the direction (1, 1, 1, 1),) # dim(TypeIICone) # 4 ################################# # Coefficients of xz-projection # ################################# # We load the relevant coefficients of the xz-projection, computed with Singular in "projectionxz.sing". WARNING: we label our variables as x, y (refering to x, z). load("coefficientsProjectionxz.sage") # We turn the expressions into polynomials and perform the substitution b3 = b3+b4 Mx4 = R(expand(oldR(Mx4).substitute(b3=b34+b4))) Mx3 = R(expand(oldR(Mx3).substitute(b3=b34+b4))) Mx2 = R(expand(oldR(Mx2).substitute(b3=b34+b4))) # We factor each one of the above polynomials # factor(Mx4) # (-1) * (2*b4^2 + 2*b4*b34 + b34^2 + b2^2) # factor(Mx3) # b4^4 + 2*b4^3*b34 - b5^2*b34^2 + b4^2*b34^2 - b5^2*b2^2 + 2*b4^2*b2^2 + 2*b4*b34*b2^2 + b34^2*b2^2 # factor(Mx2) # b2^2 * (2*b5^2*b4^2 - b4^4 + 2*b5^2*b4*b34 - 2*b4^3*b34 + b5^2*b34^2 - b4^2*b34^2) ############################### # Computation of Grobner fans # ############################### # We load the relevant dictionary of maximal cones precomputed in "GrobnerConeComputationsCoefficientxz.sage" corresponding to the common refinement of all the Groebner fans of the coefficients. PolyMaximalConesgfmallDict = load("coefficientsxz/PolyMaximalConesgfCommonRefinementDict.sobj") ############################### # Computation of subdivisions # ############################### # Our calculations are valid when the residue field has characteristic 0. # We confirm that indeed the TypeIICone is subdivided by the Grobner fan of allm. # PolyMaximalConesAllm = PolyMaximalConesgfmallDict # checkNoSubdivisions(TypeIICone,PolyMaximalConesAllm) # ([10, 11, 12], False) # Next, we compute the induced subdivisions: Subdivisions = computeSubdivisionsOfTypeConeByGrobnerFan(TypeIICone,PolyMaximalConesAllm) # # We record the output # Subdivisions # ([10, 11, 12], # [A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 1 vertex, 3 rays, 1 line, # A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 1 vertex, 3 rays, 1 line, # A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 1 vertex, 3 rays, 1 line]) # We compute the pieces of the subdivision and sample points to compute the leading terms: PiecesTypeIICone = findRaysPiecesSamplePoint(Subdivisions[1]) # # We record the output # PiecesTypeIICone # ({0: [[0, 0, 0, -1], [1, 1, 0, 1], [2, 1, 0, 0]], # 1: [[0, 0, -1, 0], [0, -1, -2, -2], [0, -1, -1, -1]], # 2: [[0, 0, 0, -1], [0, -1, -1, -1], [0, -1, -2, -2]]}, # {0: A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 1 vertex, 3 rays, 1 line, # 1: A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 1 vertex, 3 rays, 1 line, # 2: A 4-dimensional polyhedron in QQ^4 defined as the convex hull of 1 vertex, 3 rays, 1 line}, # {0: [6, 4, 0, 0], 1: [0, -4, -8, -6], 2: [0, -4, -6, -8]}) # We record the sample points to compute the leading terms: allWeightsMxl = PiecesTypeIICone[-1] ########################### # Lower dimensional Cones # ########################### Subdivisions3 = computeFacets(Subdivisions) # # We record the output # Subdivisions3 # ([(0, 1), (1, 2), (0, 2)], # [A 3-dimensional polyhedron in QQ^4 defined as the convex hull of 1 vertex, 2 rays, 1 line, # A 3-dimensional polyhedron in QQ^4 defined as the convex hull of 1 vertex, 2 rays, 1 line, # A 3-dimensional polyhedron in QQ^4 defined as the convex hull of 1 vertex, 2 rays, 1 line]) PiecesTypeIICone3 = findRaysPiecesSamplePoint(Subdivisions3[1]) # # We record the output: # PiecesTypeIICone3 # ({0: [[1, 1, 0, 1], [2, 1, 0, 0]], # 1: [[0, -1, -2, -2], [0, -1, -1, -1]], # 2: [[0, 0, 0, -1], [2, 1, 0, 0]]}, # {0: A 3-dimensional polyhedron in QQ^4 defined as the convex hull of 1 vertex, 2 rays, 1 line, # 1: A 3-dimensional polyhedron in QQ^4 defined as the convex hull of 1 vertex, 2 rays, 1 line, # 2: A 3-dimensional polyhedron in QQ^4 defined as the convex hull of 1 vertex, 2 rays, 1 line}, # {0: [6, 4, 0, 2], 1: [0, -4, -6, -6], 2: [4, 2, 0, -2]}) allWeightsFacets = PiecesTypeIICone3[-1] # Since all the rays except for one ([17, 10, 3, 0]) lie in the the boundary of the TypeIICone, we need only consider one ray for our Leading term computations: allWeightsRays = {0: [0,-1,-2,-2]} ################################### # Simplify Weight vectors to Test # ################################### allWeights = allWeightsMxl.values() + allWeightsFacets.values() + allWeightsRays.values() # We compute primitive vectors with non-positive coefficients equivalent to each one of the sample vectors above, by substracting appropriate multiplies of the all-ones vector and taking a primitive vector thereafter. This is implemented in the function "makeNegativeAndPrimitive" allWeightsSimplified = [] for k in range(len(allWeights)): allWeightsSimplified.append(makeNegativeAndPrimitive(allWeights[k])) # # We record the otput vectors: we will use these to compute examples with Singular # allWeightsSimplified # [[0, -1, -3, -3], # [0, -2, -4, -3], # [0, -2, -3, -4], # [0, -1, -3, -2], # [0, -2, -3, -3], # [0, -1, -2, -3], # [0, -1, -2, -2]] ################################ # Computation of Leading Terms # ################################ leadMx4 = {i: LTFromWeights(Mx4,allWeightsMxl[i],R) for i in range(len(allWeightsMxl))} leadMx3 = {i: LTFromWeights(Mx3,allWeightsMxl[i],R) for i in range(len(allWeightsMxl))} leadMx2 = {i: LTFromWeights(Mx2,allWeightsMxl[i],R) for i in range(len(allWeightsMxl))} # # We record the output: # leadMx4 # {0: -2*b4^2, 1: -2*b4^2, 2: -2*b4^2} # leadMx3 # {0: b4^4, 1: -b5^2*b2^2, 2: -b5^2*b34^2} # leadMx2 # {0: 2*b5^2*b4^2*b2^2, 1: 2*b5^2*b4^2*b2^2, 2: 2*b5^2*b4^2*b2^2} ####################################### # Computation of Leading Terms Facets # ####################################### # Labels of facets = Subdivisions3[0] = [(0, 1), (1, 2), (0, 2)] leadFacetsMx4 = {i: factor(LTFromWeights(Mx4,allWeightsFacets[i],R)) for i in range(len(allWeightsFacets))} leadFacetsMx3 = {i: factor(LTFromWeights(Mx3,allWeightsFacets[i],R)) for i in range(len(allWeightsFacets))} leadFacetsMx2 = {i: factor(LTFromWeights(Mx2,allWeightsFacets[i],R)) for i in range(len(allWeightsFacets))} # We record the outputs: # leadFacetsMx4 # {0: (-2) * b4^2, 1: (-2) * b4^2, 2: (-2) * b4^2} # leadFacetsMx3 # {0: (-1) * (-b4^2 + b5*b2) * (b4^2 + b5*b2), # 1: (-1) * b5^2 * (b34^2 + b2^2), # 2: (-1) * (-b4^2 + b5*b34) * (b4^2 + b5*b34)} # leadFacetsMx2 # {0: (2) * b2^2 * b4^2 * b5^2, # 1: (2) * b2^2 * b4^2 * b5^2, # 2: (2) * b2^2 * b4^2 * b5^2} ##################################### # Computation of Leading Terms Rays # ##################################### leadRaysMx4 = {i: factor(LTFromWeights(Mx4,allWeightsRays[i],R)) for i in range(len(allWeightsRays))} leadRaysMx3 = {i: factor(LTFromWeights(Mx3,allWeightsRays[i],R)) for i in range(len(allWeightsRays))} leadRaysMx2 = {i: factor(LTFromWeights(Mx2,allWeightsRays[i],R)) for i in range(len(allWeightsRays))} # We record the outputs: # leadRaysMx4[0] # (-2) * b4^2 # leadRaysMx3[0] # (-1) * (-b4^4 + b5^2*b34^2 + b5^2*b2^2) # leadRaysMx2[0] # (2) * b2^2 * b4^2 * b5^2 ########################### # Values of Leading Terms # ########################### # Finally, we put together the indices giving the same leadingTerm values for each lw = len(allWeightsMxl) lf = len(allWeightsFacets) numCells = lw + lf + 1 # numCells # 7 labelCoefficients = [Mx4, Mx3, Mx2] allLeadingTerms ={} for p in range(len(labelCoefficients)): LTsp = {} for k in range(lw): LTsp[k] = LTFromWeights(labelCoefficients[p],allWeightsMxl[k],R) for k in range(lf): LTsp[k+lw] = LTFromWeights(labelCoefficients[p],allWeightsFacets[k],R) LTsp[lw+lf]= LTFromWeights(labelCoefficients[p],allWeightsRays[0],R) allLeadingTerms[p] = LTsp # We compute the leading terms without repetitions and all the indices with the given leading terms allLeadingTermsNoRepetitions = {} for p in range(len(labelCoefficients)): norepetitions=list(set(allLeadingTerms[p].values())) numCells = len(allLeadingTerms[p].keys()) indicesNoRep = {} for x in norepetitions: indicesNoRep[x] = sorted([j for j in allLeadingTerms[p].keys() if allLeadingTerms[p][j] == x]) # print norepetitions allLeadingTermsNoRepetitions[p] = {factor(x):indicesNoRep[x] for x in norepetitions} # # We record the number of leading terms per coefficient: # [len(allLeadingTermsNoRepetitions[p].keys()) for p in range(len(labelCoefficients))] # [1, 7, 1] # # We record the possible leading terms: # allLeadingTermsNoRepetitions # {0: {(-2) * b4^2: [0, 1, 2, 3, 4, 5, 6]}, # 1: {(-1) * b2^2 * b5^2: [1], # (-1) * b34^2 * b5^2: [2], # (-1) * b5^2 * (b34^2 + b2^2): [4], # b4^4: [0], # (-1) * (-b4^2 + b5*b2) * (b4^2 + b5*b2): [3], # (-1) * (-b4^2 + b5*b34) * (b4^2 + b5*b34): [5], # (-1) * (-b4^4 + b5^2*b34^2 + b5^2*b2^2): [6]}, # 2: {(2) * b2^2 * b4^2 * b5^2: [0, 1, 2, 3, 4, 5, 6]}}