Path: blob/master/src/sage/modular/modform/ambient_g1.py
8820 views
r"""1Modular Forms for `\Gamma_1(N)` and `\Gamma_H(N)` over `\QQ`23EXAMPLES::45sage: M = ModularForms(Gamma1(13),2); M6Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field7sage: S = M.cuspidal_submodule(); S8Cuspidal subspace of dimension 2 of Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field9sage: S.basis()10[11q - 4*q^3 - q^4 + 3*q^5 + O(q^6),12q^2 - 2*q^3 - q^4 + 2*q^5 + O(q^6)13]1415sage: M = ModularForms(GammaH(11, [4])); M16Modular Forms space of dimension 2 for Congruence Subgroup Gamma_H(11) with H generated by [4] of weight 2 over Rational Field17sage: M.q_expansion_basis(8)18[19q - 2*q^2 - q^3 + 2*q^4 + q^5 + 2*q^6 - 2*q^7 + O(q^8),201 + 12/5*q + 36/5*q^2 + 48/5*q^3 + 84/5*q^4 + 72/5*q^5 + 144/5*q^6 + 96/5*q^7 + O(q^8)21]222324TESTS::2526sage: m = ModularForms(Gamma1(20),2)27sage: loads(dumps(m)) == m28True2930sage: m = ModularForms(GammaH(15, [4]), 2)31sage: loads(dumps(m)) == m32True333435We check that #10453 is fixed::3637sage: CuspForms(Gamma1(11), 2).old_submodule()38Modular Forms subspace of dimension 0 of Modular Forms space of dimension 10 for Congruence Subgroup Gamma1(11) of weight 2 over Rational Field39sage: ModularForms(Gamma1(3), 12).old_submodule()40Modular Forms subspace of dimension 4 of Modular Forms space of dimension 5 for Congruence Subgroup Gamma1(3) of weight 12 over Rational Field4142"""4344#########################################################################45# Copyright (C) 2006 William Stein <[email protected]>46#47# Distributed under the terms of the GNU General Public License (GPL)48#49# http://www.gnu.org/licenses/50#########################################################################5152import sage.rings.all as rings5354import sage.modular.arithgroup.all as arithgroup5556import ambient57import cuspidal_submodule58import eisenstein_submodule5960class ModularFormsAmbient_gH_Q(ambient.ModularFormsAmbient):61"""62A space of modular forms for the group `\Gamma_H(N)` over the rational numbers.63"""64def __init__(self, group, weight):65r"""66Create a space of modular forms for `\Gamma_H(N)` of integral weight over the67rational numbers.6869EXAMPLES::7071sage: m = ModularForms(GammaH(100, [41]),5); m72Modular Forms space of dimension 270 for Congruence Subgroup Gamma_H(100) with H generated by [41] of weight 5 over Rational Field73sage: type(m)74<class 'sage.modular.modform.ambient_g1.ModularFormsAmbient_gH_Q_with_category'>75"""76ambient.ModularFormsAmbient.__init__(self, group, weight, rings.QQ)7778####################################################################79# Computation of Special Submodules80####################################################################81def cuspidal_submodule(self):82"""83Return the cuspidal submodule of this modular forms space.8485EXAMPLES::8687sage: m = ModularForms(GammaH(100, [29]),2); m88Modular Forms space of dimension 48 for Congruence Subgroup Gamma_H(100) with H generated by [29] of weight 2 over Rational Field89sage: m.cuspidal_submodule()90Cuspidal subspace of dimension 13 of Modular Forms space of dimension 48 for Congruence Subgroup Gamma_H(100) with H generated by [29] of weight 2 over Rational Field91"""92try:93return self.__cuspidal_submodule94except AttributeError:95if self.level() == 1:96self.__cuspidal_submodule = cuspidal_submodule.CuspidalSubmodule_level1_Q(self)97else:98self.__cuspidal_submodule = cuspidal_submodule.CuspidalSubmodule_gH_Q(self)99return self.__cuspidal_submodule100101def eisenstein_submodule(self):102"""103Return the Eisenstein submodule of this modular forms space.104105EXAMPLES::106107sage: E = ModularForms(GammaH(100, [29]),3).eisenstein_submodule(); E108Eisenstein subspace of dimension 24 of Modular Forms space of dimension 72 for Congruence Subgroup Gamma_H(100) with H generated by [29] of weight 3 over Rational Field109sage: type(E)110<class 'sage.modular.modform.eisenstein_submodule.EisensteinSubmodule_gH_Q_with_category'>111"""112try:113return self.__eisenstein_submodule114except AttributeError:115self.__eisenstein_submodule = eisenstein_submodule.EisensteinSubmodule_gH_Q(self)116return self.__eisenstein_submodule117118def _compute_diamond_matrix(self, d):119r"""120Compute the matrix of the diamond operator <d> on this space.121122EXAMPLE::123124sage: ModularForms(GammaH(9, [4]), 7)._compute_diamond_matrix(2)125[-1 0 0 0 0 0 0 0]126[ 0 -1 0 0 0 0 0 0]127[ 0 0 -1 0 0 0 0 0]128[ 0 0 0 -1 0 0 0 0]129[ 0 0 0 0 -1 0 0 0]130[ 0 0 0 0 0 -1 0 0]131[ 0 0 0 0 0 0 -1 0]132[ 0 0 0 0 0 0 0 -1]133"""134return self.cuspidal_submodule().diamond_bracket_matrix(d).block_sum(self.eisenstein_submodule().diamond_bracket_matrix(d))135136def _compute_hecke_matrix(self, n):137r"""138Compute the matrix of the Hecke operator T_n acting on this space.139140EXAMPLE::141142sage: ModularForms(Gamma1(7), 4).hecke_matrix(3) # indirect doctest143[ 0 -42 133 0 0 0 0 0 0]144[ 0 -28 91 0 0 0 0 0 0]145[ 1 -8 19 0 0 0 0 0 0]146[ 0 0 0 28 0 0 0 0 0]147[ 0 0 0 -10152/259 0 5222/37 -13230/37 -22295/37 92504/37]148[ 0 0 0 -6087/259 0 312067/4329 1370420/4329 252805/333 3441466/4329]149[ 0 0 0 -729/259 1 485/37 3402/37 5733/37 7973/37]150[ 0 0 0 729/259 0 -189/37 -1404/37 -2366/37 -3348/37]151[ 0 0 0 255/259 0 -18280/4329 -51947/4329 -10192/333 -190855/4329]152"""153return self.cuspidal_submodule().hecke_matrix(n).block_sum(self.eisenstein_submodule().hecke_matrix(n))154155156class ModularFormsAmbient_g1_Q(ModularFormsAmbient_gH_Q):157"""158A space of modular forms for the group `\Gamma_1(N)` over the rational numbers.159"""160def __init__(self, level, weight):161r"""162Create a space of modular forms for `\Gamma_1(N)` of integral weight over the163rational numbers.164165EXAMPLES::166167sage: m = ModularForms(Gamma1(100),5); m168Modular Forms space of dimension 1270 for Congruence Subgroup Gamma1(100) of weight 5 over Rational Field169sage: type(m)170<class 'sage.modular.modform.ambient_g1.ModularFormsAmbient_g1_Q_with_category'>171"""172ambient.ModularFormsAmbient.__init__(self, arithgroup.Gamma1(level), weight, rings.QQ)173174####################################################################175# Computation of Special Submodules176####################################################################177def cuspidal_submodule(self):178"""179Return the cuspidal submodule of this modular forms space.180181EXAMPLES::182183sage: m = ModularForms(Gamma1(17),2); m184Modular Forms space of dimension 20 for Congruence Subgroup Gamma1(17) of weight 2 over Rational Field185sage: m.cuspidal_submodule()186Cuspidal subspace of dimension 5 of Modular Forms space of dimension 20 for Congruence Subgroup Gamma1(17) of weight 2 over Rational Field187"""188try:189return self.__cuspidal_submodule190except AttributeError:191if self.level() == 1:192self.__cuspidal_submodule = cuspidal_submodule.CuspidalSubmodule_level1_Q(self)193else:194self.__cuspidal_submodule = cuspidal_submodule.CuspidalSubmodule_g1_Q(self)195return self.__cuspidal_submodule196197def eisenstein_submodule(self):198"""199Return the Eisenstein submodule of this modular forms space.200201EXAMPLES::202203sage: ModularForms(Gamma1(13),2).eisenstein_submodule()204Eisenstein subspace of dimension 11 of Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field205sage: ModularForms(Gamma1(13),10).eisenstein_submodule()206Eisenstein subspace of dimension 12 of Modular Forms space of dimension 69 for Congruence Subgroup Gamma1(13) of weight 10 over Rational Field207"""208try:209return self.__eisenstein_submodule210except AttributeError:211self.__eisenstein_submodule = eisenstein_submodule.EisensteinSubmodule_g1_Q(self)212return self.__eisenstein_submodule213214215216