Last active
December 20, 2021 02:46
-
-
Save pbelmans/931580361e84b71789e826935f21d282 to your computer and use it in GitHub Desktop.
Sage code to compute the integral of the square root of the Todd class on a hyperkähler variety
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
from sage.schemes.chow.all import * | |
# dimension 6 | |
X = ChowScheme(6, ["c2", "c4", "c6"], [2, 4, 6]) | |
X.chowring().inject_variables() | |
td = Sheaf(X, 6, 1 + sum(X.gens())).todd_class() | |
integrand = (td._logg()/2)._expp().by_degrees()[6] | |
# O'Grady 6 | |
values = {c2^3: 30720, c2*c4: 7680, c6: 1920} | |
print(integrand.reduce([m - values[m] for m in values])) | |
# Kum^3 | |
values = {c2^3: 30208, c2*c4: 6784, c6: 448} | |
print(integrand.reduce([m - values[m] for m in values])) | |
# dimension 10 | |
X = ChowScheme(10, ["c2", "c4", "c6", "c8", "c10"], [2, 4, 6, 8, 10]) | |
X.chowring().inject_variables() | |
td = Sheaf(X, 10, 1 + sum(X.gens())).todd_class() | |
integrand = (td._logg()/2)._expp().by_degrees()[10] | |
# O'Grady 10 | |
values = {c2^5: 127370880, c2^3*c4: 53071200, c2^2*c6: 12383280, c2*c8: 1791720, \ | |
c2*c4^2: 22113000, c4*c6: 5159700, c10: 176904} | |
print(integrand.reduce([m - values[m] for m in values])) | |
# K3^[5] | |
values = {c2^5: 126867456, c4*c2^3: 52697088, c4^2*c2: 21921408, c6*c2^2: 12168576, \ | |
c6*c4: 5075424, c8*c2: 1774080, c10: 176256} | |
print(integrand.reduce([m - values[m] for m in values])) |
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
# expressions taken from Propositions 19 and 21 of Sawon's PhD thesis | |
def K3n(n): return (n+3)^n / (4^n * factorial(n)) | |
def Kum_n(n): return (n+1)^(n+1) / (4^n * factorial(n)) | |
def todd_root(n): | |
"""Determine the square root of the Todd class of a hyperkaehler | |
Returns the square root of the Todd class expressed in terms of Chern numbers | |
together with the Chern numbers as monomials in a polynomial ring. | |
""" | |
def modified_bernoulli(n): | |
if n == 0: return ln(2) / 2 | |
if n % 2 == 1: return 0 | |
return bernoulli(n) / (2 * n**2 * gamma(n)) | |
def exp(t, precision=n): | |
return sum([t**i / factorial(i) for i in range(precision + 1)]) | |
R = PolynomialRing(QQ, ["ch" + str(2*i) for i in range(1, n+1)]) | |
# (1) truncated power series expansion of square root of Todd class | |
result = prod([exp(-modified_bernoulli(2*k) * factorial(2*k) \ | |
* R.gen(k-1)) for k in range(1, n+1)]) | |
# (2) now collect degree 2*n part | |
# not really Chern numbers but didn't have better name | |
chern_numbers = WeightedIntegerVectors(n, range(1, n+1)) | |
chern_numbers = [prod([R.gen(i)**c for (i, c) in enumerate(C)]) for C in chern_numbers] | |
result = sum([result.monomial_coefficient(ch) * ch for ch in chern_numbers]) | |
# (3) from ch_i to c_i | |
S = PolynomialRing(QQ, ["c" + str(2*i) for i in range(1, n+1)]) | |
morphism = [] | |
for k in range(2, 2*n+1, 2): | |
# go from the Chern character to Chern classes using symmetric functions | |
Sym = SymmetricFunctions(QQ) | |
terms = Sym.elementary()(Sym.powersum()[k]).monomial_coefficients().items() | |
# select only the even Chern classes on a hyperkaehler | |
terms = [(E, c) for (E, c) in terms if all([i % 2 == 0 for i in E])] | |
expression = 1 / factorial(k) \ | |
* sum([c * prod([S.gen(i // 2 - 1) for i in E]) for (E, c) in terms]) | |
morphism.append(expression) | |
result = R.hom(morphism, S)(result) | |
# (4) list the Chern numbers that can appear | |
chern_numbers = WeightedIntegerVectors(n, range(1, n+1)) | |
chern_numbers = [prod([S.gen(i)**c for (i, c) in enumerate(C)]) for C in chern_numbers] | |
return (result, chern_numbers) | |
print("O'Grady 6-fold") | |
(square_root, chern_numbers) = todd_root(3) | |
square_root.parent().inject_variables() | |
values = {c2^3: 30720, c2*c4: 7680, c6: 1920} | |
value = sum([square_root.monomial_coefficient(c) * values[c] for c in values]) | |
assert value == Kum_n(3) | |
print(value, "\n") | |
print("O'Grady 10-fold") | |
(square_root, chern_numbers) = todd_root(5) | |
square_root.parent().inject_variables() | |
values = {c2^5: 127370880, c2^3*c4: 53071200, c2^2*c6: 12383280, c2*c8: 1791720, \ | |
c2*c4^2: 22113000, c4*c6: 5159700, c10: 176904} | |
value = sum([square_root.monomial_coefficient(c) * values[c] for c in values]) | |
assert value == K3n(5) | |
print(value, "\n") | |
print("Generalised Kummer variety of dimension 6-fold: computation by hand") | |
(square_root, chern_numbers) = todd_root(3) | |
square_root.parent().inject_variables() | |
values = {c2^3: 30208, c2*c4: 6784, c6: 448} | |
value = sum([square_root.monomial_coefficient(c) * values[c] for c in values]) | |
assert value == Kum_n(3) | |
print(value, "\n") |
Dang, I expected that some functionality must've existed somewhere but not that it would've been so easy! I indeed briefly thought of using Macaulay2, but just wrote it from scratch in Sage as I find that more pleasant usually. But chow really is the best of both worlds, I had seen it before but forgot about it as I hadn't used it yet (which will change now for sure).
Thanks!
Glad to help! (long time admirer of your awesome blogs)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have you ever tried the package chow? This can be done as simple as
(and of course there are similar functionalities in Macaulay2 and Julia)