Exemplo n.º 1
0
def parse_label(s):
    """
    Given a string s corresponding to a newform label, return the
    corresponding group and index.

    EXAMPLES::

        sage: sage.modular.modform.constructor.parse_label('11a')
        (Congruence Subgroup Gamma0(11), 0)
        sage: sage.modular.modform.constructor.parse_label('11aG1')
        (Congruence Subgroup Gamma1(11), 0)
        sage: sage.modular.modform.constructor.parse_label('11wG1')
        (Congruence Subgroup Gamma1(11), 22)
    """
    m = re.match(r'(\d+)([a-z]+)((?:G.*)?)$', s)
    if not m:
        raise ValueError, "Invalid label: %s" % s
    N, order, G = m.groups()
    N = int(N)
    index = 0
    for c in reversed(order):
        index = 26*index + ord(c)-ord('a')
    if G == '' or G == 'G0':
        G = arithgroup.Gamma0(N)
    elif G == 'G1':
        G = arithgroup.Gamma1(N)
    elif G[:2] == 'GH':
        if G[2] != '[' or G[-1] != ']':
            raise ValueError, "Invalid congruence subgroup label: %s" % G
        gens = [int(g.strip()) for g in G[3:-1].split(',')]
        return arithgroup.GammaH(N, gens)
    else:
        raise ValueError, "Invalid congruence subgroup label: %s" % G
    return G, index
Exemplo n.º 2
0
    def __init__(self, level, weight, sign, F):
        """
        Initialize a space of boundary modular symbols for Gamma1(N).

        INPUT:


        -  ``level`` - int, the level

        -  ``weight`` - int, the weight = 2

        -  ``sign`` - int, either -1, 0, or 1

        -  ``F`` - base ring

        EXAMPLES::

            sage: from sage.modular.modsym.boundary import BoundarySpace_wtk_g1
            sage: B = BoundarySpace_wtk_g1(17, 2, 0, QQ) ; B
            Boundary Modular Symbols space for Gamma_1(17) of weight 2 over Rational Field
            sage: B == loads(dumps(B))
            True
        """
        level = int(level)
        sign = int(sign)
        if sign not in [-1, 0, 1]:
            raise ArithmeticError("sign must be an int in [-1,0,1]")
        if level <= 0:
            raise ArithmeticError("level must be positive")

        BoundarySpace.__init__(self,
                               weight=weight,
                               group=arithgroup.Gamma1(level),
                               sign=sign,
                               base_ring=F)
Exemplo n.º 3
0
    def __init__(self, character, weight=2, base_ring=None, eis_only=False):
        """
        Create an ambient modular forms space with character.

        .. note::

           The base ring must be of characteristic 0.  The ambient_R
           Python module is used for computing in characteristic p,
           which we view as the reduction of characteristic 0.

        INPUT:

        - ``weight`` - int

        - ``character`` - dirichlet.DirichletCharacter

        - ``base_ring`` - base field

        EXAMPLES::

            sage: m = ModularForms(DirichletGroup(11).0,3); m
            Modular Forms space of dimension 3, character [zeta10] and weight 3 over Cyclotomic Field of order 10 and degree 4
            sage: type(m)
            <class 'sage.modular.modform.ambient_eps.ModularFormsAmbient_eps_with_category'>
        """
        if not dirichlet.is_DirichletCharacter(character):
            raise TypeError("character (=%s) must be a Dirichlet character"%character)
        if base_ring is None: base_ring=character.base_ring()
        if character.base_ring() != base_ring:
            character = character.change_ring(base_ring)
        if base_ring.characteristic() != 0:
            raise ValueError("the base ring must have characteristic 0.")
        group = arithgroup.Gamma1(character.modulus())
        base_ring = character.base_ring()
        ModularFormsAmbient.__init__(self, group, weight, base_ring, character, eis_only)
Exemplo n.º 4
0
    def __init__(self, level, weight):
        r"""
        Create a space of modular forms for `\Gamma_1(N)` of integral weight over the
        rational numbers.

        EXAMPLES::

            sage: m = ModularForms(Gamma1(100),5); m
            Modular Forms space of dimension 1270 for Congruence Subgroup Gamma1(100) of weight 5 over Rational Field
            sage: type(m)
            <class 'sage.modular.modform.ambient_g1.ModularFormsAmbient_g1_Q_with_category'>
        """
        ambient.ModularFormsAmbient.__init__(self, arithgroup.Gamma1(level), weight, rings.QQ)
Exemplo n.º 5
0
    def _modular_symbols_space_gamma1(self):
        """
        Return a space of modular symbols for Gamma1, with level a
        random choice from self.levels, weight from self.weights, and
        sign chosen randomly from [1, 0, -1].

        EXAMPLES:
            sage: sage.modular.modsym.tests.Test()._modular_symbols_space_gamma1() # random
            level = 3, weight = 4, sign = 0
            Modular Symbols space of dimension 2 for Gamma_1(3) of weight 4 with sign 0 and over Rational Field
        """
        level, weight, sign = self._level_weight_sign()
        M = modsym.ModularSymbols(arithgroup.Gamma1(level), weight, sign)
        self.current_space = M
        return M
Exemplo n.º 6
0
    def __init__(self, eps, weight, sign=0):
        """
        Space of boundary modular symbols with given weight, character, and
        sign.

        INPUT:


        -  ``eps`` - dirichlet.DirichletCharacter, the
           "Nebentypus" character.

        -  ``weight`` - int, the weight = 2

        -  ``sign`` - int, either -1, 0, or 1


        EXAMPLES::

            sage: B = ModularSymbols(DirichletGroup(6).0, 4).boundary_space() ; B
            Boundary Modular Symbols space of level 6, weight 4, character [-1] and dimension 0 over Rational Field
            sage: type(B)
            <class 'sage.modular.modsym.boundary.BoundarySpace_wtk_eps_with_category'>
            sage: B == loads(dumps(B))
            True
        """
        level = eps.modulus()
        sign = int(sign)
        self.__eps = eps
        if not sign in [-1,0,1]:
            raise ArithmeticError("sign must be an int in [-1,0,1]")
        if level <= 0:
            raise ArithmeticError("level must be positive")
        BoundarySpace.__init__(self,
                weight = weight,
                group = arithgroup.Gamma1(level),
                sign = sign,
                base_ring = eps.base_ring(),
                character = eps)