Ticket #6071: trac_6071-weight1_eisenstein.patch

File trac_6071-weight1_eisenstein.patch, 12.7 KB (added by davidloeffler, 14 years ago)

Replaces previous patch

  • sage/modular/modform/ambient.py

    # HG changeset patch
    # User David Loeffler <D.Loeffler@dpmms.cam.ac.uk>
    # Date 1241513458 -3600
    # Node ID ca1f179559ede4256d2a2206a5f2e072d28a6443
    # Parent  810c7ca6f8087c98e80d84a053e5f1c4ab9c9205
    #6071: weight 1 Eisenstein series
    
    diff -r 810c7ca6f808 -r ca1f179559ed sage/modular/modform/ambient.py
    a b  
    115115            character = dirichlet.TrivialCharacter(group.level(), base_ring)
    116116           
    117117        space.ModularFormsSpace.__init__(self, group, weight, character, base_ring)
    118         hecke.AmbientHeckeModule.__init__(self, base_ring, self.dimension(), group.level(), weight)
     118        try:
     119            d = self.dimension()
     120        except NotImplementedError:
     121            d = None
     122        hecke.AmbientHeckeModule.__init__(self, base_ring, d, group.level(), weight)
    119123
    120124    def _repr_(self):
    121125        """
     
    134138            sage: m._repr_()
    135139            'Modular Forms space of dimension 1198 for Congruence Subgroup Gamma1(20) of weight 100 over Rational Field'
    136140        """
     141        try:
     142            d = self.dimension()
     143        except NotImplementedError:
     144            d = "(unknown)"
    137145        return "Modular Forms space of dimension %s for %s of weight %s over %s"%(
    138                 self.dimension(), self.group(), self.weight(), self.base_ring())
     146                d, self.group(), self.weight(), self.base_ring())
    139147
    140148    def _submodule_class(self):
    141149        """
     
    348356            Vector space of dimension 69 over Rational Field
    349357            sage: ModularForms(Gamma1(13),4, GF(49,'b')).free_module()
    350358            Vector space of dimension 27 over Finite Field in b of size 7^2
     359
     360            sage: M = ModularForms(Gamma1(57), 1); M
     361            Modular Forms space of dimension (unknown) for Congruence ...
     362            sage: M.free_module()
     363            Vector space of dimension 36 over Rational Field
     364            sage: M.basis()
     365            Traceback (most recent call last):
     366            ...
     367            NotImplementedError: Computation of dimensions of weight 1 cusp forms spaces not implemented in general
    351368        """
    352369        if hasattr(self, "__module"): return self.__module
    353         self.__module = free_module.VectorSpace(self.base_ring(),
    354                                                  self.dimension())
     370        try:
     371            d = self.dimension()
     372        except NotImplementedError:
     373           
     374            # This only comes up for weight 1 forms, where we want to be able
     375            # to embed Eisenstein forms (which we know how to calculate) into
     376            # some suitable ambient space. Because we can't even calculate the
     377            # dimension of the weight 1 cusp forms in general, we just map
     378            # Eisenstein series onto basis vectors, and then make it clear by
     379            # raising errors in appropriate places that some cusp forms might
     380            # exist but we don't know how to compute them.
     381
     382            d = self._dim_eisenstein()
     383        self.__module = free_module.VectorSpace(self.base_ring(), d)
    355384        return self.__module
    356385
     386    def free_module(self): return self.module()
     387    # stupid thing: there are functions in classes ModularFormsSpace and
     388    # HeckeModule that both do much the same thing, and one has to override
     389    # both of them!
     390
    357391    def prec(self, new_prec=None):
    358392        """
    359393        Set or get default initial precision for printing modular forms.
  • sage/modular/modform/ambient_eps.py

    diff -r 810c7ca6f808 -r ca1f179559ed sage/modular/modform/ambient_eps.py
    a b  
    144144            sage: m
    145145            Modforms of level 8
    146146        """
     147        try:
     148            d = self.dimension()
     149        except NotImplementedError:
     150            d = "(unknown)"
    147151        return "Modular Forms space of dimension %s, character %s and weight %s over %s"%(
    148             self.dimension(), self.character(), self.weight(), self.base_ring())
     152            d, self.character(), self.weight(), self.base_ring())
    149153
    150154    def cuspidal_submodule(self):
    151155        """
  • sage/modular/modform/constructor.py

    diff -r 810c7ca6f808 -r ca1f179559ed sage/modular/modform/constructor.py
    a b  
    1515    1 + 4092/50521*q^2 + 472384/50521*q^3 + 4194300/50521*q^4 + O(q^6),
    1616    q + 1024*q^2 + 59048*q^3 + 1048576*q^4 + 9765626*q^5 + O(q^6)
    1717    ]
     18
    1819"""
    1920
    2021#########################################################################
     
    9192        ValueError: group and level do not match.
    9293    """
    9394    weight = rings.Integer(weight)
    94     if weight <= 1:
    95         raise NotImplementedError, "weight must be at least 2"
     95    if weight <= 0:
     96        raise NotImplementedError, "weight must be at least 1"
    9697 
    9798    if isinstance(group, dirichlet.DirichletCharacter):
    9899        if ( group.level() != rings.Integer(level) ):
     
    235236
    236237        sage: ModularForms(gp(1), gap(12))
    237238        Modular Forms space of dimension 2 for Modular Group SL(2,Z) of weight 12 over Rational Field
     239
     240
     241    We create some weight 1 spaces. The first example works fine, since we can prove purely by Riemann surface theory that there are no weight 1 cusp forms::
     242
     243        sage: M = ModularForms(Gamma1(11), 1); M
     244        Modular Forms space of dimension 5 for Congruence Subgroup Gamma1(11) of weight 1 over Rational Field
     245        sage: M.basis()
     246        [                                                                                           
     247        1 + 22*q^5 + O(q^6),                                                                       
     248        q + 4*q^5 + O(q^6),                                                                         
     249        q^2 - 4*q^5 + O(q^6),                                                                       
     250        q^3 - 5*q^5 + O(q^6),                                                                       
     251        q^4 - 3*q^5 + O(q^6)                                                                       
     252        ]                                                                                           
     253        sage: M.cuspidal_subspace().basis()
     254        [
     255        ]
     256        sage: M == M.eisenstein_subspace()
     257        True
     258
     259    This example doesn't work so well, because we can't calculate the cusp
     260    forms; but we can still work with the Eisenstein series.
     261
     262        sage: M = ModularForms(Gamma1(57), 1); M
     263        Modular Forms space of dimension (unknown) for Congruence Subgroup Gamma1(57) of weight 1 over Rational Field
     264        sage: M.basis()
     265        Traceback (most recent call last):
     266        ...
     267        NotImplementedError: Computation of dimensions of weight 1 cusp forms spaces not implemented in general
     268        sage: M.cuspidal_subspace().basis()
     269        Traceback (most recent call last):
     270        ...
     271        NotImplementedError: Computation of dimensions of weight 1 cusp forms spaces not implemented in general
     272       
     273        sage: E = M.eisenstein_subspace(); E
     274        Eisenstein subspace of dimension 36 of Modular Forms space of dimension (unknown) for Congruence Subgroup Gamma1(57) of weight 1 over Rational Field
     275        sage: (E.0 + E.2).q_expansion(40)
     276        1 + q^2 + 1473/2*q^36 - 1101/2*q^37 + q^38 - 373/2*q^39 + O(q^40)
     277           
    238278    """
    239279    if isinstance(group, dirichlet.DirichletCharacter):
    240280        if base_ring is None:
  • sage/modular/modform/cuspidal_submodule.py

    diff -r 810c7ca6f808 -r ca1f179559ed sage/modular/modform/cuspidal_submodule.py
    a b  
    199199            prec = self.prec()
    200200        else:
    201201            prec = Integer(prec)
     202        if self.dimension() == 0:
     203            return []
    202204        M = self.modular_symbols(sign = 1)
    203205        return M.q_expansion_basis(prec)
    204206
  • sage/modular/modform/eis_series.py

    diff -r 810c7ca6f808 -r ca1f179559ed sage/modular/modform/eis_series.py
    a b  
    231231                    if chi*psi == eps:
    232232                        chi0, psi0 = __common_minimal_basering(chi, psi)
    233233                        for t in divisors(N//(R*L)):
    234                             params.append( (chi0,psi0,t) )
     234                            if k != 1 or ((psi0, chi0, t) not in params):
     235                                params.append( (chi0,psi0,t) )
    235236    return params
    236237
    237238
     
    275276        for j in range(i,len(E)):
    276277            if parity[i]*parity[j] == s and N % (E[i].conductor()*E[j].conductor()) == 0:
    277278                chi, psi = __common_minimal_basering(E[i], E[j])
    278                 pairs.append((chi, psi))
    279                 if i!=j: pairs.append((psi,chi))
     279                if k != 1:
     280                    pairs.append((chi, psi))
     281                    if i!=j: pairs.append((psi,chi))
     282                else:
     283                    # if weight is 1 then (chi, psi) and (chi, psi) are the
     284                    # same form
     285                    if psi.is_trivial() and not chi.is_trivial():
     286                        # need to put the trivial character first to get the L-value right
     287                        pairs.append((psi, chi))
     288                    else:
     289                        pairs.append((chi, psi))
    280290        #end fors
    281291    #end if
    282292   
     
    354364    Compute and return a list of all parameters `(\chi,\psi,t)` that
    355365    define the Eisenstein series with given character and weight `k`.
    356366
    357     Only the parity of `k` is relevant.
     367    Only the parity of `k` is relevant (unless k = 1, which is a slightly different case).
    358368
    359369    If character is an integer `N`, then the parameters for
    360370    `\Gamma_1(N)` are computed instead.  Then the condition is that
     
    374384        ([1, 1], [1, 1], 10),
    375385        ([1, 1], [1, 1], 15),
    376386        ([1, 1], [1, 1], 30)]
     387
     388        sage: sage.modular.modform.eis_series.compute_eisenstein_params(15, 1)
     389        [([1, 1], [-1, 1], 1),
     390         ([1, 1], [-1, 1], 5),
     391         ([1, 1], [1, zeta4], 1),
     392         ([1, 1], [1, zeta4], 3),
     393         ([1, 1], [-1, -1], 1),
     394         ([1, 1], [1, -zeta4], 1),
     395         ([1, 1], [1, -zeta4], 3),
     396         ([-1, 1], [1, -1], 1)]
     397         
     398        sage: sage.modular.modform.eis_series.compute_eisenstein_params(DirichletGroup(15).0, 1)
     399        [([1, 1], [-1, 1], 1), ([1, 1], [-1, 1], 5)]
    377400    """
    378401    if isinstance(character, (int,long,Integer)):
    379402        N = character
  • sage/modular/modform/eisenstein_submodule.py

    diff -r 810c7ca6f808 -r ca1f179559ed sage/modular/modform/eisenstein_submodule.py
    a b  
    6666       
    6767    def modular_symbols(self, sign=0):
    6868        r"""
    69         Return the corresponding space of modular symbols with given sign.
     69        Return the corresponding space of modular symbols with given sign. This
     70        will fail in weight 1.
    7071
    7172        .. warning::
    7273
     
    9697            sage: E = EisensteinForms(eps^2, 2)
    9798            sage: E.modular_symbols()
    9899            Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 4 and level 13, weight 2, character [zeta6], sign 0, over Cyclotomic Field of order 6 and degree 2
     100
     101            sage: E = EisensteinForms(eps, 1); E
     102            Eisenstein subspace of dimension 1 of Modular Forms space of dimension 1, character [zeta12] and weight 1 over Cyclotomic Field of order 12 and degree 4
     103            sage: E.modular_symbols()
     104            Traceback (most recent call last):
     105            ...
     106            ValueError: the weight must be at least 2
    99107        """
    100108        try:
    101109            return self.__modular_symbols[sign]
     
    143151            ([-1, 1, 1], [1, 1, 1], 2),
    144152            ([-1, 1, 1], [1, 1, 1], 3),
    145153            ([-1, 1, 1], [1, 1, 1], 6)]
     154            sage: EisensteinForms(DirichletGroup(24).0,1).parameters()
     155            [([1, 1, 1], [-1, 1, 1], 1),
     156            ([1, 1, 1], [-1, 1, 1], 2),
     157            ([1, 1, 1], [-1, 1, 1], 3),
     158            ([1, 1, 1], [-1, 1, 1], 6)]
    146159        """
    147160        try:
    148161            return self.__parameters
     
    269282            sage: M.eisenstein_series()
    270283            [
    271284            ]
     285
     286            sage: M = ModularForms(DirichletGroup(13).0, 1)
     287            sage: M.eisenstein_series()
     288            [
     289            -1/13*zeta12^3 + 6/13*zeta12^2 + 4/13*zeta12 + 2/13 + q + (zeta12 + 1)*q^2 + zeta12^2*q^3 + (zeta12^2 + zeta12 + 1)*q^4 + (-zeta12^3 + 1)*q^5 + O(q^6)
     290            ]
    272291        """
    273292        try:
    274293            return self.__eisenstein_series