Ticket #6071: trac_6071.patch

File trac_6071.patch, 6.7 KB (added by davidloeffler, 14 years ago)

patch against 4.0.alpha0

  • sage/modular/modform/ambient.py

    # HG changeset patch
    # User David Loeffler <D.Loeffler@dpmms.cam.ac.uk>
    # Date 1241513458 -3600
    # Node ID daf2231db4789777ccb2fbfd8c6ec046ad5873d4
    # Parent  7488340543618251888907e60499593a1c911890
    #6071: weight 1 Eisenstein series
    
    diff -r 748834054361 -r daf2231db478 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        """
     
    350358            Vector space of dimension 27 over Finite Field in b of size 7^2
    351359        """
    352360        if hasattr(self, "__module"): return self.__module
    353         self.__module = free_module.VectorSpace(self.base_ring(),
    354                                                  self.dimension())
     361        try:
     362            d = self.dimension()
     363        except NotImplementedError:
     364            d = self._dim_eisenstein()
     365        self.__module = free_module.VectorSpace(self.base_ring(), d)
    355366        return self.__module
    356367
     368    def free_module(self): return self.module()
     369    # stupid thing: there are functions in classes ModularFormsSpace and
     370    # HeckeModule that both do much the same thing, and one has to override
     371    # both of them!
     372
    357373    def prec(self, new_prec=None):
    358374        """
    359375        Set or get default initial precision for printing modular forms.
  • sage/modular/modform/ambient_eps.py

    diff -r 748834054361 -r daf2231db478 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 748834054361 -r daf2231db478 sage/modular/modform/constructor.py
    a b  
    9191        ValueError: group and level do not match.
    9292    """
    9393    weight = rings.Integer(weight)
    94     if weight <= 1:
    95         raise NotImplementedError, "weight must be at least 2"
     94    if weight <= 0:
     95        raise NotImplementedError, "weight must be at least 1"
    9696 
    9797    if isinstance(group, dirichlet.DirichletCharacter):
    9898        if ( group.level() != rings.Integer(level) ):
  • sage/modular/modform/cuspidal_submodule.py

    diff -r 748834054361 -r daf2231db478 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 748834054361 -r daf2231db478 sage/modular/modform/eis_series.py
    a b  
    233233                    if chi*psi == eps:
    234234                        chi0, psi0 = __common_minimal_basering(chi, psi)
    235235                        for t in divisors(N//(R*L)):
    236                             params.append( (chi0,psi0,t) )
     236                            if k != 1 or ((psi0, chi0, t) not in params):
     237                                params.append( (chi0,psi0,t) )
    237238    return params
    238239
    239240
     
    277278        for j in range(i,len(E)):
    278279            if parity[i]*parity[j] == s and N % (E[i].conductor()*E[j].conductor()) == 0:
    279280                chi, psi = __common_minimal_basering(E[i], E[j])
    280                 pairs.append((chi, psi))
    281                 if i!=j: pairs.append((psi,chi))
     281                if k != 1:
     282                    pairs.append((chi, psi))
     283                    if i!=j: pairs.append((psi,chi))
     284                else:
     285                    # if weight is 1 then (chi, psi) and (chi, psi) are the
     286                    # same form
     287                    if psi.is_trivial() and not chi.is_trivial():
     288                        # need to put the trivial character first to get the L-value right
     289                        pairs.append((psi, chi))
     290                    else:
     291                        pairs.append((chi, psi))
    282292        #end fors
    283293    #end if
    284294   
     
    355365    Compute and return a list of all parameters `(\chi,\psi,t)` that
    356366    define the Eisenstein series with given character and weight `k`.
    357367
    358     Only the parity of `k` is relevant.
     368    Only the parity of `k` is relevant (unless k = 1, which is a slightly different case).
    359369
    360370    If character is an integer `N`, then the parameters for
    361371    `\Gamma_1(N)` are computed instead.  Then the condition is that
     
    375385        ([1, 1], [1, 1], 10),
    376386        ([1, 1], [1, 1], 15),
    377387        ([1, 1], [1, 1], 30)]
     388
     389        sage: sage.modular.modform.eis_series.compute_eisenstein_params(15, 1)
     390        [([1, 1], [-1, 1], 1),
     391         ([1, 1], [-1, 1], 5),
     392         ([1, 1], [1, zeta4], 1),
     393         ([1, 1], [1, zeta4], 3),
     394         ([1, 1], [-1, -1], 1),
     395         ([1, 1], [1, -zeta4], 1),
     396         ([1, 1], [1, -zeta4], 3),
     397         ([-1, 1], [1, -1], 1)]
     398         
     399        sage: sage.modular.modform.eis_series.compute_eisenstein_params(DirichletGroup(15).0, 1)
     400        [([1, 1], [-1, 1], 1), ([1, 1], [-1, 1], 5)]
    378401    """
    379402    if isinstance(character, (int,long,Integer)):
    380403        N = character