Skip to content

Instantly share code, notes, and snippets.

@pbelmans
Created Dec 27, 2015
Embed
What would you like to do?
All genera of complete intersection curves up to a certain cutoff
def genus(degrees):
n = len(degrees) + 1
return 1 + 1 / 2 * prod(degrees) * (sum(degrees) - n - 1)
"""
Generate a list of all genera of complete intersection curves up to a cutoff
Observe that the genus strictly increases if we increase the degree of a
defining equation, while adding a hyperplane section keeps the degree fixed.
So we can obtain all low genera starting from the line in P^2, and increasing
the number of equations and the degrees of the defining equations
"""
def listOfGenera(cutoff):
queue = [(1,)]
genera = []
while len(queue) > 0:
degrees = queue.pop()
g = genus(degrees)
if g < cutoff:
# if we haven't found this one yet we add it to the list
if g not in genera:
genera.append(g)
# use this to get information on how to realise a curve
# print (g, degrees)
# add (d_1,...,d_{n-1},2): with ,1 at the end genus is constant
queue.append(degrees + (2,))
# add all valid (d_1,...,d_i+1,...,d_{n-1})
for i in range(len(degrees)):
new = list(degrees)
new[i] = new[i] + 1
# we only look at increasing lists of degrees
if sorted(new) == new:
queue.append(tuple(new))
return sorted(genera)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment