| Download
Project: admcycles
Views: 724Visibility: Unlisted (only visible to those who know the link)
Image: ubuntu2004r"""1Chern character of the derived pushforward of a line bundle `\O(D)` on2the universal curve C_{g,n} over the space Mbar_{g,n} of stable curves via3the Grothendieck-Riemann-Roch (GRR) formula.45The algorithm implemented is the formula of Theorem 1 from the paper [PRvZ] of6Pagani, Ricolfi and van Zelm. The formula itself is in the function7``generalized_hodge_chern(l,d,a,dmax,g,n)`` where using the notation from [PRvZ]:89- ``l`` is the integer l from equation (0.1)10- ``d`` is a list [d_1,...,d_n]11- ``a`` is a list of triples [h,S,a_{h,S}], where h is an integer and S a list12so that [h,S] indicates the graph with two vertices and one edge with genus h13on the left and markings S on the left. The integer a_{h,S} is the14corresponding value to this graph from equation (0.1). Only the graphs with15nonzero a_{h,S} need to be entered.1617- ``dmax`` is the maximal codim to which we want to compute the formula of Theorem 1.18- ``g`` and ``n`` are respectively the genus and the number of marked points1920As described in the paper [PRvZ] this can be used to compute the DR cycle in21certain cases (namely when (d=[0,...,\pm 1,...,\mp 1,...,0]). The DR cycle can22be computed directly in this case by2324DR_phi(g,d)2526The DR cycle can also be computed using [JPPZ]. This method has already been27implemented in admcycles.sage as DR_cycle(g,d). To verify that the methods give28the same result modulo Pixton relations one can type:2930(DR_phi(g,d) - DR_cycle(g,d)).is_zero()3132We verified that these classes are the same for d=[1,-1] and g=1,2,3,4. For33higher values of g the computation takes too long. Note that in the case of34g=4 these are codimension 4 classes. The ring R^4(M_4,2) is generated by 399035distinct decorated stratum classes, so this is a serious check on the36correctness of these formula's. Note also that the two methods do not give the37same result if we do not mod out by Pixton relations. i.e.3839(DR_phi(g,d) - DR_cycle(g,d)).simplify()4041is not zero.42"""43import operator4445from .admcycles import tautclass, decstratum, stgraph, psicl, kappacl, psiclass, kappaclass46from .admcycles import chern_char_to_poly, chern_char_to_class, fundclass4748from sage.rings.all import ZZ, QQ49from sage.matrix.constructor import matrix50from sage.misc.misc import powerset51from sage.misc.misc_c import prod52from sage.arith.all import bernoulli, binomial, multinomial53from sage.combinat.all import bernoulli_polynomial, IntegerVectors545556def divided_bernoulli(n):57"""58Return Bernoulli number of index ``n`` divided by ``n!``.5960EXAMPLES::6162sage: from admcycles import *63sage: from admcycles.GRRcomp import *64sage: divided_bernoulli(12)65-691/130767436800066"""67return bernoulli(n) / ZZ(n).factorial()686970def divided_bernoulli_polynomial(l, n):71"""72Return Bernoulli polynomial of index ``n`` at ``l``, divided by ``n!``.7374EXAMPLES::7576sage: from admcycles import *77sage: from admcycles.GRRcomp import *78sage: x = polygen(QQ,'x')79sage: divided_bernoulli_polynomial(x,4)801/24*x^4 - 1/12*x^3 + 1/24*x^2 - 1/72081"""82return bernoulli_polynomial(l, n) / ZZ(n).factorial()838485def handle_g_n(g, n):86"""87Helper function that fetches the global ``g`` and ``n`` parameters.8889See also :func:`admcycles.reset_g_n`.9091The global ``g`` and ``n`` should rather be replaced by the creation92of an object ``MMbar(g, n)`` with attributes ``g`` and ``n``.93"""94if g is None:95from .admcycles import g96if n is None:97from .admcycles import n98return g, n99100101def generalized_hodge_chern(l,d,a,dmax=None,g=None,n=None):102r"""103Computes the Chern character of the derived pushforward of a line bundle \O(D) on104the universal curve C_{g,n} over the space Mbar_{g,n} of stable curves.105106A divisor D on C_{g,n} up to pullbacks from Mbar_{g,n} takes the form107108D = l \tilde{K} + sum_{i=1}^n d_i \sigma_i + \sum_{h,S} a_{h,S} C_{h,S}109110where the numbers l, d_i and a_{h,S} are integers, \tilde{K} is the relative canonical111class of the morphism C_{g,n} -> Mbar_{g,n}, \sigma_i is the image of the ith section112and C_{h,S} is the boundary divisor of C_{g,n} where the moving point lies on a genus h113component with markings given by the set S.114For such a divisor this function computes the Chern character115116ch(R^\bullet \pi_* \O(D))117118up to codimension dmax using the formula given in [Pagani-Ricolfi-van Zelm].119120NOTE: This formula assumes that the number n of marked points is at least 1.121122INPUT:123124l : integer125the coefficient in front of \tilde{K}126d : list127vector of integers (d_1,...,d_n)128a : list129list of triples [h,S,a_{h,S}] where a_{h,S} is nonzero (and S is a subset of [1,...,n] )130dmax : integer131maximum codimension, set to 3g+3-n by default132g : integer133genus134n : integer135number of markings, for the formula to be correct we need at least one136137EXAMPLES::138139sage: from admcycles import *140sage: from admcycles.GRRcomp import *141sage: g=1;n=2142sage: l=0;d=[1,-1];a=[[1,[],-1]]143sage: generalized_hodge_chern(l,d,a,1,g,n)144Graph : [1] [[1, 2]] []145Polynomial : 1/12*(kappa_1^1 )_0146<BLANKLINE>147Graph : [1] [[1, 2]] []148Polynomial : (-13/12)*psi_1^1149<BLANKLINE>150Graph : [1] [[1, 2]] []151Polynomial : (-1/12)*psi_2^1152<BLANKLINE>153Graph : [0, 1] [[1, 2, 4], [5]] [(4, 5)]154Polynomial : (-11/12)*155<BLANKLINE>156Graph : [0] [[4, 5, 1, 2]] [(4, 5)]157Polynomial : 1/24*158"""159g, n = handle_g_n(g, n)160if dmax is None:161dmax = 3*g-3+n162163return sum(generalized_hodge_chern_single(t,l,d,a,g,n) for t in range(1,dmax+1))164165166def generalized_hodge_chern_single(t,l,d,a,g=None,n=None):167r"""168Computes the degree t part of the Chern character of the derived pushforward of a line169bundle \O(D) on the universal curve C_{g,n} over the space Mbar_{g,n} of stable curves.170171A divisor D on C_{g,n} up to pullbacks from Mbar_{g,n} takes the form172173D = l \tilde{K} + sum_{i=1}^n d_i \sigma_i + \sum_{h,S} a_{h,S} C_{h,S}174175where the numbers l, d_i and a_{h,S} are integers, \tilde{K} is the relative canonical176class of the morphism C_{g,n} -> Mbar_{g,n}, \sigma_i is the image of the ith section177and C_{h,S} is the boundary divisor of C_{g,n} where the moving point lies on a genus h178component with markings given by the set S.179For such a divisor this function computes the degree t part180181ch_t(R^\bullet \pi_* \O(D))182183of the Chern character of R^\bullet \pi_* \O(D) using the formula given in184[Pagani-Ricolfi-van Zelm].185186NOTE: This formula assumes that the number n of marked points is at least 1.187188EXAMPLES::189190sage: from admcycles import *191sage: from admcycles.GRRcomp import *192sage: l=0; d=[1,-1]; a=[[1,[],-1]]193sage: generalized_hodge_chern_single(1, l, d, a, 1, 2)194Graph : [1] [[1, 2]] []195Polynomial : 1/12*(kappa_1^1 )_0196<BLANKLINE>197Graph : [1] [[1, 2]] []198Polynomial : (-13/12)*psi_1^1199<BLANKLINE>200Graph : [1] [[1, 2]] []201Polynomial : (-1/12)*psi_2^1202<BLANKLINE>203Graph : [0, 1] [[1, 2, 4], [5]] [(4, 5)]204Polynomial : (-11/12)*205<BLANKLINE>206Graph : [0] [[4, 5, 1, 2]] [(4, 5)]207Polynomial : 1/24*208209If you do not want to manually enter ``g`` and ``n`` each time these can be210set globally::211212sage: reset_g_n(1, 2)213sage: generalized_hodge_chern_single(1, l, d, a)214Graph : [1] [[1, 2]] []215Polynomial : 1/12*(kappa_1^1 )_0216<BLANKLINE>217Graph : [1] [[1, 2]] []218Polynomial : (-13/12)*psi_1^1219<BLANKLINE>220Graph : [1] [[1, 2]] []221Polynomial : (-1/12)*psi_2^1222<BLANKLINE>223Graph : [0, 1] [[1, 2, 4], [5]] [(4, 5)]224Polynomial : (-11/12)*225<BLANKLINE>226Graph : [0] [[4, 5, 1, 2]] [(4, 5)]227Polynomial : 1/24*228"""229g, n = handle_g_n(g, n)230if n==0:231raise ValueError('There needs to be at least one marked point for generalized_hodge_chern_single to work')232233a.sort(key=operator.itemgetter(1,2)) #Order a to our convention234result = generalized_hodge_chern_K(t,l,a,g,n) + generalized_hodge_chern_S(t,l,d,a,g,n) + todd_inv_exp(a,t,g,n) # -generalized_hodge_chern_exp(t,a,g,n)235return result.simplify(g,n,t)236237238239240def todd_inv_exp(a, t, g=None, n=None):241"""242EXAMPLES::243244sage: from admcycles import *245sage: from admcycles.GRRcomp import *246sage: todd_inv_exp([],1,1,2)247Graph : [0, 1] [[1, 2, 4], [5]] [(4, 5)]248Polynomial : 1/12*249<BLANKLINE>250Graph : [0] [[4, 5, 1, 2]] [(4, 5)]251Polynomial : 1/24*252"""253g, n = handle_g_n(g, n)254a.sort(key=operator.itemgetter(1, 2)) # Order a to our convention255result = tautclass([])256for t1 in range(1, t, 2):257coeff_t1 = divided_bernoulli(t1+1)/ZZ(t-t1).factorial()258for tvect in IntegerVectors(t - t1, len(a)):259result += coeff_t1 * prod(ai[2]**tvecti for ai, tvecti in zip(a, tvect)) * multinomial(tvect) * todd_inv_exp_graphs(a, t1, tvect, g, n)260result += todd_inv_sigma(t, g, n)261return result262263264##265## The case without the graphs266def todd_inv_sigma(t,g,n):267if t % 2 == 0:268return tautclass([])269270if n > 0:271seprange = [[h,[1]+s] for h in range(g+1) for s in powerset(range(2,n+1))272if not (h==0 and not s) and not (h==g and len(s)>n-3)]273else:274seprange = [[h,[]] for h in range(1, g//2+1)]275#The list [h,S] of possible nonisomorphic irreducible codimension 1 graphs276decsum = sum((-psicl(n+1,n+2))**i*psicl(n+2,n+2)**(t-1-i) for i in range(t)) ## The decoration277tautclass1 = tautclass([decstratum(stgraph([g-1],[list(range(1,n+3))],[(n+1,n+2)]),poly=decsum)]) ## The irreducible graph278tautclass2 = sum(tautclass([decstratum(stgraph([ahS[0],g-ahS[0]],[ahS[1]+[n+1],list(set(range(1,n+1))-set(ahS[1]))+[n+2]],[(n+1,n+2)]),poly=decsum)]) for ahS in seprange) ## The separating graphs279280result = divided_bernoulli(t+1)*(QQ((1,2)) * tautclass1 + tautclass2 )281return (result+0*fundclass(g,n)).simplify(g,n,t)282283284##285## The graphs in the sigma part286def todd_inv_exp_graphs(a,t1,tvect,g,n):287#assume a is ordered288tvn = [tvi for tvi in tvect if tvi != 0]289atn = [ai for ai, tvi in zip(a, tvect) if tvi != 0]290L = len(tvn)291result=0*fundclass(g,n)292if all(atn[i][0] <= atn[i+1][0] and atn[i][1] <= atn[i+1][1]293for i in range(L-1)):294#restrict to the case nonzero elements of tvect give a ordered sequence in a (i.e. each element smaller than or equal to the next).295296Snc = powerset(set(range(1,n+1))-set(atn[-1][1]))#Powerset of complement of Sn297298#The sum of different graphs (bigger than or equal (hn,Sn))299for h in range(atn[-1][0],g+1):300for S in Snc:301#the strictly bigger ones:302if not (h==atn[-1][0] and not S) and not (h==g and n-len(atn[-1][1])-len(S)<2):303vertices = [atn[0][0]] + [atn[i][0] - atn[i-1][0] for i in range(1,L)] + [h - atn[-1][0]] + [g - h]304labels = [atn[0][1] + [n+1] ] + [list(set(atn[i][1]) - set(atn[i-1][1])) + [n+2*i,n+2*i+1] for i in range(1,L)] + [list(set(S)-set(atn[-1][1])) + [n+2*L,n+2*L+1]] + [list(set(range(1,n+1))-set(atn[-1][1])-set(S)) + [n+2*L+2] ]305involution = [(n+2*i+1,n+2*i+2) for i in range(L+1)]306graph=stgraph(vertices,labels,involution)307psi=prod([sum([binomial(tvn[i]-1,j) * (-1)**(tvn[i]-1) * psicl(n+2*i+1,n+2*L+2)**j * psicl(n+2*i+2,n+2*L+2)**(tvn[i]-1-j) for j in range(tvn[i])]) for i in range(L)] + [sum([ (-psicl(n+2*L+1,n+2*L+2))**j * psicl(n+2*L+2,n+2*L+2)**(t1-1-j) for j in range(t1)])])##psi class of graph coinciding graphs. Note last one in a is only on one side and to the power of a[-1].308result+=tautclass([decstratum(graph,poly=psi)])309310# the case where they are equal311if (h==atn[-1][0] and not S):312vertices = [atn[0][0]] + [atn[i][0] - atn[i-1][0] for i in range(1,L)] + [g - atn[-1][0]]313labels = [atn[0][1] + [n+1] ] + [list(set(atn[i][1]) - set(atn[i-1][1])) + [n+2*i,n+2*i+1] for i in range(1,L)] + [list(set(range(1,n+1))-set(atn[-1][1])) + [n+2*L] ]314involution = [(n+2*i+1,n+2*i+2) for i in range(L)]315graph=stgraph(vertices,labels,involution)316psi=prod([sum([binomial(tvn[i]-1,j) * (-1)**(tvn[i]-1) * psicl(n+2*i+1,n+2*L)**j * psicl(n+2*i+2,n+2*L)**(tvn[i]-1-j) for j in range(tvn[i])]) for i in range(L-1)] + [(-psicl(n+2*L-1,n+2*L))**(tvn[-1]) ] + [sum([(-psicl(n+2*L-1,n+2*L))**j * psicl(n+2*L,n+2*L)**(t1-1-j) for j in range(t1)])] )317result+=tautclass([decstratum(graph,poly=psi)])318319#The case of the irreducible graph in Sigma:320if g - atn[-1][0] > 0:321vertices = [atn[0][0]] + [atn[i][0] - atn[i-1][0] for i in range(1,L)] + [g - atn[-1][0]-1]322labels = [atn[0][1] + [n+1] ] + [list(set(atn[i][1]) - set(atn[i-1][1])) + [n+2*i,n+2*i+1] for i in range(1,L)] + [list(set(range(1,n+1))-set(atn[-1][1])) + [n+2*L,n+2*L+1,n+2*L+2] ]323involution = [(n+2*i+1,n+2*i+2) for i in range(L+1)]324graph=stgraph(vertices,labels,involution)325psi=prod([sum([binomial(tvn[i]-1,j) * (-1)**(tvn[i]-1) * psicl(n+2*i+1,n+2*L+2)**j * psicl(n+2*i+2,n+2*L+2)**(tvn[i]-1-j) for j in range(tvn[i])]) for i in range(L)] + [sum([ (-psicl(n+2*L+1,n+2*L+2))**j * psicl(n+2*L+2,n+2*L+2)**(t1-1-j) for j in range(t1)])])326result+=QQ((1,2))*tautclass([decstratum(graph,poly=psi)])327return result328##329##330331332333def generalized_hodge_chern_exp(t,a,g=None,n=None): #The exponential e^C334g, n = handle_g_n(g, n)335#a.sort(key=operator.itemgetter(1,2)) ## Order a to our convention336result=tautclass([])337# loop on Partition of t+1 over elements of ChS, assume a is ordered338for tvect in IntegerVectors(t+1,len(a)):339tvn = [tvi for tvi in tvect if tvi != 0]340atn = [ai for ai, tvi in zip(a, tvect) if tvi != 0]341L = len(tvn)342Scomp = list(set(range(1,n+1))-set(atn[-1][1]))343if all(atn[i][0] <= atn[i+1][0] and atn[i][1] <= atn[i+1][1] for i in range(L-1)) and tvn[-1] > 1 :344vertices = [atn[0][0]] + [atn[i][0] - atn[i-1][0] for i in range(1,L)] + [g - atn[-1][0]]345labels = [atn[0][1] + [n+1] ] + [list(set(atn[i][1]) - set(atn[i-1][1])) + [n+2*i,n+2*i+1] for i in range(1,L)] + [Scomp + [n+2*L] ]346involution = [(n+2*i+1,n+2*i+2) for i in range(L)]347graph=stgraph(vertices,labels,involution)348psi=prod([atn[i][2]**tvn[i] * (-1)**(tvn[i]-1) *349sum([binomial(tvn[i]-1,j) * psicl(n+2*i+1,n+2*L)**j * psicl(n+2*i+2,n+2*L)**(tvn[i]-1-j) for j in range(tvn[i])]) for i in range(L-1)] +350[atn[-1][2]**tvn[-1] * (-1)**(tvn[-1]-1)*351sum([binomial(tvn[-1]-1,j) * psicl(n+2*L-1,n+2*L)**j * psicl(n+2*L,n+2*L)**(tvn[-1]-1-j-1) for j in range(tvn[-1]-1)]) ] )352result+=multinomial(tvn)*tautclass([decstratum(graph,poly=psi)])353return ZZ.one()/ZZ(t+1).factorial()*result354355356def generalized_hodge_chern_K(t,l,a,g,n):#The thing with K357result=tautclass([])358for alpha in range(t+2):359beta = t+1-alpha360result += (divided_bernoulli_polynomial(l,beta)/ZZ(alpha).factorial()) * generalized_hodge_chern_Kin(alpha,beta,a,g,n)361return result362363364def generalized_hodge_chern_S(t,l,d,a,g,n):#The thing with sigma365result=tautclass([])366for alpha in range(t+1):367beta = t+1-alpha368for p in range(1,n+1):369result += sum(((-1)**b * d[p-1]**(beta-b) * divided_bernoulli_polynomial(l,b)/(ZZ(alpha).factorial()*ZZ(beta-b).factorial()))* generalized_hodge_chern_Sin(alpha,beta,p,a,g,n) for b in range(beta+1))370return result371372373374def generalized_hodge_chern_Kin(alpha,beta,a,g,n):375if beta == 0:376return ZZ(alpha).factorial() * generalized_hodge_chern_exp(alpha-1,a,g,n)377if alpha == 0:378return kappaclass(beta-1,g,n)379result=tautclass([])380# Partition of t+1 over elements of ChS, assume a is ordered381for tvect in IntegerVectors(alpha, len(a)):382tvn = [tvi for tvi in tvect if tvi != 0]383atn = [ai for ai, tvi in zip(a, tvect) if tvi != 0]384L = len(tvn)385Scomp = list(set(range(1,n+1))-set(atn[-1][1]))386if all(atn[i][0] <= atn[i+1][0] and atn[i][1] <= atn[i+1][1]387for i in range(L-1)):388vertices = [atn[0][0]] + [atn[i][0] - atn[i-1][0] for i in range(1,L)] + [g - atn[-1][0]]389labels = [atn[0][1] + [n+1] ] + [list(set(atn[i][1]) - set(atn[i-1][1])) + [n+2*i,n+2*i+1] for i in range(1,L)] + [Scomp + [n+2*L] ]390involution = [(n+2*i+1,n+2*i+2) for i in range(L)]391graph=stgraph(vertices,labels,involution)392psi=prod([atn[i][2]**tvn[i] * (-1)**(tvn[i]-1) * sum([binomial(tvn[i]-1,j) * psicl(n+2*i+1,n+2*L)**j * psicl(n+2*i+2,n+2*L)**(tvn[i]-1-j) for j in range(tvn[i])]) for i in range(L)])393kappa=kappacl(L,beta-1,L+1,g - atn[-1][0] , len(Scomp)+1)394result+=multinomial(tvn)*tautclass([decstratum(graph,poly=kappa*psi)])395return result396397398def generalized_hodge_chern_Sin(alpha,beta,p,a,g,n):399if beta == 0:400return ZZ(alpha).factorial() * generalized_hodge_chern_exp(alpha-1,a,g,n)401if alpha == 0:402return (-psiclass(p,g,n))**(beta-1)403result=tautclass([])404# Partition of t+1 over elements of ChS, assume a is ordered405for tvect in IntegerVectors(alpha, len(a)):406tvn = [tvi for tvi in tvect if tvi != 0]407atn = [ai for ai, tvi in zip(a, tvect) if tvi != 0]408L = len(tvn)409Scomp = list(set(range(1,n+1))-set(atn[-1][1]))410if all(atn[i][0] <= atn[i+1][0] and atn[i][1] <= atn[i+1][1]411for i in range(L-1)) and p in Scomp:412vertices = [atn[0][0]] + [atn[i][0] - atn[i-1][0] for i in range(1,L)] + [g - atn[-1][0]]413labels = [atn[0][1] + [n+1] ] + [list(set(atn[i][1]) - set(atn[i-1][1])) + [n+2*i,n+2*i+1] for i in range(1,L)] + [Scomp + [n+2*L] ]414involution = [(n+2*i+1,n+2*i+2) for i in range(L)]415graph=stgraph(vertices,labels,involution)416psi=prod([atn[i][2]**tvn[i] * (-1)**(tvn[i]-1) * sum([binomial(tvn[i]-1,j) * psicl(n+2*i+1,n+2*L)**j * psicl(n+2*i+2,n+2*L)**(tvn[i]-1-j) for j in range(tvn[i])]) for i in range(L)] + [ (-1)**(beta-1)*psicl(p,n+2*L)**(beta-1)])417result+=multinomial(tvn)*tautclass([decstratum(graph,poly=psi)])418return result419420421def twist_div_to_zero(l, d, g=None, n=None):422"""423INPUT:424425- l -- integer426427- d -- list of integers (d_1,...,d_n)428429EXAMPLES::430431sage: from admcycles import *432sage: from admcycles.GRRcomp import *433sage: twist_div_to_zero(3,[3,4],2,2)434[[0, [1, 2], -10], [1, [1], -9], [1, [1, 2], -16]]435"""436g, n = handle_g_n(g, n)437seprange = ([h, [1] + s] for h in range(g + 1)438for s in powerset(range(2, n + 1))439if (h != 0 or s) and (h != g or len(s) <= n - 3))440a = []441for hS0, hS1 in seprange:442ahS = -l*(2*hS0-2+len(hS1)+1) - sum(d[p-1] for p in hS1)443if ahS != 0:444a.append([hS0, hS1, ahS])445return a446447448def generalized_lambda(deg,l,d,a,g=None,n=None):449r"""450Computes the Chern class c_deg of the derived pushforward of a line451bundle \O(D) on the universal curve C_{g,n} over the space Mbar_{g,n} of stable curves.452453A divisor D on C_{g,n} up to pullbacks from Mbar_{g,n} takes the form454455D = l \tilde{K} + sum_{i=1}^n d_i \sigma_i + \sum_{h,S} a_{h,S} C_{h,S}456457where the numbers l, d_i and a_{h,S} are integers, \tilde{K} is the relative canonical458class of the morphism C_{g,n} -> Mbar_{g,n}, \sigma_i is the image of the ith section459and C_{h,S} is the boundary divisor of C_{g,n} where the moving point lies on a genus h460component with markings given by the set S.461For such a divisor this function computes the Chern class462463c_deg(R^\bullet \pi_* \O(D))464465of the derived pushforward R^\bullet \pi_* \O(D) using the formula given in466[Pagani-Ricolfi-van Zelm]. When l=1, d=[0,...,0] and a=[] this coincides with the lambda class.467468NOTE: This formula assumes that the number n of marked points is at least 1.469470INPUT:471472deg : integer473degree of the chern class474l : integer475the coefficient in front of \tilde{K}476d : list477vector of integers (d_1,...,d_n)478a : list479list of triples [h,S,a_{h,S}] where a_{h,S} is nonzero (and S is a subset of [1,...,n] )480g : integer481genus482n : integer483number of markings, for the formula to work we need n > 0484485486EXAMPLES::487488sage: from admcycles import *489sage: from admcycles.GRRcomp import *490sage: l = 1; d = [0]; a = []491sage: t = generalized_lambda(1,l,d,a,2,1);t492Graph : [2] [[1]] []493Polynomial : 1/12*(kappa_1^1 )_0494<BLANKLINE>495Graph : [2] [[1]] []496Polynomial : (-1/12)*psi_1^1497<BLANKLINE>498Graph : [1, 1] [[3], [1, 4]] [(3, 4)]499Polynomial : 1/12*500<BLANKLINE>501Graph : [1] [[3, 4, 1]] [(3, 4)]502Polynomial : 1/24*503sage: t.toTautbasis()504(1/2, -1/2, -1/2)505506We can verify that this computes the lambda class when l=1, d=[0,...,0] and507a=[]. We do this for lambda_2 in \barM_3,1::508509sage: from admcycles import *510sage: from admcycles.GRRcomp import *511sage: reset_g_n(3, 1)512sage: l = 1; d = [0]; a = []513sage: s = lambdaclass(2)514sage: t = generalized_lambda(2, l, d, a)515sage: (s-t).simplify()516<BLANKLINE>517"""518g, n = handle_g_n(g, n)519520def chclass(m):521return generalized_hodge_chern_single(m,l,d,a,g,n)522523chpoly = chern_char_to_poly(chclass,deg,g,n)524chpoly.simplify(g,n,deg)525return chpoly526527def DR_phi(g,d):528r"""529Computes the double ramification cycle DR(g,d) in the case d=[0,...,\pm5301,...,\mp 1,...,0] as described in the paper [Pagani-Ricolfi-van Zelm].531532Input:533534g : integer535the genus536d : vector537the vector d538539EXAMPLES::540541sage: from admcycles import *542sage: from admcycles.GRRcomp import *543sage: DR_phi(1, [1,-1])544Graph : [1] [[1, 2]] []545Polynomial : (-1/12)*(kappa_1^1 )_0546<BLANKLINE>547Graph : [1] [[1, 2]] []548Polynomial : 13/12*psi_1^1549<BLANKLINE>550Graph : [1] [[1, 2]] []551Polynomial : 1/12*psi_2^1552<BLANKLINE>553Graph : [0, 1] [[1, 2, 4], [5]] [(4, 5)]554Polynomial : (-1/12)*555<BLANKLINE>556Graph : [0] [[4, 5, 1, 2]] [(4, 5)]557Polynomial : (-1/24)*558559The different ways of computing the DR cycle coincide when d is of the form560[0,...,\pm 1,...,\mp 1,...,0]::561562sage: from admcycles import *563sage: from admcycles.GRRcomp import *564sage: g = 2; d = [1,-1]565sage: (DR_phi(g,d) - DR_cycle(g,d)).is_zero()566True567568But not for other values of d::569570sage: from admcycles import *571sage: from admcycles.GRRcomp import *572sage: g = 1; d = [2,0]573sage: (DR_phi(g,d)-DR_cycle(g,d)).FZsimplify()574Graph : [1] [[1, 2]] []575Polynomial : (-1)*(kappa_1^1 )_0576<BLANKLINE>577Graph : [1] [[1, 2]] []578Polynomial : 4*psi_1^1579580On the locus of compact type curves we have equality for all vectors d where581the entries sum to 0.::582583sage: from admcycles import *584sage: from admcycles.GRRcomp import *585sage: g = 2; d = [2,-2]586sage: (DR_cycle(g,d) - DR_phi(g,d)).toTautbasis()587(12, -4, 14, 7, -40, -10, -14, -12, 28, -4, 6, -1, 4, 0)588sage: (DR_cycle(g,d) - DR_phi(g,d)).toTautbasis(moduli='ct')589(0, 0, 0, 0, 0)590"""591n=len(d)592a=twist_div_to_zero(0,d,g,n)593return chern_char_to_class(g,-generalized_hodge_chern(0,d,a,g,g,n))594595596def DR_phi1(g,d):597r"""598Alternative to DR_phi using chern_char_to_poly, but this takes a lot longer, kept here599only for testing purposes.600601TESTS::602603sage: from admcycles.GRRcomp import DR_phi, DR_phi1604sage: D1 = DR_phi(2, [1, -1])605sage: D2 = DR_phi1(2, [1, -1])606sage: (D1 - D2).toTautvect().is_zero()607True608"""609n=len(d)610a=twist_div_to_zero(0,d,g,n)611def chclass(m):612temp = generalized_hodge_chern_single(m,0,d,a,g,n)613temp.simplify()614return temp615616chpoly = chern_char_to_poly(chclass,g,g,n)617chpoly.simplify(g,n,g)618return chpoly619620621def hodge_chern_class_matrix(char,p,q,g=None,n=None):622g, n = handle_g_n(g, n)623c = [chern_char_to_class(t,char,g,n) for t in range(q-p+1,q+p)]624return matrix([[c[i+p-1-j] for i in range(p)] for j in range(p)])625626627def generalized_brill_noether_class(r,deg,l,d,a,g=None,n=None):628g, n = handle_g_n(g, n)629p = r+1630q = g-deg+r631char = tautclass([]) + generalized_hodge_chern(l,d,a,q+p-1,g,n)632return hodge_chern_class_matrix(char,p,q,g,n).det()633634635