unlisted
ubuntu2004# -*- coding: utf-8 -*-1r"""2Chern character of the derived pushforward of a line bundle `\O(D)` on3the universal curve C_{g,n} over the space Mbar_{g,n} of stable curves via4the Grothendieck-Riemann-Roch (GRR) formula.56The algorithm implemented is the formula of Theorem 1 from the paper [PRvZ20]_ of7Pagani, Ricolfi and van Zelm. The formula itself is in the function8``generalized_hodge_chern(l,d,a,dmax,g,n)`` where using the notation from [PRvZ20]_:910- ``l`` is the integer l from equation (0.1)11- ``d`` is a list [d_1,...,d_n]12- ``a`` is a list of triples [h,S,a_{h,S}], where h is an integer and S a list13so that [h,S] indicates the graph with two vertices and one edge with genus h14on the left and markings S on the left. The integer a_{h,S} is the15corresponding value to this graph from equation (0.1). Only the graphs with16nonzero a_{h,S} need to be entered.1718- ``dmax`` is the maximal codim to which we want to compute the formula of Theorem 1.19- ``g`` and ``n`` are respectively the genus and the number of marked points2021As described in the paper [PRvZ20]_ this can be used to compute the DR cycle in22certain cases (namely when (d=[0,...,\pm 1,...,\mp 1,...,0]). The DR cycle can23be computed directly in this case by2425DR_phi(g,d)2627The DR cycle can also be computed using [JPPZ17]_. This method has already been28implemented in admcycles.sage as DR_cycle(g,d). To verify that the methods give29the same result modulo Pixton relations one can type:3031(DR_phi(g,d) - DR_cycle(g,d)).is_zero()3233We verified that these classes are the same for d=[1,-1] and g=1,2,3,4. For34higher values of g the computation takes too long. Note that in the case of35g=4 these are codimension 4 classes. The ring R^4(M_4,2) is generated by 399036distinct decorated stratum classes, so this is a serious check on the37correctness of these formula's. Note also that the two methods do not give the38same result if we do not mod out by Pixton relations. i.e.3940(DR_phi(g,d) - DR_cycle(g,d)).simplify()4142is not zero.43"""44import operator4546from .admcycles import tautclass, decstratum, stgraph, psicl, kappacl, psiclass, kappaclass47from .admcycles import chern_char_to_poly, chern_char_to_class, fundclass4849from sage.rings.all import ZZ, QQ50from sage.matrix.constructor import matrix51from sage.misc.misc import powerset52from sage.misc.misc_c import prod53from sage.arith.all import bernoulli, binomial, multinomial54from sage.combinat.all import bernoulli_polynomial, IntegerVectors555657def divided_bernoulli(n):58"""59Return Bernoulli number of index ``n`` divided by ``n!``.6061EXAMPLES::6263sage: from admcycles import *64sage: from admcycles.GRRcomp import *65sage: divided_bernoulli(12)66-691/130767436800067"""68return bernoulli(n) / ZZ(n).factorial()697071def divided_bernoulli_polynomial(l, n):72"""73Return Bernoulli polynomial of index ``n`` at ``l``, divided by ``n!``.7475EXAMPLES::7677sage: from admcycles import *78sage: from admcycles.GRRcomp import *79sage: x = polygen(QQ,'x')80sage: divided_bernoulli_polynomial(x,4)811/24*x^4 - 1/12*x^3 + 1/24*x^2 - 1/72082"""83return bernoulli_polynomial(l, n) / ZZ(n).factorial()848586def handle_g_n(g, n):87"""88Helper function that fetches the global ``g`` and ``n`` parameters.8990See also :func:`admcycles.reset_g_n`.9192The global ``g`` and ``n`` should rather be replaced by the creation93of an object ``MMbar(g, n)`` with attributes ``g`` and ``n``.94"""95if g is None:96from .admcycles import g97if n is None:98from .admcycles import n99return g, n100101102def generalized_hodge_chern(l, d, a, dmax=None, g=None, n=None):103r"""104Computes the Chern character of the derived pushforward of a line bundle \O(D) on105the universal curve C_{g,n} over the space Mbar_{g,n} of stable curves.106107A divisor D on C_{g,n} up to pullbacks from Mbar_{g,n} takes the form108109D = l \tilde{K} + sum_{i=1}^n d_i \sigma_i + \sum_{h,S} a_{h,S} C_{h,S}110111where the numbers l, d_i and a_{h,S} are integers, \tilde{K} is the relative canonical112class of the morphism C_{g,n} -> Mbar_{g,n}, \sigma_i is the image of the ith section113and C_{h,S} is the boundary divisor of C_{g,n} where the moving point lies on a genus h114component with markings given by the set S.115For such a divisor this function computes the Chern character116117ch(R^\bullet \pi_* \O(D))118119up to codimension dmax using the formula given in [PRvZ20]_.120121NOTE: This formula assumes that the number n of marked points is at least 1.122123INPUT:124125l : integer126the coefficient in front of \tilde{K}127d : list128vector of integers (d_1,...,d_n)129a : list130list of triples [h,S,a_{h,S}] where a_{h,S} is nonzero (and S is a subset of [1,...,n] )131dmax : integer132maximum codimension, set to 3g+3-n by default133g : integer134genus135n : integer136number of markings, for the formula to be correct we need at least one137138EXAMPLES::139140sage: from admcycles import *141sage: from admcycles.GRRcomp import *142sage: g=1;n=2143sage: l=0;d=[1,-1];a=[[1,[],-1]]144sage: generalized_hodge_chern(l,d,a,1,g,n)145Graph : [1] [[1, 2]] []146Polynomial : 1/12*(kappa_1)_0 - 13/12*psi_1 - 1/12*psi_2147<BLANKLINE>148Graph : [0] [[4, 5, 1, 2]] [(4, 5)]149Polynomial : 1/24150<BLANKLINE>151Graph : [0, 1] [[1, 2, 4], [5]] [(4, 5)]152Polynomial : -11/12153"""154g, n = handle_g_n(g, n)155if dmax is None:156dmax = 3 * g - 3 + n157158return sum(generalized_hodge_chern_single(t, l, d, a, g, n) for t in range(1, dmax + 1))159160161def generalized_hodge_chern_single(t, l, d, a, g=None, n=None):162r"""163Computes the degree t part of the Chern character of the derived pushforward of a line164bundle \O(D) on the universal curve C_{g,n} over the space Mbar_{g,n} of stable curves.165166A divisor D on C_{g,n} up to pullbacks from Mbar_{g,n} takes the form167168D = l \tilde{K} + sum_{i=1}^n d_i \sigma_i + \sum_{h,S} a_{h,S} C_{h,S}169170where the numbers l, d_i and a_{h,S} are integers, \tilde{K} is the relative canonical171class of the morphism C_{g,n} -> Mbar_{g,n}, \sigma_i is the image of the ith section172and C_{h,S} is the boundary divisor of C_{g,n} where the moving point lies on a genus h173component with markings given by the set S.174For such a divisor this function computes the degree t part175176ch_t(R^\bullet \pi_* \O(D))177178of the Chern character of R^\bullet \pi_* \O(D) using the formula given in179[PRvZ20]_.180181NOTE: This formula assumes that the number n of marked points is at least 1.182183EXAMPLES::184185sage: from admcycles import *186sage: from admcycles.GRRcomp import *187sage: l=0; d=[1,-1]; a=[[1,[],-1]]188sage: generalized_hodge_chern_single(1, l, d, a, 1, 2)189Graph : [1] [[1, 2]] []190Polynomial : 1/12*(kappa_1)_0 - 13/12*psi_1 - 1/12*psi_2191<BLANKLINE>192Graph : [0] [[4, 5, 1, 2]] [(4, 5)]193Polynomial : 1/24194<BLANKLINE>195Graph : [0, 1] [[1, 2, 4], [5]] [(4, 5)]196Polynomial : -11/12197198TESTS::199200sage: reset_g_n(1, 2)201doctest:...: DeprecationWarning: reset_g_n is deprecated. Please use TautologicalRing instead.202See https://gitlab.com/modulispaces/admcycles/-/merge_requests/109 for details.203sage: generalized_hodge_chern_single(1, l, d, a)204Graph : [1] [[1, 2]] []205Polynomial : 1/12*(kappa_1)_0 - 13/12*psi_1 - 1/12*psi_2206<BLANKLINE>207Graph : [0] [[4, 5, 1, 2]] [(4, 5)]208Polynomial : 1/24209<BLANKLINE>210Graph : [0, 1] [[1, 2, 4], [5]] [(4, 5)]211Polynomial : -11/12212"""213g, n = handle_g_n(g, n)214if n == 0:215raise ValueError('There needs to be at least one marked point for generalized_hodge_chern_single to work')216217a.sort(key=operator.itemgetter(1, 2)) # Order a to our convention218result = generalized_hodge_chern_K(t, l, a, g, n) + generalized_hodge_chern_S(t, l,219d, a, g, n) + todd_inv_exp(a, t, g, n) # -generalized_hodge_chern_exp(t,a,g,n)220result = result.degree_part(t)221result.simplify()222return result223224225def todd_inv_exp(a, t, g=None, n=None):226"""227EXAMPLES::228229sage: from admcycles import *230sage: from admcycles.GRRcomp import *231sage: todd_inv_exp([],1,1,2)232Graph : [0] [[4, 5, 1, 2]] [(4, 5)]233Polynomial : 1/24234<BLANKLINE>235Graph : [0, 1] [[1, 2, 4], [5]] [(4, 5)]236Polynomial : 1/12237"""238g, n = handle_g_n(g, n)239a.sort(key=operator.itemgetter(1, 2)) # Order a to our convention240result = tautclass([], g, n)241for t1 in range(1, t, 2):242coeff_t1 = divided_bernoulli(t1 + 1) / ZZ(t - t1).factorial()243for tvect in IntegerVectors(t - t1, len(a)):244result += coeff_t1 * prod(ai[2]**tvecti for ai, tvecti in zip(a, tvect)) * \245multinomial(tvect) * todd_inv_exp_graphs(a, t1, tvect, g, n)246result += todd_inv_sigma(t, g, n)247return result248249250##251# The case without the graphs252def todd_inv_sigma(t, g, n):253if t % 2 == 0:254return tautclass([], g, n)255256if n > 0:257seprange = [[h, [1] + s] for h in range(g + 1) for s in powerset(range(2, n + 1))258if not (h == 0 and not s) and not (h == g and len(s) > n - 3)]259else:260seprange = [[h, []] for h in range(1, g // 2 + 1)]261# The list [h,S] of possible nonisomorphic irreducible codimension 1 graphs262decsum = sum((-psicl(n + 1, n + 2))**i * psicl(n + 2, n + 2)**(t - 1 - i) for i in range(t)) # The decoration263tautclass1 = tautclass([decstratum(stgraph([g - 1], [list(range(1, n + 3))],264[(n + 1, n + 2)]), poly=decsum)], g, n) # The irreducible graph265tautclass2 = sum(tautclass([decstratum(stgraph([ahS[0], g - ahS[0]], [ahS[1] + [n + 1], list(set(range(1, n + 1)) - set(266ahS[1])) + [n + 2]], [(n + 1, n + 2)]), poly=decsum)], g, n) for ahS in seprange) # The separating graphs267268result = divided_bernoulli(t + 1) * (QQ((1, 2)) * tautclass1 + tautclass2)269result = result.degree_part(t)270result.simplify()271return result272273274##275# The graphs in the sigma part276def todd_inv_exp_graphs(a, t1, tvect, g, n):277r"""278TESTS:279280We check that https://gitlab.com/modulispaces/admcycles/-/merge_requests/149 does not reappear::281282sage: from admcycles.GRRcomp import todd_inv_exp_graphs283sage: len(todd_inv_exp_graphs([[1, [1], -1]], 1, [1], 3, 2)._terms) == 5284True285"""286# assume a is ordered287tvn = [tvi for tvi in tvect if tvi != 0]288atn = [ai for ai, tvi in zip(a, tvect) if tvi != 0]289L = len(tvn)290result = 0 * fundclass(g, n)291if all(atn[i][0] <= atn[i + 1][0] and atn[i][1] <= atn[i + 1][1]292for i in range(L - 1)):293# 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).294295Snc = list(powerset(set(range(1, n + 1)) - set(atn[-1][1]))) # Powerset of complement of Sn296297# The sum of different graphs (bigger than or equal (hn,Sn))298for h in range(atn[-1][0], g + 1):299for S in Snc:300# the strictly bigger ones:301if not (h == atn[-1][0] and not S) and not (h == g and n - len(atn[-1][1]) - len(S) < 2):302vertices = [atn[0][0]] + [atn[i][0] - atn[i - 1][0]303for 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(305set(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]]306involution = [(n + 2 * i + 1, n + 2 * i + 2) for i in range(L + 1)]307graph = stgraph(vertices, labels, involution)308psi = 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(309[(-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].310result += tautclass([decstratum(graph, poly=psi)], g, n)311312# the case where they are equal313if (h == atn[-1][0] and not S):314vertices = [atn[0][0]] + [atn[i][0] - atn[i - 1][0] for i in range(1, L)] + [g - atn[-1][0]]315labels = [atn[0][1] + [n + 1]] + [list(set(atn[i][1]) - set(atn[i - 1][1])) + [n + 2 * i, n + 2 * i + 1]316for i in range(1, L)] + [list(set(range(1, n + 1)) - set(atn[-1][1])) + [n + 2 * L]]317involution = [(n + 2 * i + 1, n + 2 * i + 2) for i in range(L)]318graph = stgraph(vertices, labels, involution)319psi = 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])])320for 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)])])321result += tautclass([decstratum(graph, poly=psi)], g, n)322323# The case of the irreducible graph in Sigma:324if g - atn[-1][0] > 0:325vertices = [atn[0][0]] + [atn[i][0] - atn[i - 1][0] for i in range(1, L)] + [g - atn[-1][0] - 1]326labels = [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(3271, L)] + [list(set(range(1, n + 1)) - set(atn[-1][1])) + [n + 2 * L, n + 2 * L + 1, n + 2 * L + 2]]328involution = [(n + 2 * i + 1, n + 2 * i + 2) for i in range(L + 1)]329graph = stgraph(vertices, labels, involution)330psi = 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)331for 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)])])332result += QQ((1, 2)) * tautclass([decstratum(graph, poly=psi)], g, n)333return result334##335##336337338def generalized_hodge_chern_exp(t, a, g=None, n=None): # The exponential e^C339g, n = handle_g_n(g, n)340# a.sort(key=operator.itemgetter(1,2)) ## Order a to our convention341result = tautclass([], g, n)342# loop on Partition of t+1 over elements of ChS, assume a is ordered343for tvect in IntegerVectors(t + 1, len(a)):344tvn = [tvi for tvi in tvect if tvi != 0]345atn = [ai for ai, tvi in zip(a, tvect) if tvi != 0]346L = len(tvn)347Scomp = list(set(range(1, n + 1)) - set(atn[-1][1]))348if 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:349vertices = [atn[0][0]] + [atn[i][0] - atn[i - 1][0] for i in range(1, L)] + [g - atn[-1][0]]350labels = [atn[0][1] + [n + 1]] + [list(set(atn[i][1]) - set(atn[i - 1][1])) +351[n + 2 * i, n + 2 * i + 1] for i in range(1, L)] + [Scomp + [n + 2 * L]]352involution = [(n + 2 * i + 1, n + 2 * i + 2) for i in range(L)]353graph = stgraph(vertices, labels, involution)354psi = prod([atn[i][2]**tvn[i] * (-1)**(tvn[i] - 1) *355sum([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)] +356[atn[-1][2]**tvn[-1] * (-1)**(tvn[-1] - 1) *357sum([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)])])358result += multinomial(tvn) * tautclass([decstratum(graph, poly=psi)], g, n)359return ZZ.one() / ZZ(t + 1).factorial() * result360361362def generalized_hodge_chern_K(t, l, a, g, n): # The thing with K363result = tautclass([], g, n)364for alpha in range(t + 2):365beta = t + 1 - alpha366result += (divided_bernoulli_polynomial(l, beta) / ZZ(alpha).factorial()) * \367generalized_hodge_chern_Kin(alpha, beta, a, g, n)368return result369370371def generalized_hodge_chern_S(t, l, d, a, g, n): # The thing with sigma372result = tautclass([], g, n)373for alpha in range(t + 1):374beta = t + 1 - alpha375for p in range(1, n + 1):376result += sum(((-1)**b * d[p - 1]**(beta - b) * divided_bernoulli_polynomial(l, b) / (ZZ(alpha).factorial() * ZZ(377beta - b).factorial())) * generalized_hodge_chern_Sin(alpha, beta, p, a, g, n) for b in range(beta + 1))378return result379380381def generalized_hodge_chern_Kin(alpha, beta, a, g, n):382if beta == 0:383return ZZ(alpha).factorial() * generalized_hodge_chern_exp(alpha - 1, a, g, n)384if alpha == 0:385return kappaclass(beta - 1, g, n)386result = tautclass([], g, n)387# Partition of t+1 over elements of ChS, assume a is ordered388for tvect in IntegerVectors(alpha, len(a)):389tvn = [tvi for tvi in tvect if tvi != 0]390atn = [ai for ai, tvi in zip(a, tvect) if tvi != 0]391L = len(tvn)392Scomp = list(set(range(1, n + 1)) - set(atn[-1][1]))393if all(atn[i][0] <= atn[i + 1][0] and atn[i][1] <= atn[i + 1][1]394for i in range(L - 1)):395vertices = [atn[0][0]] + [atn[i][0] - atn[i - 1][0] for i in range(1, L)] + [g - atn[-1][0]]396labels = [atn[0][1] + [n + 1]] + [list(set(atn[i][1]) - set(atn[i - 1][1])) +397[n + 2 * i, n + 2 * i + 1] for i in range(1, L)] + [Scomp + [n + 2 * L]]398involution = [(n + 2 * i + 1, n + 2 * i + 2) for i in range(L)]399graph = stgraph(vertices, labels, involution)400psi = prod([atn[i][2]**tvn[i] * (-1)**(tvn[i] - 1) * sum([binomial(tvn[i] - 1, j) * psicl(n + 2 * i + 1, n + 2 * L)401** j * psicl(n + 2 * i + 2, n + 2 * L)**(tvn[i] - 1 - j) for j in range(tvn[i])]) for i in range(L)])402kappa = kappacl(L, beta - 1, L + 1, g - atn[-1][0], len(Scomp) + 1)403result += multinomial(tvn) * tautclass([decstratum(graph, poly=kappa * psi)], g, n)404return result405406407def generalized_hodge_chern_Sin(alpha, beta, p, a, g, n):408if beta == 0:409return ZZ(alpha).factorial() * generalized_hodge_chern_exp(alpha - 1, a, g, n)410if alpha == 0:411return (-psiclass(p, g, n))**(beta - 1)412result = tautclass([], g, n)413# Partition of t+1 over elements of ChS, assume a is ordered414for tvect in IntegerVectors(alpha, len(a)):415tvn = [tvi for tvi in tvect if tvi != 0]416atn = [ai for ai, tvi in zip(a, tvect) if tvi != 0]417L = len(tvn)418Scomp = list(set(range(1, n + 1)) - set(atn[-1][1]))419if all(atn[i][0] <= atn[i + 1][0] and atn[i][1] <= atn[i + 1][1]420for i in range(L - 1)) and p in Scomp:421vertices = [atn[0][0]] + [atn[i][0] - atn[i - 1][0] for i in range(1, L)] + [g - atn[-1][0]]422labels = [atn[0][1] + [n + 1]] + [list(set(atn[i][1]) - set(atn[i - 1][1])) +423[n + 2 * i, n + 2 * i + 1] for i in range(1, L)] + [Scomp + [n + 2 * L]]424involution = [(n + 2 * i + 1, n + 2 * i + 2) for i in range(L)]425graph = stgraph(vertices, labels, involution)426psi = 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 *427i + 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)])428result += multinomial(tvn) * tautclass([decstratum(graph, poly=psi)], g, n)429return result430431432def twist_div_to_zero(l, d, g=None, n=None):433"""434INPUT:435436- l -- integer437438- d -- list of integers (d_1,...,d_n)439440EXAMPLES::441442sage: from admcycles import *443sage: from admcycles.GRRcomp import *444sage: twist_div_to_zero(3,[3,4],2,2)445[[0, [1, 2], -10], [1, [1], -9], [1, [1, 2], -16]]446"""447g, n = handle_g_n(g, n)448seprange = ([h, [1] + s] for h in range(g + 1)449for s in powerset(range(2, n + 1))450if (h != 0 or s) and (h != g or len(s) <= n - 3))451a = []452for hS0, hS1 in seprange:453ahS = -l * (2 * hS0 - 2 + len(hS1) + 1) - sum(d[p - 1] for p in hS1)454if ahS != 0:455a.append([hS0, hS1, ahS])456return a457458459def generalized_lambda(deg, l, d, a, g=None, n=None):460r"""461Computes the Chern class c_deg of the derived pushforward of a line462bundle \O(D) on the universal curve C_{g,n} over the space Mbar_{g,n} of stable curves.463464A divisor D on C_{g,n} up to pullbacks from Mbar_{g,n} takes the form465466D = l \tilde{K} + sum_{i=1}^n d_i \sigma_i + \sum_{h,S} a_{h,S} C_{h,S}467468where the numbers l, d_i and a_{h,S} are integers, \tilde{K} is the relative canonical469class of the morphism C_{g,n} -> Mbar_{g,n}, \sigma_i is the image of the ith section470and C_{h,S} is the boundary divisor of C_{g,n} where the moving point lies on a genus h471component with markings given by the set S.472For such a divisor this function computes the Chern class473474c_deg(R^\bullet \pi_* \O(D))475476of the derived pushforward R^\bullet \pi_* \O(D) using the formula given in477[PRvZ20]_. When l=1, d=[0,...,0] and a=[] this coincides with the lambda class.478479NOTE: This formula assumes that the number n of marked points is at least 1.480481INPUT:482483deg : integer484degree of the chern class485l : integer486the coefficient in front of \tilde{K}487d : list488vector of integers (d_1,...,d_n)489a : list490list of triples [h,S,a_{h,S}] where a_{h,S} is nonzero (and S is a subset of [1,...,n] )491g : integer492genus493n : integer494number of markings, for the formula to work we need n > 0495496497EXAMPLES::498499sage: from admcycles import *500sage: from admcycles.GRRcomp import *501sage: l = 1; d = [0]; a = []502sage: t = generalized_lambda(1,l,d,a,2,1);t503Graph : [2] [[1]] []504Polynomial : 1/12*(kappa_1)_0 - 1/12*psi_1505<BLANKLINE>506Graph : [1] [[3, 4, 1]] [(3, 4)]507Polynomial : 1/24508<BLANKLINE>509Graph : [1, 1] [[3], [1, 4]] [(3, 4)]510Polynomial : 1/12511sage: t.basis_vector()512(1/2, -1/2, -1/2)513514We can verify that this computes the lambda class when l=1, d=[0,...,0] and515a=[]. We do this for lambda_2 in \barM_3,1::516517sage: from admcycles import *518sage: from admcycles.GRRcomp import *519sage: reset_g_n(3, 1)520doctest:...: DeprecationWarning: reset_g_n is deprecated. Please use TautologicalRing instead.521See https://gitlab.com/modulispaces/admcycles/-/merge_requests/109 for details.522sage: l = 1; d = [0]; a = []523sage: s = lambdaclass(2)524doctest:...: DeprecationWarning: Use of lambdaclass without specifying g,n is deprecated.525See https://gitlab.com/modulispaces/admcycles/-/merge_requests/109 for details.526sage: t = generalized_lambda(2, l, d, a)527sage: (s-t).simplify()5280529"""530g, n = handle_g_n(g, n)531532def chclass(m):533return generalized_hodge_chern_single(m, l, d, a, g, n)534535chpoly = chern_char_to_poly(chclass, deg, g, n).degree_part(deg)536chpoly.simplify()537return chpoly538539540def DR_phi(g, d):541r"""542Computes the double ramification cycle DR(g,d) in the case d=[0,...,\pm5431,...,\mp 1,...,0] as described in the paper [PRvZ20]_.544545Input:546547g : integer548the genus549d : vector550the vector d551552EXAMPLES::553554sage: from admcycles import *555sage: from admcycles.GRRcomp import *556sage: DR_phi(1, [1,-1])557Graph : [1] [[1, 2]] []558Polynomial : -1/12*(kappa_1)_0 + 13/12*psi_1 + 1/12*psi_2559<BLANKLINE>560Graph : [0] [[4, 5, 1, 2]] [(4, 5)]561Polynomial : -1/24562<BLANKLINE>563Graph : [0, 1] [[1, 2, 4], [5]] [(4, 5)]564Polynomial : -1/12565566The different ways of computing the DR cycle coincide when d is of the form567[0,...,\pm 1,...,\mp 1,...,0]::568569sage: from admcycles import *570sage: from admcycles.GRRcomp import *571sage: g = 2; d = [1,-1]572sage: (DR_phi(g,d) - DR_cycle(g,d)).is_zero()573True574575But not for other values of d::576577sage: from admcycles import *578sage: from admcycles.GRRcomp import *579sage: g = 1; d = [2,0]580sage: (DR_phi(g,d)-DR_cycle(g,d)).FZsimplify()581Graph : [1] [[1, 2]] []582Polynomial : -(kappa_1)_0 + 4*psi_1583584On the locus of compact type curves we have equality for all vectors d where585the entries sum to 0.::586587sage: from admcycles import *588sage: from admcycles.GRRcomp import *589sage: g = 2; d = [2,-2]590sage: (DR_cycle(g,d) - DR_phi(g,d)).basis_vector()591(12, -4, 14, 7, -40, -10, -14, -12, 28, -4, 6, -1, 4, 0)592sage: (DR_cycle(g,d) - DR_phi(g,d)).toTautbasis(moduli='ct')593doctest:...: DeprecationWarning: toTautbasis is deprecated. Please use basis_vector instead.594See https://gitlab.com/modulispaces/admcycles/-/merge_requests/109 for details.595(0, 0, 0, 0, 0)596"""597n = len(d)598a = twist_div_to_zero(0, d, g, n)599return chern_char_to_class(g, -generalized_hodge_chern(0, d, a, g, g, n))600601602def DR_phi1(g, d):603r"""604Alternative to DR_phi using chern_char_to_poly, but this takes a lot longer, kept here605only for testing purposes.606607TESTS::608609sage: from admcycles.GRRcomp import DR_phi, DR_phi1610sage: D1 = DR_phi(2, [1, -1])611sage: D2 = DR_phi1(2, [1, -1])612sage: (D1 - D2).is_empty()613True614"""615n = len(d)616a = twist_div_to_zero(0, d, g, n)617618def chclass(m):619temp = generalized_hodge_chern_single(m, 0, d, a, g, n)620temp.simplify()621return temp622623chpoly = chern_char_to_poly(chclass, g, g, n).degree_part(g)624chpoly.simplify()625return chpoly626627628def hodge_chern_class_matrix(char, p, q, g=None, n=None):629g, n = handle_g_n(g, n)630c = [chern_char_to_class(t, char, g, n) for t in range(q - p + 1, q + p)]631return matrix([[c[i + p - 1 - j] for i in range(p)] for j in range(p)])632633634def generalized_brill_noether_class(r, deg, l, d, a, g=None, n=None):635g, n = handle_g_n(g, n)636p = r + 1637q = g - deg + r638char = tautclass([], g, n) + generalized_hodge_chern(l, d, a, q + p - 1, g, n)639return hodge_chern_class_matrix(char, p, q, g, n).det()640641642