##################################################################### # This Sage script computes Hodge/Betti numbers of a smooth complete # intersections and moduli spaces of vector. More information can be # found in the file formulas.pdf and doc strings for hodge_ci, # poincare_vb and hpoincare_vb # # #************************************************************************** *** #       Copyright (C) 2008 Donu Arapura dvb@math.purdue.edu # #  Distributed under the terms of the GNU General Public License (GPL), #  version 2 or later (at your preference). # #                  http://www.gnu.org/licenses/ #************************************************************************** *** ##################################################################### # Functions for converting rational functions to series R. = PolynomialRing(QQ,3) def trunc(p,n): r""" Truncates a polynomial p(x,y) to degree n INPUTS: p -- a polynomial in QQ[x,y] n -- a nonnegative integer OUTPUT: p truncated to order n. EXAMPLES: sage: trunc(1+x+2*y +x^2+x*y, 1) x + 2*y + 1 sage: trunc((1+x+y)^3, 2) 3*x^2 + 6*x*y + 3*y^2 + 3*x + 3*y + 1 AUTHORS: - Donu Arapura (2008-07-22) """ P = p(x=t*x,y=t*y) P = P.truncate(t, n+1) return P(t=1) def __hinv(p,n): r""" For p(x,y), compute series 1-p+p^2-p^3+.. to degree n EXAMPLES: sage: __hinv(x*y, 5) x^2*y^2 - x*y + 1 sage: __hinv(2*x*y, 7) -8*x^3*y^3 + 4*x^2*y^2 - 2*x*y + 1 AUTHORS: - Donu Arapura (2008-07-22) """ total=prod =1 for i in range(n): prod = -p*prod prod = trunc(prod, n) total = total + prod return total def series(f,n): r""" Expands a rational function f(x,y) as a series to order n. INPUTS: f -- a rational function in QQ(x,y) with nonzero reduced denominator n -- a nonnegative integer OUTPUT: A polynomial representing the series expansion of f truncated to order n. EXAMPLES: sage: series(x/(1+y^2),5) x*y^4 - x*y^2 + x sage: series((x-y)/(x-y - 2*x^2+2*y^2), 2) 4*x^2 + 8*x*y + 4*y^2 + 2*x + 2*y + 1 An exception will result if the reduced denominator of f has zero constant term. sage: series(1/x, 10) ... : Input does not have series expansion AUTHORS: - Donu Arapura (2008-07-22) """ denom = f.denominator() c = denom.constant_coefficient() if c == 0: raise Exception, "Input does not have series expansion" else: p = trunc(denom/c-1,n) q = trunc(f.numerator()/c,n) return trunc(q*__hinv(p, n),n) def homog_list(p, n): r""" Calculates list of degree n coefficients of a polynomial p(x,y). INPUTS: p -- a polynomial in QQ[x,y] n -- a nonnegative integer OUTPUT: The list of degree n coefficients ordered by y^n, xy^{n-1}... EXAMPLES: sage: homog_list(1+x+(x-y)^3, 3) [-1, 3, -3, 1] AUTHORS: - Donu Arapura (2008-07-22) """ hseq = [] for i in range(n+1): nexth = p.coefficient({x:i, y:(n-i)}) hseq = hseq + [nexth] return hseq def hirzebruch_rat(degs): r""" Calculates rational generating function for Hodge numbers of complete intersection. Input: degs --list of integers which gives the multidegree. n -- integer which which gives dimension of ambient projective space. OUTPUT: rational function in QQ(x,y) -- generating function for middle Hodge numbers of the complete intersection of multidegree degs in P^n EXAMPLES: sage: hirzebruch_rat([2]) 2/(-x*y + 1) sage: hirzebruch_rat([2,2]) (2*x*y - x - y - 4)/(-x^2*y^2 + 2*x*y - 1) AUTHORS: - Donu Arapura (2008-07-22) .""" prod = 1 for d in degs: prod = prod*((1+x)^d -(1+y)^d)/((1+y)^d*x-(1+x)^d*y) prod = prod -1 return prod/( (1+x)*(1+y) ) + 1/(1-x*y) def hirzebruch_ser(degs, level): r""" Calculates generating function for Hodge numbers of complete intersection to given order. Input: degs --list of integers which gives the multidegree. n -- integer which which gives dimension of ambient projective space. OUTPUT: polynomial in QQ[x,y] -- generating function for middle Hodge numbers of the complete intersection of multidegree degs in P^n truncated to level. EXAMPLES: sage: hirzebruch_ser([2], 4) 2*x^2*y^2 + 2*x*y + 2 sage: hirzebruch_ser([2,2], 4) 8*x^2*y^2 + 2*x^2*y + 2*x*y^2 + 6*x*y + x + y + 4 AUTHORS: - Donu Arapura (2008-07-22) .""" return series(hirzebruch_rat(degs), level) def fast_hirzebruch_ser(degs, level): r""" Calculates generating function for Hodge numbers of complete intersection to given order. Input: degs --list of integers which gives the multidegree. n -- integer which which gives dimension of ambient projective space. OUTPUT: polynomial in QQ[x,y] -- generating function for middle Hodge numbers of the complete intersection of multidegree degs in P^n truncated to level. EXAMPLES: sage: fast_hirzebruch_ser([2], 4) 2*x^2*y^2 + 2*x*y + 2 sage: fast_hirzebruch_ser([2,2], 4) 8*x^2*y^2 + 2*x^2*y + 2*x*y^2 + 6*x*y + x + y + 4 NOTES: This has the functionality as hirzebruch_ser but is general faster since it doesn't call hirzebruch_rat. AUTHORS: - Donu Arapura (2008-07-22) .""" prod = 1 for d in degs: prod = prod*series(((1+x)^d -(1+y)^d)/((1+y)^d*x-(1+x)^d*y),level) prod = trunc(prod,level) prod = prod -1 h = series(prod/( (1+x)*(1+y) ) + 1/(1-x*y),level) return h def hodge_ci(degs, n): r""" This function returns the Hodge numbers of a complete intersection. Input: degs --list of integers which gives the multidegree. n -- integer which which gives dimension of ambient projective space. OUTPUT: list -- the middle Hodge numbers of the complete intersection. EXAMPLES: To compute the Hodge numbers h^{02}, h^{11}, h^{20} of a nonsingular complete intersection of multidegree (2,3) in P^4 type sage: hodge([2,3],4) [1, 20, 1] NOTES: By weak Lefschetz, the only interesting Hodge numbers for a complete intersection X are in the middle, i.e. h^{pq} for p+q = dim X. These are computed by a formula due to Hirzebruch [SGA7, exp XI] REFERENCES: [SGA7] Deligne et. al., "SGA 7 II", Springer LNM 340 AUTHORS: - Donu Arapura (2008-07-22) """ dimX = n-len(degs) return homog_list(hirzebruch_ser(degs, dimX), dimX) def fast_hodge_ci(degs, n): r""" This function returns the Hodge numbers of a complete intersection. Input: degs --list of integers which gives the multidegree. n -- integer which which gives dimension of ambient projective space. OUTPUT: list -- the middle Hodge numbers of the complete intersection. EXAMPLES: To compute the Hodge numbers h^{02}, h^{11}, h^{20} of a nonsingular complete intersection of multidegree (2,3) in P^4 type sage: hodge([2,3],4) [1, 20, 1] To calculate the genus of the intersection of 99 quartics in P^100 sage: fast_hodge_ci(99*[4], 100) [59255840382050266410609852155080370968006235395740485801738241, 59255840382050266410609852155080370968006235395740485801738241] NOTES: This has the same functionality as hodge_ci but is generally (much) faster. I would not recommend trying the second example with hodge_ci. REFERENCES: [SGA7] Deligne et. al., "SGA 7 II", Springer LNM 340 AUTHORS: - Donu Arapura (2008-07-22) """ dimX = n-len(degs) return homog_list(fast_hirzebruch_ser(degs, dimX), dimX) ########################################### # This batch of functions will be used to # construction a list of ordered paritions of an # integer. def __successor(tup): r""" Given a sequence of integers, calculate set where each entry increased by 1. EXAMPLES: sage: __successor((1,2,1)) set([(2, 2, 1), (1, 2, 2), (1, 3, 1)]) AUTHORS: - Donu Arapura (2008-07-22) """ s = set([]) for i in range(len(tup)): newtup=() for j in range(len(tup)): if j==i: nextval = tup[j]+1 else: nextval = tup[j] nextval = nextval, newtup = newtup+nextval s = s | set([newtup]) return s def __successor2(lis): r""" Given a sequence of integers, calculate set where each entry increased by 1. EXAMPLES: sage: __successor((1,2,1)) set([(2, 2, 1), (1, 2, 2), (1, 3, 1)]) AUTHORS: - Donu Arapura (2008-07-22) """ out = set([]) for x in lis: out = out | __successor(x) return out def opartitions_fixedlength(k,n): r""" opartitions_fixedlength(k,n) calculates set of ordered partitions of n of length k. EXAMPLES: sage: opartitions_fixedlength(3, 5) set([(3, 1, 1), (1, 1, 3), (1, 2, 2), (1, 3, 1), (2, 2, 1), (2, 1, 2)]) AUTHORS: - Donu Arapura (2008-07-22) """ oneseq = 1, s = set([k*oneseq]) for i in range(n-k): s = __successor2(s) return s def opartitions(n): r""" opartitions(n) calculates set of ordered partitions of n EXAMPLES: sage: opartitions(3) set([(1, 2), (1, 1, 1), (3,), (2, 1)]) AUTHORS: - Donu Arapura (2008-07-22) """ s = set([]) for i in range(1, n+1): s = s | opartitions_fixedlength(i,n) return s ######################## # Hodge numbers for moduli of vector bundles def bracket(a): r""" Calculates t in (0,1] such that a+t is an integer. EXAMPLES: sage: bracket(1/3) 2/3 sage: bracket(-1/5) 1/5 AUTHORS: - Donu Arapura (2008-07-22) """ return 1 + floor(a)-a def __p(n,g): r""" Calculates a rational function needed for poincare_vb EXAMPLES: sage: __p(2,2) (-t^13 - t^12 - 4*t^10 - 4*t^9 - 6*t^7 - 6*t^6 - 4*t^4 - 4*t^3 - t - 1)/(t^5 - 3*t^4 + 4*t^3 - 4*t^2 + 3*t - 1) sage: __p(1,3) (-t^5 - 5*t^4 - 10*t^3 - 10*t^2 - 5*t - 1)/(t - 1) AUTHORS: - Donu Arapura (2008-07-22) """ prd = 1 for i in range(n): prd = prd*(1+t^(2*i+1))^(2*g)/(1-t^(2*i+2))^2 return prd*(1-t^(2*n)) def __hp(n,g): r""" Calculates a rational function needed for hpoincare_vb EXAMPLES: sage: __hp(1,2) (-x^2*y^2 - 2*x^2*y - 2*x*y^2 - x^2 - 4*x*y - y^2 - 2*x - 2*y - 1)/(x*y - 1) AUTHORS: - Donu Arapura (2008-07-22) """ prd = 1 for i in range(n): prd = prd*(1+x^i*y^(i+1))^g*(1+x^(i+1)*y^i)^g/(1-(x*y)^(i+1))^2 return prd*(1-(x*y)^n) def __m(lis, lamb): r""" Calculates an integer needed for poincare_vb EXAMPLES: sage: __m([1,2],1/2) 3/2 sage: __m([3],1/3) 0 AUTHORS: - Donu Arapura (2008-07-22) """ sm=Sm=0 for i in range(len(lis)-1): sm = lis[i] + sm Sm = (lis[i]+lis[i+1])*bracket(sm*lamb)+Sm return Sm def __mg(lis, lamb, g): r""" Calculates an integer needed for poincare_vb EXAMPLES: sage: __mg([1,2],1/2,2) 7/2 sage: __mg([3],1/2,4) 0 AUTHORS: - Donu Arapura (2008-07-22) """ sm = 0 for i in range(len(lis)): for j in range(i+1, len(lis)): sm = lis[i]*lis[j]+sm return __m(lis, lamb) + (g-1)*sm def __sigma(lis, n ,d,g): r""" Calculates a rational function needed for poincare_vb EXAMPLES: sage: __sigma([1,1], 2,1,2) (-t^9 - 5*t^8 - 10*t^7 - 10*t^6 - 5*t^5 - t^4)/(-t^5 + 3*t^4 - 4*t^3 + 4*t^2 - 3*t + 1) AUTHORS: - Donu Arapura (2008-07-22) """ lent = len(lis) prd = -(-1)^lent*t^(2*__mg(lis, d/n,g)) for i in range(lent-1): prd = prd/(1-t^(2*lis[i]+2*lis[i+1])) for i in lis: prd = prd*__p(i,g) return prd def __hsigma(lis, n ,d,g): r""" Calculates a rational function needed for hpoincare_vb EXAMPLES: sage: __hsigma([1,1], 2,1,2) (-x^6*y^6 - 4*x^6*y^5 - 4*x^5*y^6 - 6*x^6*y^4 - 16*x^5*y^5 - 6*x^4*y^6 - 4*x^6*y^3 - 24*x^5*y^4 - 24*x^4*y^5 - 4*x^3*y^6 - x^6*y^2 - 16*x^5*y^3 - 36*x^4*y^4 - 16*x^3*y^5 - x^2*y^6 - 4*x^5*y^2 - 24*x^4*y^3 - 24*x^3*y^4 - 4*x^2*y^5 - 6*x^4*y^2 - 16*x^3*y^3 - 6*x^2*y^4 - 4*x^3*y^2 - 4*x^2*y^3 - x^2*y^2)/(-x^4*y^4 + 2*x^3*y^3 - 2*x*y + 1) AUTHORS: - Donu Arapura (2008-07-22) """ lent = len(lis) prd = -(-1)^lent*(x*y)^(__mg(lis, d/n,g)) for i in range(lent-1): prd = prd/(1-(x*y)^(lis[i]+lis[i+1])) for i in lis: prd = prd*__hp(i,g) return prd def __poincare1(lis, n,d,g, numterms): r""" Calculates a polynomial needed for poincare_vb EXAMPLES: sage: __poincare1(set([(2,), (1,1)]), 2,1,2,3) 1 + t^2 + 4*t^3 sage: __poincare1(set([(1,1)]), 2,1,2,4) -t^4 AUTHORS: - Donu Arapura (2008-07-22) """ Lis = map(lambda L:taylor(__sigma(L,n,d,g), t, 0, numterms), lis) sm =sum(Lis) return taylor(sm/__p(1,g),t,0,numterms) def __hpoincare1(lis, n,d,g,numterms): r""" Calculates a polynomial needed for poincare_vb EXAMPLES: sage: __hpoincare1(set([(2,), (1,1)]), 2,1,2,3) 2*x^2*y + 2*x*y^2 + x*y + 1 sage: __hpoincare1(set([(1,1)]), 2,1,2,4) -x^2*y^2 AUTHORS: - Donu Arapura (2008-07-22) """ Lis = map(lambda L:series(__hsigma(L,n,d,g),numterms), lis) sm =sum(Lis) return series(sm/__hp(1,g), numterms) def poincare_vb_trunc(n,d,g, numterms): r""" This computes the truncated Poincare polynomial of moduli space vector bundles over a curve. INPUT: n -- positive integer giving the rank d -- positive integer giving the degree g -- nonnegative integer giving the genus of curve numterms -- nonnegative integer give number of terms OUTPUT: The Poincare polynomial of the moduli space of stable vector bundles of rank n and fixed det of degree d over a genus g curve truncated to numterms. EXAMPLE: sage: poincare_vb_trunc(2,1,2,5) 1 + t^2 + 4*t^3 + t^4 sage: poincare_vb_trunc(5,2,2,10) 1 + t^2 + 4*t^3 + 3*t^4 + 8*t^5 + 11*t^6 + 20*t^7 + 32*t^8 + 44*t^9 + 71*t^10 REFERENCES: [Z] D. Zagier, "Elementary aspects of the Verlinde formula and of the Harder-Narasimhan-Atiyah-Bott formula." Proc. of Hirzebruch's 65 birthday conference AUTHOR: - Donu Arapura (2008-07-22) """ return __poincare1(opartitions(n),n,d,g, numterms) def hpoincare_vb_trunc(n,d,g, numterms): r""" This computes the truncate Hodge Poincare polynomial of moduli space vector bundles over a curve. INPUT: n -- integer giving the rank d -- integer giving the degree g -- integer giving the genus OUTPUT: The Poincare polynomial of the moduli space of stable vector bundles of rank n and fixed det of degree d over a genus g curve EXAMPLE: sage: hpoincare_vb_trunc(2,1,2,5) x^2*y^2 + 2*x^2*y + 2*x*y^2 + x*y + 1 sage: hpoincare_vb_trunc(3,2,3,6) 3*x^4*y^2 + 13*x^3*y^3 + 3*x^2*y^4 + 6*x^3*y^2 + 6*x^2*y^3 + 3*x^2*y^2 + 3*x^2*y + 3*x*y^2 + x*y + 1 REFERENCES: [B] del Bano, " On the Chow motive of some moduli spaces," Crelles J (2001) AUTHOR: - Donu Arapura (2008-07-22) """ HP = __hpoincare1(opartitions(n), n,d,g, numterms) return HP def poincare_vb(n,d,g): r""" This computes the Poincare polynomial of moduli space vector bundles over a curve. INPUT: n -- integer giving the rank d -- integer giving the degree g -- integer giving the genus OUTPUT: The Poincare polynomial of the moduli space of stable vector bundles of rank n and fixed det of degree d over a genus g curve EXAMPLE: sage:poincare_vb(2,1,2) 1 + t^2 + 4*t^3 + t^4 + t^6 sage: poincare_vb(2,1,3) 1 + t^2 + 6*t^3 + 2*t^4 + 6*t^5 + 16*t^6 + 6*t^7 + 2*t^8 + 6*t^9 + t^10 + t^12 REFERENCES: [Z] D. Zagier, "Elementary aspects of the Verlinde formula and of the Harder-Narasimhan-Atiyah-Bott formula." Proc. of Hirzebruch's 65 birthday conference AUTHOR: - Donu Arapura (2008-07-22) """ return poincare_vb_trunc(n,d,g, 2*(n^2-1)*(g-1)) def hpoincare_vb(n,d,g): r""" This computes the Hodge Poincare polynomial of moduli space vector bundles over a curve. INPUT: n -- integer giving the rank d -- integer giving the degree g -- integer giving the genus OUTPUT: The Poincare polynomial of the moduli space of stable vector bundles of rank n and fixed det of degree d over a genus g curve EXAMPLE: sage:hpoincare_vb(2,1,2) x^3*y^3 + x^2*y^2 + 2*x^2*y + 2*x*y^2 + x*y + 1 REFERENCES: [B] del Bano, " On the Chow motive of some moduli spaces," Crelles J (2001) AUTHOR: - Donu Arapura (2008-07-22) """ return hpoincare_vb_trunc(n,d,g, 2*(n^2-1)*(g-1))