def __init__(self, group, weight, base_ring, character=None): """ Create an ambient space of modular forms. EXAMPLES:: sage: m = ModularForms(Gamma1(20),20); m Modular Forms space of dimension 238 for Congruence Subgroup Gamma1(20) of weight 20 over Rational Field sage: m.is_ambient() True """ if not arithgroup.is_CongruenceSubgroup(group): raise TypeError, 'group (=%s) must be a congruence subgroup' % group weight = rings.Integer(weight) if character is None and arithgroup.is_Gamma0(group): character = dirichlet.TrivialCharacter(group.level(), base_ring) space.ModularFormsSpace.__init__(self, group, weight, character, base_ring) try: d = self.dimension() except NotImplementedError: d = None hecke.AmbientHeckeModule.__init__(self, base_ring, d, group.level(), weight)
def __init__(self, group = arithgroup.Gamma0(1), weight = 2, sign = 0, base_ring = rings.QQ, character = None): """ Space of boundary symbols for a congruence subgroup of SL_2(Z). This class is an abstract base class, so only derived classes should be instantiated. INPUT: - ``weight`` - int, the weight - ``group`` - arithgroup.congroup_generic.CongruenceSubgroup, a congruence subgroup. - ``sign`` - int, either -1, 0, or 1 - ``base_ring`` - rings.Ring (defaults to the rational numbers) EXAMPLES:: sage: B = ModularSymbols(Gamma0(11),2).boundary_space() sage: isinstance(B, sage.modular.modsym.boundary.BoundarySpace) True sage: B == loads(dumps(B)) True """ weight = int(weight) if weight <= 1: raise ArithmeticError("weight must be at least 2") if not arithgroup.is_CongruenceSubgroup(group): raise TypeError("group must be a congruence subgroup") sign = int(sign) if not isinstance(base_ring, rings.Ring) and rings.is_CommutativeRing(base_ring): raise TypeError("base_ring must be a commutative ring") if character is None and arithgroup.is_Gamma0(group): character = dirichlet.TrivialCharacter(group.level(), base_ring) (self.__group, self.__weight, self.__character, self.__sign, self.__base_ring) = (group, weight, character, sign, base_ring) self._known_gens = [] self._known_gens_repr = [] self._is_zero = [] hecke.HeckeModule_generic.__init__(self, base_ring, group.level())