Skip to content

Instantly share code, notes, and snippets.

@pbelmans
Created November 16, 2016 16:07
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/46f0250073aadcebca254c00238a96b1 to your computer and use it in GitHub Desktop.
Save pbelmans/46f0250073aadcebca254c00238a96b1 to your computer and use it in GitHub Desktop.
Understanding normalisation and basic properties of weighted projective spaces
import itertools
def reduce(Q):
return tuple([qi / gcd(Q) for qi in Q])
def normalise(Q):
Q = reduce(Q)
D = [gcd(Q[:i] + Q[i+1:]) for i in range(len(Q))]
A = [lcm(D[:i] + D[i+1:]) for i in range(len(Q))]
a = lcm(A)
return tuple([qi / ai for (qi, ai) in zip(Q, A)])
def isNormalised(Q):
return Q == normalise(Q)
def isGorenstein(Q):
return sum(Q) % lcm(Q) == 0
bound = 20
dimension = 2
#bound = 25
#dimension = 3
weights = itertools.product(range(1, bound), repeat=dimension+1)
weights = filter(lambda Q: Q == tuple(sorted(Q)), weights)
normalised = filter(isNormalised, weights)
Gorenstein = filter(isGorenstein, normalised)
print len(normalised)
print len(Gorenstein), Gorenstein
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment