Path: blob/master/src/sage/modular/modform/submodule.py
8820 views
"""1Submodules of spaces of modular forms23EXAMPLES::45sage: M = ModularForms(Gamma1(13),2); M6Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field7sage: M.eisenstein_subspace()8Eisenstein subspace of dimension 11 of Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field9sage: M == loads(dumps(M))10True11sage: M.cuspidal_subspace()12Cuspidal subspace of dimension 2 of Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field13"""1415#########################################################################16# Copyright (C) 2004--2006 William Stein <[email protected]>17#18# Distributed under the terms of the GNU General Public License (GPL)19#20# http://www.gnu.org/licenses/21#########################################################################2223import space2425import sage.modular.hecke.submodule2627class ModularFormsSubmodule(space.ModularFormsSpace,28sage.modular.hecke.submodule.HeckeSubmodule):29"""30A submodule of an ambient space of modular forms.31"""32def __init__(self, ambient_module, submodule, dual=None, check=False):33"""34INPUT:3536- ambient_module -- ModularFormsSpace37- submodule -- a submodule of the ambient space.38- dual_module -- (default: None) ignored39- check -- (default: False) whether to check that the40submodule is Hecke equivariant4142EXAMPLES::4344sage: M = ModularForms(Gamma1(13),2); M45Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field46sage: M.eisenstein_subspace()47Eisenstein subspace of dimension 11 of Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field4849"""50A = ambient_module51sage.modular.hecke.submodule.HeckeSubmodule.__init__(self, A, submodule, check=check)52space.ModularFormsSpace.__init__(self, A.group(), A.weight(),53A.character(), A.base_ring())5455def _repr_(self):56"""57EXAMPLES::5859sage: ModularForms(Gamma1(13),2).eisenstein_subspace()._repr_()60'Eisenstein subspace of dimension 11 of Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field'61"""62return "Modular Forms subspace of dimension %s of %s"%(self.dimension(), self.ambient_module())6364def _compute_coefficients(self, element, X):65"""66Compute all coefficients of the modular form element in self for67indices in X.6869TODO: Implement this function.7071EXAMPLES::7273sage: M = ModularForms(6,4).cuspidal_subspace()74sage: M._compute_coefficients( M.basis()[0], range(1,100) )75Traceback (most recent call last):76...77NotImplementedError78"""79raise NotImplementedError8081def _compute_q_expansion_basis(self, prec):82"""83Compute q_expansions to precision prec for each element in self.basis().8485EXAMPLES::8687sage: M = ModularForms(Gamma1(13),2); M88Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field89sage: S = M.eisenstein_subspace(); S90Eisenstein subspace of dimension 11 of Modular Forms space of dimension 13 for Congruence Subgroup Gamma1(13) of weight 2 over Rational Field91sage: S._compute_q_expansion_basis(5)92[1 + O(q^5),93q + O(q^5),94q^2 + O(q^5),95q^3 + O(q^5),96q^4 + O(q^5),97O(q^5),98O(q^5),99O(q^5),100O(q^5),101O(q^5),102O(q^5)]103"""104A = self.ambient_module()105return [A._q_expansion(element = f.element(), prec=prec) for f in self.basis()]106107108# TODO109class ModularFormsSubmoduleWithBasis(ModularFormsSubmodule):110pass111112113114115116117118