Skip to content

Instantly share code, notes, and snippets.

@pbelmans
Last active December 17, 2015 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbelmans/5645902 to your computer and use it in GitHub Desktop.
Save pbelmans/5645902 to your computer and use it in GitHub Desktop.
An implementation in SAGE of the construction given in http://arxiv.org/abs/1204.5730. Hence it is possible to determine the configuration of the quiver and the representation required to represent the projective variety as a quiver Grassmannian
# determine the linear equation of a hypersurface under the d-uple embedding
def getLinearEquation(equation):
d = equation.degree()
monomials = getMonomials(equation.parent(), d)
coefficients = [equation.monomial_coefficient(monomial) for monomial in monomials]
ring = PolynomialRing(QQ, 'x', len(coefficients))
return sum(c * x for c, x in zip(coefficients, ring.gens()))
# determine the maximum degree of a list of (homogeneous) equations
def getMaximalDegree(equations):
return max([equation.degree() for equation in equations])
# get all monomials of a given degree in the polynomial ring
def getMonomials(ring, degree):
# by sorting and reversing we get the same order as on the bourbaki code
degrees = reversed(sorted(WeightedIntegerVectors(degree, [1] * ring.ngens())))
return [prod(x^d for x, d in zip(ring.gens(), exponents)) for exponents in degrees]
def getQuadraticEquations(ring, n, d):
monomialsMatrix = transpose(matrix(getMonomials(ring, d - 1))) * matrix(ring.gens())
monomials = getMonomials(ring, d)
variablesRing = PolynomialRing(QQ, 'x', binomial(n + d, d) + 1)
getVariable = lambda i, j: variablesRing.gens()[monomials.index(monomialsMatrix[i, j])]
variablesMatrix = matrix(variablesRing, monomialsMatrix.nrows(), monomialsMatrix.ncols(), lambda i, j: getVariable(i, j))
# if one is interested in the quadratic equations
# print variablesMatrix.minors(2)
return variablesMatrix.columns()
# add factors of the first variable to make sure the degree of all the equations is the same
def sameDegreeHomogeneous(equations):
d = getMaximalDegree(equations)
result = []
for (i, equation) in enumerate(equations):
result.append(equation * equation.parent().gen(0)^(d - equation.degree()))
return result
# determine all the information on the quiver Grassmannian associated to a variety
def printQuiverGrassmannian(variety):
space = variety.ambient_space()
ring = space.coordinate_ring()
# determining the numbers
n = space.ngens() - 1
d = getMaximalDegree(variety.defining_polynomials())
M = binomial(n + d, d) - 1
print "Considering the projective variety of dimension {} in PG({}, Q) defined by".format(variety.dimension(), n)
for equation in variety.defining_polynomials():
print "\t{}".format(equation)
print "The same equations, all of the same degree (d = {})".format(d)
equations = sameDegreeHomogeneous(variety.defining_polynomials())
for equation in equations:
print "\t{}".format(equation)
print "The dimension vector is (1, {}, {})".format(M + 1, binomial(n + d - 1, d - 1))
print "The {} morphism(s) defining the variety (i.e. the maps 2->1) are".format(len(equations))
for equation in variety.defining_polynomials():
print "\t{}".format(getLinearEquation(equation))
print "The {} morphisms defining the d-uple embedding (i.e. the maps 2->3) are described by".format(n + 1)
for morphism in getQuadraticEquations(ring, n, d):
print "\t{}".format(morphism)
P.<x,y,z> = ProjectiveSpace(2, QQ)
E = P.subscheme([x^3-y^2*z+z^3]) # elliptic curve example
printQuiverGrassmannian(E)
print ""
F = P.subscheme([x^3*y+y^3*z+z^3*x]) # Klein quartic
printQuiverGrassmannian(F)
print ""
P.<x,y,z,w> = ProjectiveSpace(3, QQ)
Q = P.subscheme([x^4+y^4+x*y*z*w+z^2*w^2-w^4]) # Fermat quartic
printQuiverGrassmannian(Q)
print ""
P = ProjectiveSpace(4, QQ, 'x')
C = P.subscheme([sum(P.coordinate_ring().gens()), sum([x^3 for x in P.coordinate_ring().gens()])]) # Clebsch surface
printQuiverGrassmannian(C)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment