"""1Conjectural Slopes of Hecke Polynomial23Interface to Kevin Buzzard's PARI program for computing conjectural4slopes of characteristic polynomials of Hecke operators.56AUTHORS:78- William Stein (2006-03-05): Sage interface910- Kevin Buzzard: PARI program that implements underlying functionality11"""1213#############################################################################14# Copyright (C) 2006 William Stein <[email protected]>15#16# Distributed under the terms of the GNU General Public License (GPL)17#18# http://www.gnu.org/licenses/19#############################################################################2021__doc_exclude = ['gp', '_gp', 'Gp', 'Integer', 'sage_eval']2223from sage.interfaces.gp import Gp24from sage.misc.all import sage_eval2526_gp = None2728def gp():29r"""30Return a copy of the GP interpreter with the appropriate files loaded.3132EXAMPLE::3334sage: sage.modular.buzzard.gp()35PARI/GP interpreter36"""3738global _gp39if _gp is None:40_gp = Gp(script_subdirectory='buzzard')41_gp.read("DimensionSk.g")42_gp.read("genusn.g")43_gp.read("Tpprog.g")44return _gp4546## def buzzard_dimension_cusp_forms(eps, k):47## r"""48## eps is [N, i x 3 matrix], where eps[2][,1] is the primes dividing49## N, eps[2][,2] is the powers of these primes that divide N, and eps[2][,3]50## is the following: for p odd, p^n||N, it's t such that znprimroot(p^n)51## gets sent to exp(2*pi*i/phi(p^n))^t. And for p=2, it's52## 0 for 2^1, it's 0 (trivial) or -1 (non-trivial) for 2^2, and for p^n>=853## it's either t>=0 for the even char sending 5 to exp(2*pi*i/p^(n-2))^t,54## or t<=-1 for the odd char sending 5 to exp(2*pi*i/p^(n-2))^(-1-t).55## (so either 0<=t<2^(n-2) or -1>=t>-1-2^(n-2) )5657## EXAMPLES:58## sage: buzzard_dimension_cusp_forms('TrivialCharacter(100)', 4)5960## Next we compute a dimension for the character of level 45 which is61## the product of the character of level 9 sending znprimroot(9)=2 to62## $e^{2 \pi i/6}^1$ and the character of level 5 sending63## \code{znprimroot(5)=2} to $e^{2 \pi i/4}^2=-1$.6465## sage: buzzard_dimension_cusp_forms('DirichletCharacter(45,[1,2])', 4)66## <boom!> which is why this is commented out!67## """68## s = gp().eval('DimensionCuspForms(%s, %s)'%(eps,k))69## print s70## return Integer(s)717273def buzzard_tpslopes(p, N, kmax):74"""75Returns a vector of length kmax, whose `k`'th entry76(`0 \leq k \leq k_{max}`) is the conjectural sequence77of valuations of eigenvalues of `T_p` on forms of level78`N`, weight `k`, and trivial character.7980This conjecture is due to Kevin Buzzard, and is only made assuming81that `p` does not divide `N` and if `p` is82`\Gamma_0(N)`-regular.8384EXAMPLES::8586sage: c = buzzard_tpslopes(2,1,50)87sage: c[50]88[4, 8, 13]8990Hence Buzzard would conjecture that the `2`-adic valuations91of the eigenvalues of `T_2` on cusp forms of level 1 and92weight `50` are `[4,8,13]`, which indeed they are,93as one can verify by an explicit computation using, e.g., modular94symbols::9596sage: M = ModularSymbols(1,50, sign=1).cuspidal_submodule()97sage: T = M.hecke_operator(2)98sage: f = T.charpoly('x')99sage: f.newton_slopes(2)100[13, 8, 4]101102AUTHORS:103104- Kevin Buzzard: several PARI/GP scripts105106- William Stein (2006-03-17): small Sage wrapper of Buzzard's107scripts108"""109v = gp().eval('tpslopes(%s, %s, %s)'%(p,N,kmax))110v = sage_eval(v)111v.insert(0, []) # so v[k] = info about weight k (since python is 0-based)112return v113114115