Path: blob/master/src/sage/modular/modform/ambient_g0.py
8820 views
r"""1Modular Forms for `\Gamma_0(N)` over `\QQ`23TESTS::45sage: m = ModularForms(Gamma0(389),6)6sage: loads(dumps(m)) == m7True8"""910#########################################################################11# Copyright (C) 2006 William Stein <[email protected]>12#13# Distributed under the terms of the GNU General Public License (GPL)14#15# http://www.gnu.org/licenses/16#########################################################################1718import sage.rings.all as rings1920import sage.modular.arithgroup.all as arithgroup2122import ambient23import cuspidal_submodule24import eisenstein_submodule2526class ModularFormsAmbient_g0_Q(ambient.ModularFormsAmbient):27"""28A space of modular forms for `\Gamma_0(N)` over `\QQ`.29"""30def __init__(self, level, weight):31r"""32Create a space of modular symbols for `\Gamma_0(N)` of given33weight defined over `\QQ`.3435EXAMPLES::3637sage: m = ModularForms(Gamma0(11),4); m38Modular Forms space of dimension 4 for Congruence Subgroup Gamma0(11) of weight 4 over Rational Field39sage: type(m)40<class 'sage.modular.modform.ambient_g0.ModularFormsAmbient_g0_Q_with_category'>41"""42ambient.ModularFormsAmbient.__init__(self, arithgroup.Gamma0(level), weight, rings.QQ)4344####################################################################45# Computation of Special Submodules46####################################################################47def cuspidal_submodule(self):48r"""49Return the cuspidal submodule of this space of modular forms for50`\Gamma_0(N)`.5152EXAMPLES::5354sage: m = ModularForms(Gamma0(33),4)55sage: s = m.cuspidal_submodule(); s56Cuspidal subspace of dimension 10 of Modular Forms space of dimension 14 for Congruence Subgroup Gamma0(33) of weight 4 over Rational Field57sage: type(s)58<class 'sage.modular.modform.cuspidal_submodule.CuspidalSubmodule_g0_Q_with_category'>59"""60try:61return self.__cuspidal_submodule62except AttributeError:63if self.level() == 1:64self.__cuspidal_submodule = cuspidal_submodule.CuspidalSubmodule_level1_Q(self)65else:66self.__cuspidal_submodule = cuspidal_submodule.CuspidalSubmodule_g0_Q(self)67return self.__cuspidal_submodule6869def eisenstein_submodule(self):70r"""71Return the Eisenstein submodule of this space of modular forms for72`\Gamma_0(N)`.7374EXAMPLES::7576sage: m = ModularForms(Gamma0(389),6)77sage: m.eisenstein_submodule()78Eisenstein subspace of dimension 2 of Modular Forms space of dimension 163 for Congruence Subgroup Gamma0(389) of weight 6 over Rational Field79"""80try:81return self.__eisenstein_submodule82except AttributeError:83self.__eisenstein_submodule = eisenstein_submodule.EisensteinSubmodule_g0_Q(self)84return self.__eisenstein_submodule8586def _compute_atkin_lehner_matrix(self, d):87r"""88Compute the matrix of the Atkin-Lehner involution W_d acting on self,89where d is a divisor of the level. This is only implemented in the90(trivial) level 1 case.9192EXAMPLE::9394sage: ModularForms(1, 30).atkin_lehner_operator()95Hecke module morphism Atkin-Lehner operator W_1 defined by the matrix96[1 0 0]97[0 1 0]98[0 0 1]99Domain: Modular Forms space of dimension 3 for Modular Group SL(2,Z) ...100Codomain: Modular Forms space of dimension 3 for Modular Group SL(2,Z) ...101"""102if self.level() == 1:103from sage.matrix.matrix_space import MatrixSpace104return MatrixSpace(self.base_ring(), self.rank())(1)105else:106raise NotImplementedError107108109