Created
May 13, 2017 10:09
-
-
Save gunnihinn/6bac4e4699501f1f571669cb1bad5f16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
def binomial(n, k): | |
""" | |
A fast way to calculate binomial coefficients by Andrew Dalke. | |
See http://stackoverflow.com/questions/3025162/statistics-combinations-in-python | |
""" | |
if 0 <= k <= n: | |
ntok = 1 | |
ktok = 1 | |
for t in range(1, min(k, n - k) + 1): | |
ntok *= n | |
ktok *= t | |
n -= 1 | |
return ntok // ktok | |
else: | |
return 0 | |
def hypersurface(n, d): | |
'''Calculate the number | |
p(n,d) := 12 \int_X c_4(End T_X) \cup h^{n-4} / \int_X h^n, | |
where X is a hypersurface of degree d in n+1 dimensional projective space, | |
and h is the hyperplane class restricted to X.''' | |
# Chern classes of a hypersurface of degree d in P^{n+1} (modulo multiples of h) | |
c0 = n | |
c1 = n+1-d | |
c2 = binomial(n+1,2) - d*c1 | |
c3 = binomial(n+1,3) - d*c2 | |
c4 = binomial(n+1,4) - d*c3 | |
return (n-1) * c1**4 \ | |
- (n-1) * c1**2 * c2 \ | |
+ (n+1) * c2**2 \ | |
+ (n-1) * c1 * c3 \ | |
- n * c4 | |
def check_hypersurfaces(limit): | |
positive = [] | |
negative = [] | |
for n in range(4, limit): | |
# Only check for Kahler--Einstein hypersurfaces, i.e., ones of degree >= n+1 | |
for d in range(n+1, n+4+limit): | |
chern = hypersurface(n, d) | |
if chern < 0: | |
negative.append({'dimension': n, 'degree': d, 'value': chern}) | |
else: | |
positive.append({'dimension': n, 'degree': d, 'value': chern}) | |
return (positive, negative) | |
(positive, negative) = check_hypersurfaces(1000) | |
if negative: | |
print("Negative intersections:") | |
for neg in negative: | |
print(neg) | |
else: | |
print("No negative intersections.") | |
if positive: | |
print("Positive intersections:") | |
for pos in positive: | |
print(pos) | |
else: | |
print("No positive intersections.") | |
print("") | |
print("First negative intersection: ", negative[0]) | |
print("First positive intersection: ", positive[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment