Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
181 views
unlisted
ubuntu2004
o

��c(;�@s�dZddlmZddlZddlZddlmZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZmZddlmZddlmZmZddlmZdd	lmZmZmZdd
lmZddlm Z ddl!m"Z"dd
l#m$Z$ddl%m&Z&ddl'm(Z(ddl)m)Z)ddl*m+Z+dd�Z,dd�Z-dde	fdd�Z.dddddde	fdd�Z/dddddde	fdd�Z0ddddde	fdd �Z1ddddde	fd!d"�Z2d)d%d&�Z3e+d'd(��Z4dS)*z�
Code for computations involving Witten's r-spin class.
Authors: Felix Janda (main author), Aaron Pixton (code improvements), Johannes Schmitt (integration into admcycles)
�)�IterableN)�	tautclass)
�X�	MODULI_ST�	MODULI_RT�	MODULI_CT�	MODULI_SM�single_stratum�autom_count�interpolate�
num_strata� convert_vector_to_monomial_basis)�TautologicalRing)�	factorial�lcm)�ceil)�PolynomialRing�QQ�ZZ)�vector)�MPolynomial)�Integer)�var)�symbolic_sum)�SR)�copy)�cached_functioncCs |dkrt|}t|�j|d�S)Nr��a)r�Pmpolynomial�subs)�dr�r"�4/home/user/Introduction lectures/admcycles/witten.py�rspin_leg_factor!sr$c		Cs�ttdd�}|��d}||d}d}t|d�D],}||t||||d�|d�t|||d|||d�|d�||�7}q||d}|��dksUJ�|��}||S)N�rr�r�)rr�gens�ranger$�denominator�	numerator)	�w1�m�d1�d2�Rrr!�S�ir"r"r#�rspin_edge_factor's&�
�
r3r"c	snttd|d��}t|||||���j��}�j��}g}	g}
dt|||||�}�fdd�t|d�D�}td|�D]P}
td�j|
df��d�D]?�|t�j|
df��}|d�j|
df�9}|t	�d��j|
df�9}||
d��j|
df�8<qKq;td|�D]����fdd�td|�D�}�jd�fdkr�t
|�dkr�|d}|d}�j|�fd}�j|�fd}n|d}|d}�j|�fd}�j|�fd}|	�|d|dg�|
�|�|
�|�q��j|d�fd}|t	||�jd�fdd�9}||dd|�jd�fdd|7<q�|	|
||fS)Nr%cs&g|]}d�j|ddfd�qS�r%r��M��.0r2)�Gr"r#�
<listcomp>>s&z%rspin_coeff_setup.<locals>.<listcomp>r�����cs"g|]
}�j|�fdkr|�qS)rr5r7�r9�jr"r#r:Fs"r')�tupler)r	r6�nrows�ncolsr
�degreerr$�len�append)�num�g�r�n�dvector�moduli_type�markings�nr�nc�	edge_list�exp_list�
scalar_factor�
given_weightsr2�ilist�i1�i2�exp1�exp2r"r<r#�rspin_coeff_setup6sD

  (�
$4rVr%r;c
s�ttd|d��}
t||||
|	�}|j��}|j��}
t||||||	�\}}}}|dkrBttdd�|D��d�|dd|}n|}|
||d}|dkr]dt|�dt	|�}n|}|durvt
t||||||d|��}n|g}g}|D]���fdd�|D�}d}tj�fdd�tt	|��D��D]m}t
|�}tt	|��D].}|||d||7<|||d||d|d||d|d8<q�t	�fd	d�|D��dkr�q�d}tt	|��D]}|t||�|d||d|d�9}q�||7}q�|du�r|�|t�d�|�q}|�td�|||t�d�|||t��|�q}td�||t||�jtd
�|��}|du�r`t|j|d��}|S)Nr%r;cSsg|]
}t|jdd���qS)rr&)�absr r7r"r"r#r:es�zrspin_coeff.<locals>.<listcomp>r'csg|]
}t|j�d���qS)r&)rr r7�r-r"r#r:t�rcsg|]
}tt�d���qS)r%)�listr)r7rXr"r#r:wrYcs g|]}|�ddkr|�qSr4r"r7rXr"r#r:}s )�xr&)r>r)r	r6r?r@rVr�sumrBrZ�	itertools�productrr3rCrrr r�simplify_rationalr)rDrErFrGrH�r_coeff�stepZm0givenZdeggivenrIrJr9rKrLrMrNrPrO�m0�h0�deg�mrange�mvaluesZgiven_weights_m�total�weight_data�vertex_weightsr2�term�mpolyr"rXr#�rspin_coeff\s�

�
�����&��
�
�
�

 ����
rlc	CsVg}	ttd|d��}
tt|||
|��D]}|	�t||||||||||�
�qt|	�S�Nr%)r>r)rrCrlr)rErFrGrHr`rarbrdrI�answerrJr2r"r"r#�
rspin_compute�s
�roc
CsVg}ttd|d��}	tt|||	|��D]}
|�t|
||||||||�	�t��q|Srm)r>r)rrCrlrAr�rErFrGrHrarbrdrIrnrJr2r"r"r#�rspin_degree_test�s��rqc
Cs\g}ttd|d��}	tt|||	|��D]}
|�t|
||||||||�	jdd��qt|�S)Nr%rr&)r>r)rrCrlr rrpr"r"r#�rspin_constant�s�
�rrF�stcs�t|�}|dur�dd�|D�}t|�dkr"|d��}|��d�nttdd�}|��d�t�d�}	g}
g�g�|D]s}t|tj	�rY|
�
t|����
td����
t|��q;t|t�r�|
�
t|d�|	t|d����
t|d����
t|d��q;t|t
�r�|
�
t|d�|	t|d����
t|d����
t|d��q;td��t��fd	d
�t|�D��r�tg�Stdd
��D��}t��}
|
tvs�J�t��d|dks�J�n	d
d�|D�}
d}|du�r|dur�t|d|
�}n!t|d|dt|��}||dk�rtg�St|t|��}ttttd�}||}t|||t|
�||dd|d�	}|�s@|jdd�}t|||ttd|d��|�}|�r]t�fdd
�|D��}t|||d�}|�||�S)aZ
    Returns the polynomial limit of Witten's r-spin class in genus g with input Avector,
    as discussed in the appendix of [Pandharipande-Pixton-Zvonkine '16].

    More precisely, Avector is expected to be a vector of linear polynomials in QQ[r],
    with leading coefficients being rational numbers in the interval [0,1] and constant
    coefficients being integers. Elements of Avector should sum to C * r + 2g-2 for some
    nonnegative integer C. Then Wittenrspin returns the tautological class obtained as
    the limit of

    r^(g-1+C) W_{g,n}^r(Avector)

    for r >> 0 sufficiently large and divisible, evaluated at r=0.

    INPUT:

    - ``g`` -- integer; underlying genus

    - ``Avector``   -- tuple ; a tuple of either integers, elements of a polynomial
      ring QQ[r] in some variable r or tuples (C_i, D_i) which are interpreted as
      polynomials C_i * r + D_i. For the entries with C_i = 1 we assume D_i <=-2.

    - ``r_coeff``  -- integer or None (default: `None`); if a particular integer
      r_coeff = r is specified, the function will return the (unscaled) class W_{g,n}^r(Avector),
      not taking a limit for large r.

    - ``d`` -- integer; desired degree in tautological ring; will be set to g-1+C by
      default

    - ``rpoly``  -- bool (default: `False`); if True, return the limit of
      r^(g-1+C) W_{g,n}^r(Avector) without evaluating at r=0, as a tautclass with
      coefficients being polynomials in r

    EXAMPLES:

    We start by verifying the conjecture from the appendix of [Pandharipande-Pixton-Zvonkine '16]
    for g = 2 and mu = (2)::

      sage: from admcycles import Wittenrspin, Strataclass
      sage: H1 = Wittenrspin(2, (2,))
      sage: H2 = Strataclass(2, 1, (2,))
      sage: (H1-H2).is_zero()
      True

    We can also verify a new conjecture for classes of strata of meromorphic differentials for
    g = 1 and mu = (3,-1,-2). The argument (1/2,-1) stands for an insertion 1/2 * r -1::

      sage: H1 = Wittenrspin(1, (3, (1/2,-1), (1/2,-2)))
      sage: H2 = Strataclass(1, 1, (3,-1,-2))
      sage: (H1+H2).is_zero()
      True

    As a variant of this, we also verify that insertions r-b stand for poles of order b with
    vanishing residues::

      sage: R.<r> = PolynomialRing(QQ,1)
      sage: H1 = Wittenrspin(1, (5,r-2, r-3))
      sage: H2 = Strataclass(1, 1, (5,-2,-3), res_cond=(2,))
      sage: (H1+H2).is_zero()
      True

    We can also compute the (scaled) Witten's class without substituting r=0::

      sage: Wittenrspin(1,(2,r-2),rpoly=True)
      Graph :      [1] [[1, 2]] []
      Polynomial : (1/12*r^2 - 5/24*r + 1/12)*(kappa_1)_0 + (-1/12*r^2 + 29/24*r - 37/12)*psi_1 + (-1/12*r^2 + 17/24*r - 13/12)*psi_2
      <BLANKLINE>
      Graph :      [0] [[4, 5, 1, 2]] [(4, 5)]
      Polynomial : -1/48*r + 1/24
      <BLANKLINE>
      Graph :      [0, 1] [[1, 2, 4], [5]] [(4, 5)]
      Polynomial : 1/12*r^2 - 17/24*r + 13/12

    Instead of calculating the asymptotic, polynomial behaviour of Witten's class,
    we can also input a concrete value for r, using the option r_coeff. Below we
    verify the CohFT property of Witten's class, first for a separating boundary
    divisor::

      sage: from admcycles import StableGraph
      sage: A = Wittenrspin(2,(1,1),r_coeff=4)
      sage: gr = StableGraph([1,1],[[1,2,3],[4]],[(3,4)])
      sage: pb = gr.boundary_pullback(A)
      sage: vector(pb.totensorTautbasis(1)[1])
      (0, 3/4, 0, 3/4, 3/4)
      sage: B = Wittenrspin(1,(1,1,2),r_coeff=4)
      sage: B.basis_vector()
      (0, 1/4, 0, 1/4, 1/4)
      sage: C = Wittenrspin(1,(0,),r_coeff=4)
      sage: C.basis_vector()
      (3)

    Then for a nonseparating boundary divisor::

      sage: B = Wittenrspin(2,(2,),r_coeff=4)
      sage: gr = StableGraph([1],[[1,2,3]],[(2,3)])
      sage: pb = gr.boundary_pullback(B)
      sage: pb.totensorTautbasis(1)
      (0, 1/2, 1/4, 1/4, -1/4)
      sage: A1 = Wittenrspin(1,(2,1,1),r_coeff=4)
      sage: A2 = Wittenrspin(1,(2,0,2),r_coeff=4)
      sage: A3 = Wittenrspin(1,(2,2,0),r_coeff=4)
      sage: L=[t.basis_vector() for t in [A1,A2,A3]]; L
      [(0, 1/2, 0, 0, 1/4), (0, 0, 0, 1/4, -1/4), (0, 0, 1/4, 0, -1/4)]
      sage: sum(L)
      (0, 1/2, 1/4, 1/4, -1/4)


    We can also check manually, that interpolating the above results for
    large r precisely gives the output of the option rpoly=True::

      sage: from admcycles.double_ramification_cycle import interpolate
      sage: H1 = Wittenrspin(1, (3, (1/2,-1), (1/2,-2)), rpoly=True)
      sage: H1.basis_vector()
      (0, -1/4*r^2 + 5/2*r - 3, 1/4*r^2 - r, 1/4*r^2 - r - 3, -1/4*r^2 + 1/2*r + 5)
      sage: res=[]
      sage: pts = list(range(6,11,2))
      sage: for r in pts:
      ....:  res.append(r**(1-1+1)*Wittenrspin(1, (3, 1/2*r-1, 1/2*r-2),r_coeff=r).basis_vector(1))
      sage: v = vector([interpolate(pts, [a[i] for a in res],'r') for i in range(5)])
      sage: v-H1.basis_vector()
      (0, 0, 0, 0, 0)
    NcSsg|]	}t|t�r|�qSr")�
isinstancer�r8rr"r"r#r:/szWittenrspin.<locals>.<listcomp>rr%rFrzEEntries of Avector must be Integers, Polynomials or tuples (C_i, D_i)c3s(�|]}�|dko�|dkVqdS)r%r;Nr"r7)�Cvector�Dvectorr"r#�	<genexpr>Rs�&zWittenrspin.<locals>.<genexpr>css�|]}|��VqdS)N)�denom)r8�cr"r"r#rxUs�r'cSsg|]}t|��qSr")rrur"r"r#r:Zs)�sm�rt�ctrsr;)rbrdrIr&c3s�|]	}|j�d�VqdS)r&N)r )r8�b)rFr"r#rxss�)�moduli) rB�parentr(rrrrrt�numbers�IntegralrCrrr�
ValueError�anyr)rrr\rrrrrror>r r
rr�from_vector)rE�Avectorr`r!�rpolyrrGZpolyentriesr0rZAvectorXrra�Cry�moddictZmoduZrvectr")rvrwrFr#�Wittenrspin�sv{

"
"�
���r�cCs�td�\}}}|dkrdd|Std�dtd|||d|t|d�j|dd�|d|�td�d|||dt|d|d|||d|||d|t|d�j|dd�|d|d���S)a�
    Returns the expression P_m(X,a) as defined in [Pandharipande-Pixton-Zvonkine '16, Section 4.5].

    TESTS::

      sage: from admcycles.witten import Pmpolynomial
      sage: Pmpolynomial(0)
      1
      sage: Pmpolynomial(1)
      -1/12*X^2 + 1/2*(X - 1)*a - 1/2*a^2 + 5/24*X - 1/12
      sage: Pmpolynomial(2)
      1/288*X^4 - 1/12*(5*X - 1)*a^3 + 1/8*a^4 + 7/288*X^3 + 1/48*(20*X^2 - 5*X - 4)*a^2 - 29/384*X^2 - 1/48*(6*X^3 + X^2 - 9*X + 2)*a + 7/288*X + 1/288
    zb,X,arr%r'r�)rrrrr r_)r-r~rrr"r"r#rzs^X��r)NNFrs)5�__doc__�collections.abcrr]r�Zadmcycles.admcyclesrZadmcycles.DRrrrrrr	r
rrr
�	admcyclesr�sage.arith.allrr�sage.functions.otherr�sage.rings.allrrr� sage.modules.free_module_elementr�.sage.rings.polynomial.multi_polynomial_elementr�sage.rings.integerr�sage.calculus.varr�sage.misc.functionalr�sage.symbolic.ringrr�sage.misc.cachefuncrr$r3rVrlrorqrrr�rr"r"r"r#�<module>sJ0&
�7
�

�

�

J