def dimension_new_cusp_forms(self, k=2, eps=None, p=0, algorithm="CohenOesterle"): r""" Dimension of the new subspace (or `p`-new subspace) of cusp forms of weight `k` and character `\varepsilon`. INPUT: - ``k`` - an integer (default: 2) - ``eps`` - a Dirichlet character - ``p`` - a prime (default: 0); just the `p`-new subspace if given - ``algorithm`` - either "CohenOesterle" (the default) or "Quer". This specifies the method to use in the case of nontrivial character: either the Cohen--Oesterle formula as described in Stein's book, or by Möbius inversion using the subgroups GammaH (a method due to Jordi Quer). EXAMPLES:: sage: G = DirichletGroup(9) sage: eps = G.0^3 sage: eps.conductor() 3 sage: [Gamma1(9).dimension_new_cusp_forms(k, eps) for k in [2..10]] [0, 0, 0, 2, 0, 2, 0, 2, 0] sage: [Gamma1(9).dimension_cusp_forms(k, eps) for k in [2..10]] [0, 0, 0, 2, 0, 4, 0, 6, 0] sage: [Gamma1(9).dimension_new_cusp_forms(k, eps, 3) for k in [2..10]] [0, 0, 0, 2, 0, 2, 0, 2, 0] Double check using modular symbols (independent calculation):: sage: [ModularSymbols(eps,k,sign=1).cuspidal_subspace().new_subspace().dimension() for k in [2..10]] [0, 0, 0, 2, 0, 2, 0, 2, 0] sage: [ModularSymbols(eps,k,sign=1).cuspidal_subspace().new_subspace(3).dimension() for k in [2..10]] [0, 0, 0, 2, 0, 2, 0, 2, 0] Another example at level 33:: sage: G = DirichletGroup(33) sage: eps = G.1 sage: eps.conductor() 11 sage: [Gamma1(33).dimension_new_cusp_forms(k, G.1) for k in [2..4]] [0, 4, 0] sage: [Gamma1(33).dimension_new_cusp_forms(k, G.1, algorithm="Quer") for k in [2..4]] [0, 4, 0] sage: [Gamma1(33).dimension_new_cusp_forms(k, G.1^2) for k in [2..4]] [2, 0, 6] sage: [Gamma1(33).dimension_new_cusp_forms(k, G.1^2, p=3) for k in [2..4]] [2, 0, 6] """ if eps is None: return GammaH_class.dimension_new_cusp_forms(self, k, p) N = self.level() eps = DirichletGroup(N, eps.base_ring())(eps) if eps.is_trivial(): from .all import Gamma0 return Gamma0(N).dimension_new_cusp_forms(k, p) from .congroup_gammaH import mumu if p == 0 or N % p != 0 or eps.conductor().valuation(p) == N.valuation( p): D = [eps.conductor() * d for d in divisors(N // eps.conductor())] return sum([ Gamma1_constructor(M).dimension_cusp_forms( k, eps.restrict(M), algorithm) * mumu(N // M) for M in D ]) eps_p = eps.restrict(N // p) old = Gamma1_constructor(N // p).dimension_cusp_forms( k, eps_p, algorithm) return self.dimension_cusp_forms(k, eps, algorithm) - 2 * old
class AlgebraicWeight(WeightCharacter): r""" A point in weight space corresponding to a locally algebraic character, of the form `x \mapsto \chi(x) x^k` where `k` is an integer and `\chi` is a Dirichlet character modulo `p^n` for some `n`. TESTS:: sage: w = pAdicWeightSpace(23)(12, DirichletGroup(23, QQ).0) # exact sage: w == loads(dumps(w)) True sage: w = pAdicWeightSpace(23)(12, DirichletGroup(23, Qp(23)).0) # inexact sage: w == loads(dumps(w)) True sage: w is loads(dumps(w)) # elements are not globally unique False """ def __init__(self, parent, k, chi=None): r""" Create a locally algebraic weight-character. EXAMPLES:: sage: pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0) (13, 29, [2 + 2*29 + ... + O(29^20)]) """ WeightCharacter.__init__(self, parent) k = ZZ(k) self._k = k if chi is None: chi = trivial_character(self._p, QQ) n = ZZ(chi.conductor()) if n == 1: n = self._p if not n.is_power_of(self._p): raise ValueError, "Character must have %s-power conductor" % p self._chi = DirichletGroup(n, chi.base_ring())(chi) def __call__(self, x): r""" Evaluate this character at an element of `\ZZ_p^\times`. EXAMPLES: Exact answers are returned when this is possible:: sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, QQ).0) sage: kappa(1) 1 sage: kappa(0) 0 sage: kappa(12) -106993205379072 sage: kappa(-1) -1 sage: kappa(13 + 4*29 + 11*29^2 + O(29^3)) 9 + 21*29 + 27*29^2 + O(29^3) When the character chi is defined over a p-adic field, the results returned are inexact:: sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0^14) sage: kappa(1) 1 + O(29^20) sage: kappa(0) 0 sage: kappa(12) 17 + 11*29 + 7*29^2 + 4*29^3 + 5*29^4 + 2*29^5 + 13*29^6 + 3*29^7 + 18*29^8 + 21*29^9 + 28*29^10 + 28*29^11 + 28*29^12 + 28*29^13 + 28*29^14 + 28*29^15 + 28*29^16 + 28*29^17 + 28*29^18 + 28*29^19 + O(29^20) sage: kappa(12) == -106993205379072 True sage: kappa(-1) == -1 True sage: kappa(13 + 4*29 + 11*29^2 + O(29^3)) 9 + 21*29 + 27*29^2 + O(29^3) """ if isinstance(x, pAdicGenericElement): if x.parent().prime() != self._p: raise TypeError, "x must be an integer or a %s-adic integer" % self._p if self._p**(x.precision_absolute()) < self._chi.conductor(): raise Exception, "Precision too low" xint = x.lift() else: xint = x if (xint % self._p == 0): return 0 return self._chi(xint) * x**self._k def k(self): r""" If this character is `x \mapsto x^k \chi(x)` for an integer `k` and a Dirichlet character `\chi`, return `k`. EXAMPLE:: sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0^14) sage: kappa.k() 13 """ return self._k def chi(self): r""" If this character is `x \mapsto x^k \chi(x)` for an integer `k` and a Dirichlet character `\chi`, return `\chi`. EXAMPLE:: sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0^14) sage: kappa.chi() Dirichlet character modulo 29 of conductor 29 mapping 2 |--> 28 + 28*29 + 28*29^2 + ... + O(29^20) """ return self._chi def _repr_(self): r""" String representation of self. EXAMPLES:: sage: pAdicWeightSpace(17)(2)._repr_() '2' sage: pAdicWeightSpace(17)(2, DirichletGroup(17, QQ).0)._repr_() '(2, 17, [-1])' sage: pAdicWeightSpace(17)(2, DirichletGroup(17, QQ).0^2)._repr_() '2' """ if self._chi.is_trivial(): return "%s" % self._k else: return "(%s, %s, %s)" % (self._k, self._chi.modulus(), self._chi._repr_short_()) def teichmuller_type(self): r""" Return the Teichmuller type of this weight-character `\kappa`, which is the unique `t \in \ZZ/(p-1)\ZZ` such that `\kappa(\mu) = \mu^t` for \mu a `(p-1)`-st root of 1. For `p = 2` this doesn't make sense, but we still want the Teichmuller type to correspond to the index of the component of weight space in which `\kappa` lies, so we return 1 if `\kappa` is odd and 0 otherwise. EXAMPLE:: sage: pAdicWeightSpace(11)(2, DirichletGroup(11,QQ).0).teichmuller_type() 7 sage: pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0).teichmuller_type() 14 sage: pAdicWeightSpace(2)(3, DirichletGroup(4,QQ).0).teichmuller_type() 0 """ # Special case p == 2 if self._p == 2: if self.is_even(): return IntegerModRing(2)(0) else: return IntegerModRing(2)(1) m = IntegerModRing(self._p).multiplicative_generator() x = [y for y in IntegerModRing(self._chi.modulus()) if y == m and y**(self._p - 1) == 1] if len(x) != 1: raise ArithmeticError x = x[0] f = IntegerModRing(self._p)(self._chi(x)).log(m) return IntegerModRing(self._p - 1)(self._k + f) def Lvalue(self): r""" Return the value of the p-adic L-function of `\QQ` evaluated at this weight-character. If the character is `x \mapsto x^k \chi(x)` where `k > 0` and `\chi` has conductor a power of `p`, this is an element of the number field generated by the values of `\chi`, equal to the value of the complex L-function `L(1-k, \chi)`. If `\chi` is trivial, it is equal to `(1 - p^{k-1})\zeta(1-k)`. At present this is not implemented in any other cases, except the trivial character (for which the value is `\infty`). TODO: Implement this more generally using the Amice transform machinery in sage/schemes/elliptic_curves/padic_lseries.py, which should clearly be factored out into a separate class. EXAMPLES:: sage: pAdicWeightSpace(7)(4).Lvalue() == (1 - 7^3)*zeta__exact(-3) True sage: pAdicWeightSpace(7)(5, DirichletGroup(7, Qp(7)).0^4).Lvalue() 0 sage: pAdicWeightSpace(7)(6, DirichletGroup(7, Qp(7)).0^4).Lvalue() 1 + 2*7 + 7^2 + 3*7^3 + 3*7^5 + 4*7^6 + 2*7^7 + 5*7^8 + 2*7^9 + 3*7^10 + 6*7^11 + 2*7^12 + 3*7^13 + 5*7^14 + 6*7^15 + 5*7^16 + 3*7^17 + 6*7^18 + O(7^19) """ if self._k > 0: return -self._chi.bernoulli(self._k)/self._k if self.is_trivial(): return Infinity else: raise NotImplementedError, "Don't know how to compute value of this L-function"
def dimension_cusp_forms(self, k=2, eps=None, algorithm="CohenOesterle"): r""" Return the dimension of the space of cusp forms for self, or the dimension of the subspace corresponding to the given character if one is supplied. INPUT: - ``k`` - an integer (default: 2), the weight. - ``eps`` - either None or a Dirichlet character modulo N, where N is the level of this group. If this is None, then the dimension of the whole space is returned; otherwise, the dimension of the subspace of forms of character eps. - ``algorithm`` -- either "CohenOesterle" (the default) or "Quer". This specifies the method to use in the case of nontrivial character: either the Cohen--Oesterle formula as described in Stein's book, or by Möbius inversion using the subgroups GammaH (a method due to Jordi Quer). Ignored for weight 1. EXAMPLES: We compute the same dimension in two different ways :: sage: K = CyclotomicField(3) sage: eps = DirichletGroup(7*43,K).0^2 sage: G = Gamma1(7*43) Via Cohen--Oesterle:: sage: Gamma1(7*43).dimension_cusp_forms(2, eps) 28 Via Quer's method:: sage: Gamma1(7*43).dimension_cusp_forms(2, eps, algorithm="Quer") 28 Some more examples:: sage: G.<eps> = DirichletGroup(9) sage: [Gamma1(9).dimension_cusp_forms(k, eps) for k in [1..10]] [0, 0, 1, 0, 3, 0, 5, 0, 7, 0] sage: [Gamma1(9).dimension_cusp_forms(k, eps^2) for k in [1..10]] [0, 0, 0, 2, 0, 4, 0, 6, 0, 8] In weight 1, we can sometimes rule out cusp forms existing via Riemann-Roch, but if this does not work, we trigger computation of the cusp forms space via Schaeffer's algorithm:: sage: chi = [u for u in DirichletGroup(40) if u(-1) == -1 and u(21) == 1][0] sage: Gamma1(40).dimension_cusp_forms(1, chi) 0 sage: G = DirichletGroup(57); chi = (G.0) * (G.1)^6 sage: Gamma1(57).dimension_cusp_forms(1, chi) 1 """ from .all import Gamma0 # first deal with special cases if eps is None: return GammaH_class.dimension_cusp_forms(self, k) N = self.level() K = eps.base_ring() eps = DirichletGroup(N, K)(eps) if K.characteristic() != 0: raise NotImplementedError( 'dimension_cusp_forms() is only implemented for rings of characteristic 0' ) if eps.is_trivial(): return Gamma0(N).dimension_cusp_forms(k) if (k <= 0) or ((k % 2) == 1 and eps.is_even()) or ((k % 2) == 0 and eps.is_odd()): return ZZ(0) if k == 1: from sage.modular.modform.weight1 import dimension_wt1_cusp_forms return dimension_wt1_cusp_forms(eps) # now the main part if algorithm == "Quer": n = eps.order() dim = ZZ(0) for d in n.divisors(): G = GammaH_constructor(N, (eps**d).kernel()) dim = dim + moebius(d) * G.dimension_cusp_forms(k) return dim // phi(n) elif algorithm == "CohenOesterle": from sage.modular.dims import CohenOesterle return ZZ( K(Gamma0(N).index() * (k - 1) / ZZ(12)) + CohenOesterle(eps, k)) else: #algorithm not in ["CohenOesterle", "Quer"]: raise ValueError("Unrecognised algorithm in dimension_cusp_forms")
def dimension_eis(self, k=2, eps=None, algorithm="CohenOesterle"): r""" Return the dimension of the space of Eisenstein series forms for self, or the dimension of the subspace corresponding to the given character if one is supplied. INPUT: - ``k`` - an integer (default: 2), the weight. - ``eps`` - either None or a Dirichlet character modulo N, where N is the level of this group. If this is None, then the dimension of the whole space is returned; otherwise, the dimension of the subspace of Eisenstein series of character eps. - ``algorithm`` -- either "CohenOesterle" (the default) or "Quer". This specifies the method to use in the case of nontrivial character: either the Cohen--Oesterle formula as described in Stein's book, or by Möbius inversion using the subgroups GammaH (a method due to Jordi Quer). AUTHORS: - William Stein - Cohen--Oesterle algorithm - Jordi Quer - algorithm based on GammaH subgroups - David Loeffler (2009) - code refactoring EXAMPLES: The following two computations use different algorithms:: sage: [Gamma1(36).dimension_eis(1,eps) for eps in DirichletGroup(36)] [0, 4, 3, 0, 0, 2, 6, 0, 0, 2, 3, 0] sage: [Gamma1(36).dimension_eis(1,eps,algorithm="Quer") for eps in DirichletGroup(36)] [0, 4, 3, 0, 0, 2, 6, 0, 0, 2, 3, 0] So do these:: sage: [Gamma1(48).dimension_eis(3,eps) for eps in DirichletGroup(48)] [0, 12, 0, 4, 0, 8, 0, 4, 12, 0, 4, 0, 8, 0, 4, 0] sage: [Gamma1(48).dimension_eis(3,eps,algorithm="Quer") for eps in DirichletGroup(48)] [0, 12, 0, 4, 0, 8, 0, 4, 12, 0, 4, 0, 8, 0, 4, 0] """ from .all import Gamma0 # first deal with special cases if eps is None: return GammaH_class.dimension_eis(self, k) N = self.level() K = eps.base_ring() eps = DirichletGroup(N, K)(eps) if eps.is_trivial(): return Gamma0(N).dimension_eis(k) # Note case of k = 0 and trivial character already dealt with separately, so k <= 0 here is valid: if (k <= 0) or ((k % 2) == 1 and eps.is_even()) or ((k % 2) == 0 and eps.is_odd()): return ZZ(0) if algorithm == "Quer": n = eps.order() dim = ZZ(0) for d in n.divisors(): G = GammaH_constructor(N, (eps**d).kernel()) dim = dim + moebius(d) * G.dimension_eis(k) return dim // phi(n) elif algorithm == "CohenOesterle": from sage.modular.dims import CohenOesterle j = 2 - k # We use the Cohen-Oesterle formula in a subtle way to # compute dim M_k(N,eps) (see Ch. 6 of William Stein's book on # computing with modular forms). alpha = -ZZ( K(Gamma0(N).index() * (j - 1) / ZZ(12)) + CohenOesterle(eps, j)) if k == 1: return alpha else: return alpha - self.dimension_cusp_forms(k, eps) else: #algorithm not in ["CohenOesterle", "Quer"]: raise ValueError("Unrecognised algorithm in dimension_eis")
def dimension_eis(self, k=2, eps=None, algorithm="CohenOesterle"): r""" Return the dimension of the space of Eisenstein series forms for self, or the dimension of the subspace corresponding to the given character if one is supplied. INPUT: - ``k`` - an integer (default: 2), the weight. - ``eps`` - either None or a Dirichlet character modulo N, where N is the level of this group. If this is None, then the dimension of the whole space is returned; otherwise, the dimension of the subspace of Eisenstein series of character eps. - ``algorithm`` -- either "CohenOesterle" (the default) or "Quer". This specifies the method to use in the case of nontrivial character: either the Cohen--Oesterle formula as described in Stein's book, or by Moebius inversion using the subgroups GammaH (a method due to Jordi Quer). AUTHORS: - William Stein - Cohen--Oesterle algorithm - Jordi Quer - algorithm based on GammaH subgroups - David Loeffler (2009) - code refactoring EXAMPLES: The following two computations use different algorithms: :: sage: [Gamma1(36).dimension_eis(1,eps) for eps in DirichletGroup(36)] [0, 4, 3, 0, 0, 2, 6, 0, 0, 2, 3, 0] sage: [Gamma1(36).dimension_eis(1,eps,algorithm="Quer") for eps in DirichletGroup(36)] [0, 4, 3, 0, 0, 2, 6, 0, 0, 2, 3, 0] So do these: :: sage: [Gamma1(48).dimension_eis(3,eps) for eps in DirichletGroup(48)] [0, 12, 0, 4, 0, 8, 0, 4, 12, 0, 4, 0, 8, 0, 4, 0] sage: [Gamma1(48).dimension_eis(3,eps,algorithm="Quer") for eps in DirichletGroup(48)] [0, 12, 0, 4, 0, 8, 0, 4, 12, 0, 4, 0, 8, 0, 4, 0] """ from all import Gamma0 # first deal with special cases if eps is None: return GammaH_class.dimension_eis(self, k) N = self.level() eps = DirichletGroup(N)(eps) if eps.is_trivial(): return Gamma0(N).dimension_eis(k) # Note case of k = 0 and trivial character already dealt with separately, so k <= 0 here is valid: if (k <= 0) or ((k % 2) == 1 and eps.is_even()) or ((k%2) == 0 and eps.is_odd()): return ZZ(0) if algorithm == "Quer": n = eps.order() dim = ZZ(0) for d in n.divisors(): G = GammaH_constructor(N,(eps**d).kernel()) dim = dim + moebius(d)*G.dimension_eis(k) return dim//phi(n) elif algorithm == "CohenOesterle": from sage.modular.dims import CohenOesterle K = eps.base_ring() j = 2-k # We use the Cohen-Oesterle formula in a subtle way to # compute dim M_k(N,eps) (see Ch. 6 of William Stein's book on # computing with modular forms). alpha = -ZZ( K(Gamma0(N).index()*(j-1)/ZZ(12)) + CohenOesterle(eps,j) ) if k == 1: return alpha else: return alpha - self.dimension_cusp_forms(k, eps) else: #algorithm not in ["CohenOesterle", "Quer"]: raise ValueError, "Unrecognised algorithm in dimension_eis"
def dimension_new_cusp_forms(self, k=2, eps=None, p=0, algorithm="CohenOesterle"): r""" Dimension of the new subspace (or `p`-new subspace) of cusp forms of weight `k` and character `\varepsilon`. INPUT: - ``k`` - an integer (default: 2) - ``eps`` - a Dirichlet character - ``p`` - a prime (default: 0); just the `p`-new subspace if given - ``algorithm`` - either "CohenOesterle" (the default) or "Quer". This specifies the method to use in the case of nontrivial character: either the Cohen--Oesterle formula as described in Stein's book, or by Moebius inversion using the subgroups GammaH (a method due to Jordi Quer). EXAMPLES:: sage: G = DirichletGroup(9) sage: eps = G.0^3 sage: eps.conductor() 3 sage: [Gamma1(9).dimension_new_cusp_forms(k, eps) for k in [2..10]] [0, 0, 0, 2, 0, 2, 0, 2, 0] sage: [Gamma1(9).dimension_cusp_forms(k, eps) for k in [2..10]] [0, 0, 0, 2, 0, 4, 0, 6, 0] sage: [Gamma1(9).dimension_new_cusp_forms(k, eps, 3) for k in [2..10]] [0, 0, 0, 2, 0, 2, 0, 2, 0] Double check using modular symbols (independent calculation):: sage: [ModularSymbols(eps,k,sign=1).cuspidal_subspace().new_subspace().dimension() for k in [2..10]] [0, 0, 0, 2, 0, 2, 0, 2, 0] sage: [ModularSymbols(eps,k,sign=1).cuspidal_subspace().new_subspace(3).dimension() for k in [2..10]] [0, 0, 0, 2, 0, 2, 0, 2, 0] Another example at level 33:: sage: G = DirichletGroup(33) sage: eps = G.1 sage: eps.conductor() 11 sage: [Gamma1(33).dimension_new_cusp_forms(k, G.1) for k in [2..4]] [0, 4, 0] sage: [Gamma1(33).dimension_new_cusp_forms(k, G.1, algorithm="Quer") for k in [2..4]] [0, 4, 0] sage: [Gamma1(33).dimension_new_cusp_forms(k, G.1^2) for k in [2..4]] [2, 0, 6] sage: [Gamma1(33).dimension_new_cusp_forms(k, G.1^2, p=3) for k in [2..4]] [2, 0, 6] """ if eps == None: return GammaH_class.dimension_new_cusp_forms(self, k, p) N = self.level() eps = DirichletGroup(N)(eps) from all import Gamma0 if eps.is_trivial(): return Gamma0(N).dimension_new_cusp_forms(k, p) from congroup_gammaH import mumu if p == 0 or N%p != 0 or eps.conductor().valuation(p) == N.valuation(p): D = [eps.conductor()*d for d in divisors(N//eps.conductor())] return sum([Gamma1_constructor(M).dimension_cusp_forms(k, eps.restrict(M), algorithm)*mumu(N//M) for M in D]) eps_p = eps.restrict(N//p) old = Gamma1_constructor(N//p).dimension_cusp_forms(k, eps_p, algorithm) return self.dimension_cusp_forms(k, eps, algorithm) - 2*old
def dimension_cusp_forms(self, k=2, eps=None, algorithm="CohenOesterle"): r""" Return the dimension of the space of cusp forms for self, or the dimension of the subspace corresponding to the given character if one is supplied. INPUT: - ``k`` - an integer (default: 2), the weight. - ``eps`` - either None or a Dirichlet character modulo N, where N is the level of this group. If this is None, then the dimension of the whole space is returned; otherwise, the dimension of the subspace of forms of character eps. - ``algorithm`` -- either "CohenOesterle" (the default) or "Quer". This specifies the method to use in the case of nontrivial character: either the Cohen--Oesterle formula as described in Stein's book, or by Moebius inversion using the subgroups GammaH (a method due to Jordi Quer). EXAMPLES: We compute the same dimension in two different ways :: sage: K = CyclotomicField(3) sage: eps = DirichletGroup(7*43,K).0^2 sage: G = Gamma1(7*43) Via Cohen--Oesterle: :: sage: Gamma1(7*43).dimension_cusp_forms(2, eps) 28 Via Quer's method: :: sage: Gamma1(7*43).dimension_cusp_forms(2, eps, algorithm="Quer") 28 Some more examples: :: sage: G.<eps> = DirichletGroup(9) sage: [Gamma1(9).dimension_cusp_forms(k, eps) for k in [1..10]] [0, 0, 1, 0, 3, 0, 5, 0, 7, 0] sage: [Gamma1(9).dimension_cusp_forms(k, eps^2) for k in [1..10]] [0, 0, 0, 2, 0, 4, 0, 6, 0, 8] """ from all import Gamma0 # first deal with special cases if eps is None: return GammaH_class.dimension_cusp_forms(self, k) N = self.level() if eps.base_ring().characteristic() != 0: raise ValueError eps = DirichletGroup(N, eps.base_ring())(eps) if eps.is_trivial(): return Gamma0(N).dimension_cusp_forms(k) if (k <= 0) or ((k % 2) == 1 and eps.is_even()) or ((k%2) == 0 and eps.is_odd()): return ZZ(0) if k == 1: try: n = self.dimension_cusp_forms(1) if n == 0: return ZZ(0) else: # never happens at present raise NotImplementedError, "Computations of dimensions of spaces of weight 1 cusp forms not implemented at present" except NotImplementedError: raise # now the main part if algorithm == "Quer": n = eps.order() dim = ZZ(0) for d in n.divisors(): G = GammaH_constructor(N,(eps**d).kernel()) dim = dim + moebius(d)*G.dimension_cusp_forms(k) return dim//phi(n) elif algorithm == "CohenOesterle": K = eps.base_ring() from sage.modular.dims import CohenOesterle from all import Gamma0 return ZZ( K(Gamma0(N).index() * (k-1)/ZZ(12)) + CohenOesterle(eps,k) ) else: #algorithm not in ["CohenOesterle", "Quer"]: raise ValueError, "Unrecognised algorithm in dimension_cusp_forms"
class AlgebraicWeight(WeightCharacter): r""" A point in weight space corresponding to a locally algebraic character, of the form `x \mapsto \chi(x) x^k` where `k` is an integer and `\chi` is a Dirichlet character modulo `p^n` for some `n`. TESTS:: sage: w = pAdicWeightSpace(23)(12, DirichletGroup(23, QQ).0) # exact sage: w == loads(dumps(w)) True sage: w = pAdicWeightSpace(23)(12, DirichletGroup(23, Qp(23)).0) # inexact sage: w == loads(dumps(w)) True sage: w is loads(dumps(w)) # elements are not globally unique False """ def __init__(self, parent, k, chi=None): r""" Create a locally algebraic weight-character. EXAMPLES:: sage: pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0) (13, 29, [2 + 2*29 + ... + O(29^20)]) """ WeightCharacter.__init__(self, parent) k = ZZ(k) self._k = k if chi is None: chi = trivial_character(self._p, QQ) n = ZZ(chi.conductor()) if n == 1: n = self._p if not n.is_power_of(self._p): raise ValueError("Character must have %s-power conductor" % p) self._chi = DirichletGroup(n, chi.base_ring())(chi) def __call__(self, x): r""" Evaluate this character at an element of `\ZZ_p^\times`. EXAMPLES: Exact answers are returned when this is possible:: sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, QQ).0) sage: kappa(1) 1 sage: kappa(0) 0 sage: kappa(12) -106993205379072 sage: kappa(-1) -1 sage: kappa(13 + 4*29 + 11*29^2 + O(29^3)) 9 + 21*29 + 27*29^2 + O(29^3) When the character chi is defined over a p-adic field, the results returned are inexact:: sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0^14) sage: kappa(1) 1 + O(29^20) sage: kappa(0) 0 sage: kappa(12) 17 + 11*29 + 7*29^2 + 4*29^3 + 5*29^4 + 2*29^5 + 13*29^6 + 3*29^7 + 18*29^8 + 21*29^9 + 28*29^10 + 28*29^11 + 28*29^12 + 28*29^13 + 28*29^14 + 28*29^15 + 28*29^16 + 28*29^17 + 28*29^18 + 28*29^19 + O(29^20) sage: kappa(12) == -106993205379072 True sage: kappa(-1) == -1 True sage: kappa(13 + 4*29 + 11*29^2 + O(29^3)) 9 + 21*29 + 27*29^2 + O(29^3) """ if isinstance(x, pAdicGenericElement): if x.parent().prime() != self._p: raise TypeError("x must be an integer or a %s-adic integer" % self._p) if self._p**(x.precision_absolute()) < self._chi.conductor(): raise PrecisionError("Precision too low") xint = x.lift() else: xint = x if (xint % self._p == 0): return 0 return self._chi(xint) * x**self._k def k(self): r""" If this character is `x \mapsto x^k \chi(x)` for an integer `k` and a Dirichlet character `\chi`, return `k`. EXAMPLES:: sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0^14) sage: kappa.k() 13 """ return self._k def chi(self): r""" If this character is `x \mapsto x^k \chi(x)` for an integer `k` and a Dirichlet character `\chi`, return `\chi`. EXAMPLES:: sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0^14) sage: kappa.chi() Dirichlet character modulo 29 of conductor 29 mapping 2 |--> 28 + 28*29 + 28*29^2 + ... + O(29^20) """ return self._chi def __hash__(self): r""" TESTS:: sage: w = pAdicWeightSpace(23)(12, DirichletGroup(23, QQ).0) sage: hash(w) 2363715643371367891 # 64-bit -1456525869 # 32-bit """ if self._chi.is_trivial(): return hash(self._k) else: return hash((self._k, self._chi.modulus(), self._chi)) def _repr_(self): r""" String representation of self. EXAMPLES:: sage: pAdicWeightSpace(17)(2)._repr_() '2' sage: pAdicWeightSpace(17)(2, DirichletGroup(17, QQ).0)._repr_() '(2, 17, [-1])' sage: pAdicWeightSpace(17)(2, DirichletGroup(17, QQ).0^2)._repr_() '2' """ if self._chi.is_trivial(): return "%s" % self._k else: return "(%s, %s, %s)" % (self._k, self._chi.modulus(), self._chi._repr_short_()) def teichmuller_type(self): r""" Return the Teichmuller type of this weight-character `\kappa`, which is the unique `t \in \ZZ/(p-1)\ZZ` such that `\kappa(\mu) = \mu^t` for \mu a `(p-1)`-st root of 1. For `p = 2` this doesn't make sense, but we still want the Teichmuller type to correspond to the index of the component of weight space in which `\kappa` lies, so we return 1 if `\kappa` is odd and 0 otherwise. EXAMPLES:: sage: pAdicWeightSpace(11)(2, DirichletGroup(11,QQ).0).teichmuller_type() 7 sage: pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0).teichmuller_type() 14 sage: pAdicWeightSpace(2)(3, DirichletGroup(4,QQ).0).teichmuller_type() 0 """ # Special case p == 2 if self._p == 2: if self.is_even(): return IntegerModRing(2)(0) else: return IntegerModRing(2)(1) m = IntegerModRing(self._p).multiplicative_generator() x = [ y for y in IntegerModRing(self._chi.modulus()) if y == m and y**(self._p - 1) == 1 ] if len(x) != 1: raise ArithmeticError x = x[0] f = IntegerModRing(self._p)(self._chi(x)).log(m) return IntegerModRing(self._p - 1)(self._k + f) def Lvalue(self): r""" Return the value of the p-adic L-function of `\QQ` evaluated at this weight-character. If the character is `x \mapsto x^k \chi(x)` where `k > 0` and `\chi` has conductor a power of `p`, this is an element of the number field generated by the values of `\chi`, equal to the value of the complex L-function `L(1-k, \chi)`. If `\chi` is trivial, it is equal to `(1 - p^{k-1})\zeta(1-k)`. At present this is not implemented in any other cases, except the trivial character (for which the value is `\infty`). TODO: Implement this more generally using the Amice transform machinery in sage/schemes/elliptic_curves/padic_lseries.py, which should clearly be factored out into a separate class. EXAMPLES:: sage: pAdicWeightSpace(7)(4).Lvalue() == (1 - 7^3)*zeta__exact(-3) True sage: pAdicWeightSpace(7)(5, DirichletGroup(7, Qp(7)).0^4).Lvalue() 0 sage: pAdicWeightSpace(7)(6, DirichletGroup(7, Qp(7)).0^4).Lvalue() 1 + 2*7 + 7^2 + 3*7^3 + 3*7^5 + 4*7^6 + 2*7^7 + 5*7^8 + 2*7^9 + 3*7^10 + 6*7^11 + 2*7^12 + 3*7^13 + 5*7^14 + 6*7^15 + 5*7^16 + 3*7^17 + 6*7^18 + O(7^19) """ if self._k > 0: return -self._chi.bernoulli(self._k) / self._k if self.is_trivial(): return Infinity else: raise NotImplementedError( "Don't know how to compute value of this L-function")
def dimension_cusp_forms(self, k=2, eps=None, algorithm="CohenOesterle"): r""" Return the dimension of the space of cusp forms for self, or the dimension of the subspace corresponding to the given character if one is supplied. INPUT: - ``k`` - an integer (default: 2), the weight. - ``eps`` - either None or a Dirichlet character modulo N, where N is the level of this group. If this is None, then the dimension of the whole space is returned; otherwise, the dimension of the subspace of forms of character eps. - ``algorithm`` -- either "CohenOesterle" (the default) or "Quer". This specifies the method to use in the case of nontrivial character: either the Cohen--Oesterle formula as described in Stein's book, or by Moebius inversion using the subgroups GammaH (a method due to Jordi Quer). EXAMPLES: We compute the same dimension in two different ways :: sage: K = CyclotomicField(3) sage: eps = DirichletGroup(7*43,K).0^2 sage: G = Gamma1(7*43) Via Cohen--Oesterle: :: sage: Gamma1(7*43).dimension_cusp_forms(2, eps) 28 Via Quer's method: :: sage: Gamma1(7*43).dimension_cusp_forms(2, eps, algorithm="Quer") 28 Some more examples: :: sage: G.<eps> = DirichletGroup(9) sage: [Gamma1(9).dimension_cusp_forms(k, eps) for k in [1..10]] [0, 0, 1, 0, 3, 0, 5, 0, 7, 0] sage: [Gamma1(9).dimension_cusp_forms(k, eps^2) for k in [1..10]] [0, 0, 0, 2, 0, 4, 0, 6, 0, 8] """ from all import Gamma0 # first deal with special cases if eps is None: return GammaH_class.dimension_cusp_forms(self, k) N = self.level() if eps.base_ring().characteristic() != 0: raise ValueError eps = DirichletGroup(N, eps.base_ring())(eps) if eps.is_trivial(): return Gamma0(N).dimension_cusp_forms(k) if (k <= 0) or ((k % 2) == 1 and eps.is_even()) or ((k % 2) == 0 and eps.is_odd()): return ZZ(0) if k == 1: try: n = self.dimension_cusp_forms(1) if n == 0: return ZZ(0) else: # never happens at present raise NotImplementedError, "Computations of dimensions of spaces of weight 1 cusp forms not implemented at present" except NotImplementedError: raise # now the main part if algorithm == "Quer": n = eps.order() dim = ZZ(0) for d in n.divisors(): G = GammaH_constructor(N, (eps**d).kernel()) dim = dim + moebius(d) * G.dimension_cusp_forms(k) return dim // phi(n) elif algorithm == "CohenOesterle": K = eps.base_ring() from sage.modular.dims import CohenOesterle from all import Gamma0 return ZZ( K(Gamma0(N).index() * (k - 1) / ZZ(12)) + CohenOesterle(eps, k)) else: #algorithm not in ["CohenOesterle", "Quer"]: raise ValueError, "Unrecognised algorithm in dimension_cusp_forms"
def dimension_of_ordinary_subspace(self, p=None, cusp=False): """ If ``cusp`` is ``True``, return dimension of cuspidal ordinary subspace. This does a weight 2 computation with sage's ModularSymbols. EXAMPLES:: sage: M = OverconvergentModularSymbols(11, 0, sign=-1, p=3, prec_cap=4, base=ZpCA(3, 8)) sage: M.dimension_of_ordinary_subspace() 2 sage: M.dimension_of_ordinary_subspace(cusp=True) 2 sage: M = OverconvergentModularSymbols(11, 0, sign=1, p=3, prec_cap=4, base=ZpCA(3, 8)) sage: M.dimension_of_ordinary_subspace(cusp=True) 2 sage: M.dimension_of_ordinary_subspace() 4 sage: M = OverconvergentModularSymbols(11, 0, sign=0, p=3, prec_cap=4, base=ZpCA(3, 8)) sage: M.dimension_of_ordinary_subspace() 6 sage: M.dimension_of_ordinary_subspace(cusp=True) 4 sage: M = OverconvergentModularSymbols(11, 0, sign=1, p=11, prec_cap=4, base=ZpCA(11, 8)) sage: M.dimension_of_ordinary_subspace(cusp=True) 1 sage: M.dimension_of_ordinary_subspace() 2 sage: M = OverconvergentModularSymbols(11, 2, sign=1, p=11, prec_cap=4, base=ZpCA(11, 8)) sage: M.dimension_of_ordinary_subspace(cusp=True) 0 sage: M.dimension_of_ordinary_subspace() 1 sage: M = OverconvergentModularSymbols(11, 10, sign=1, p=11, prec_cap=4, base=ZpCA(11, 8)) sage: M.dimension_of_ordinary_subspace(cusp=True) 1 sage: M.dimension_of_ordinary_subspace() 2 An example with odd weight and hence non-trivial character:: sage: K = Qp(11, 6) sage: DG = DirichletGroup(11, K) sage: chi = DG([K(378703)]) sage: MM = FamiliesOfOMS(chi, 1, p=11, prec_cap=[4, 4], base_coeffs=ZpCA(11, 4), sign=-1) sage: MM.dimension_of_ordinary_subspace() 1 """ try: p = self.prime() except AttributeError: if p is None: raise ValueError( "If self doesn't have a prime, must specify p.") try: return self._ord_dim_dict[(p, cusp)] except AttributeError: self._ord_dim_dict = {} except KeyError: pass from sage.modular.dirichlet import DirichletGroup from sage.rings.finite_rings.constructor import GF try: chi = self.character() except AttributeError: chi = DirichletGroup(self.level(), GF(p))[0] if chi is None: chi = DirichletGroup(self.level(), GF(p))[0] from sage.modular.modsym.modsym import ModularSymbols r = self.weight() % (p - 1) if chi.is_trivial(): N = chi.modulus() if N % p != 0: N *= p else: e = N.valuation(p) N.divide_knowing_divisible_by(p**(e - 1)) chi = DirichletGroup(N, GF(p))[0] elif chi.modulus() % p != 0: chi = DirichletGroup(chi.modulus() * p, GF(p))(chi) DG = DirichletGroup(chi.modulus(), GF(p)) if r == 0: from sage.modular.arithgroup.congroup_gamma0 import Gamma0_constructor as Gamma0 verbose("in dim: %s, %s, %s" % (self.sign(), chi, p)) M = ModularSymbols(DG(chi), 2, self.sign(), GF(p)) else: psi = [GF(p)(u)**r for u in DG.unit_gens()] #mod p Teichmuller^r psi = DG(psi) M = ModularSymbols(DG(chi) * psi, 2, self.sign(), GF(p)) if cusp: M = M.cuspidal_subspace() hecke_poly = M.hecke_polynomial(p) verbose("in dim: %s" % (hecke_poly)) x = hecke_poly.parent().gen() d = hecke_poly.degree() - hecke_poly.ord(x) self._ord_dim_dict[(p, cusp)] = d return d
def dimension_of_ordinary_subspace(self, p=None, cusp=False): """ If ``cusp`` is ``True``, return dimension of cuspidal ordinary subspace. This does a weight 2 computation with sage's ModularSymbols. EXAMPLES:: sage: M = OverconvergentModularSymbols(11, 0, sign=-1, p=3, prec_cap=4, base=ZpCA(3, 8)) sage: M.dimension_of_ordinary_subspace() 2 sage: M.dimension_of_ordinary_subspace(cusp=True) 2 sage: M = OverconvergentModularSymbols(11, 0, sign=1, p=3, prec_cap=4, base=ZpCA(3, 8)) sage: M.dimension_of_ordinary_subspace(cusp=True) 2 sage: M.dimension_of_ordinary_subspace() 4 sage: M = OverconvergentModularSymbols(11, 0, sign=0, p=3, prec_cap=4, base=ZpCA(3, 8)) sage: M.dimension_of_ordinary_subspace() 6 sage: M.dimension_of_ordinary_subspace(cusp=True) 4 sage: M = OverconvergentModularSymbols(11, 0, sign=1, p=11, prec_cap=4, base=ZpCA(11, 8)) sage: M.dimension_of_ordinary_subspace(cusp=True) 1 sage: M.dimension_of_ordinary_subspace() 2 sage: M = OverconvergentModularSymbols(11, 2, sign=1, p=11, prec_cap=4, base=ZpCA(11, 8)) sage: M.dimension_of_ordinary_subspace(cusp=True) 0 sage: M.dimension_of_ordinary_subspace() 1 sage: M = OverconvergentModularSymbols(11, 10, sign=1, p=11, prec_cap=4, base=ZpCA(11, 8)) sage: M.dimension_of_ordinary_subspace(cusp=True) 1 sage: M.dimension_of_ordinary_subspace() 2 An example with odd weight and hence non-trivial character:: sage: K = Qp(11, 6) sage: DG = DirichletGroup(11, K) sage: chi = DG([K(378703)]) sage: MM = FamiliesOfOMS(chi, 1, p=11, prec_cap=[4, 4], base_coeffs=ZpCA(11, 4), sign=-1) sage: MM.dimension_of_ordinary_subspace() 1 """ try: p = self.prime() except AttributeError: if p is None: raise ValueError("If self doesn't have a prime, must specify p.") try: return self._ord_dim_dict[(p, cusp)] except AttributeError: self._ord_dim_dict = {} except KeyError: pass from sage.modular.dirichlet import DirichletGroup from sage.rings.finite_rings.constructor import GF try: chi = self.character() except AttributeError: chi = DirichletGroup(self.level(), GF(p))[0] if chi is None: chi = DirichletGroup(self.level(), GF(p))[0] from sage.modular.modsym.modsym import ModularSymbols r = self.weight() % (p-1) if chi.is_trivial(): N = chi.modulus() if N % p != 0: N *= p else: e = N.valuation(p) N.divide_knowing_divisible_by(p ** (e-1)) chi = DirichletGroup(N, GF(p))[0] elif chi.modulus() % p != 0: chi = DirichletGroup(chi.modulus() * p, GF(p))(chi) DG = DirichletGroup(chi.modulus(), GF(p)) if r == 0: from sage.modular.arithgroup.congroup_gamma0 import Gamma0_constructor as Gamma0 verbose("in dim: %s, %s, %s"%(self.sign(), chi, p)) M = ModularSymbols(DG(chi), 2, self.sign(), GF(p)) else: psi = [GF(p)(u) ** r for u in DG.unit_gens()] #mod p Teichmuller^r psi = DG(psi) M = ModularSymbols(DG(chi) * psi, 2, self.sign(), GF(p)) if cusp: M = M.cuspidal_subspace() hecke_poly = M.hecke_polynomial(p) verbose("in dim: %s"%(hecke_poly)) x = hecke_poly.parent().gen() d = hecke_poly.degree() - hecke_poly.ord(x) self._ord_dim_dict[(p, cusp)] = d return d