Ticket #12640: trac_12640.patch

File trac_12640.patch, 1.9 KB (added by was, 10 years ago)
  • sage/modular/dims.py

    # HG changeset patch
    # User William Stein <wstein@gmail.com>
    # Date 1332182953 25200
    # Node ID 9d29db850bbe5eb0c2dde55877b6d32203d6c116
    # Parent  5d59e2d89b9c54c4a673fc69fe565c04e26e732d
    Trac #12640: some special cases of dimension_new_cusp_forms are broken
    
    diff --git a/sage/modular/dims.py b/sage/modular/dims.py
    a b  
    299299        12
    300300        sage: dimension_new_cusp_forms(Gamma1(30),3)
    301301        12
     302
     303    Check that Trac #12640 is fixed::
     304   
     305        sage: dimension_new_cusp_forms(DirichletGroup(1)(1), 12)
     306        1
     307        sage: dimension_new_cusp_forms(DirichletGroup(2)(1), 24)
     308        1
    302309    """
    303310    if is_GammaH(X):
    304311        return X.dimension_new_cusp_forms(k,p=p)
    305312    elif isinstance(X, dirichlet.DirichletCharacter):
    306         return Gamma1(X.modulus()).dimension_new_cusp_forms(k,eps=X,p=p)
     313        N = X.modulus()
     314        if N <= 2:
     315            return Gamma0(N).dimension_new_cusp_forms(k,p=p)
     316        else:
     317            # Gamma1(N) for N<=2 just returns Gamma0(N), which has no eps parameter. See Trac #12640.
     318            return Gamma1(N).dimension_new_cusp_forms(k,eps=X,p=p)
    307319    elif isinstance(X, (int,long,Integer)):
    308320        return Gamma0(X).dimension_new_cusp_forms(k,p=p)
    309321    else:
     
    400412        0
    401413        sage: dimension_cusp_forms(e^2,2)
    402414        1
     415
     416    Check that Trac #12640 is fixed::
     417
     418        sage: dimension_cusp_forms(DirichletGroup(1)(1), 12)
     419        1
     420        sage: dimension_cusp_forms(DirichletGroup(2)(1), 24)
     421        5       
    403422    """
    404423    if isinstance(X, dirichlet.DirichletCharacter):
    405         return Gamma1(X.modulus()).dimension_cusp_forms(k, X)
     424        N = X.modulus()
     425        if N <= 2:
     426            return Gamma0(N).dimension_cusp_forms(k)
     427        else:
     428            return Gamma1(N).dimension_cusp_forms(k, X)
    406429    elif is_ArithmeticSubgroup(X):
    407430        return X.dimension_cusp_forms(k)
    408431    elif isinstance(X, (Integer,int,long)):