当前位置: 首页>>代码示例>>Python>>正文


Python dirichlet.DirichletGroup类代码示例

本文整理汇总了Python中sage.modular.dirichlet.DirichletGroup的典型用法代码示例。如果您正苦于以下问题:Python DirichletGroup类的具体用法?Python DirichletGroup怎么用?Python DirichletGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DirichletGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: central_character

 def central_character(self):
     r"""
     Return the central character of this representation. This is the
     restriction to `\QQ_p^\times` of the unique smooth character `\omega`
     of `\mathbf{A}^\times / \QQ^\times` such that `\omega(\varpi_\ell) =
     \ell^j \varepsilon(\ell)` for all primes `\ell \nmid Np`, where
     `\varpi_\ell` is a uniformiser at `\ell`, `\varepsilon` is the
     Nebentypus character of the newform `f`, and `j` is the twist factor
     (see the documentation for :func:`~LocalComponent`).
     
     EXAMPLES::
     
         sage: LocalComponent(Newform('27a'), 3).central_character()
         Character of Q_3*, of level 0, mapping 3 |--> 1
         
         sage: LocalComponent(Newforms(Gamma1(5), 5, names='c')[0], 5).central_character()
         Character of Q_5*, of level 1, mapping 2 |--> c0 + 1, 5 |--> 125
         
         sage: LocalComponent(Newforms(DirichletGroup(24)([1, -1,-1]), 3, names='a')[0], 2).central_character()
         Character of Q_2*, of level 3, mapping 7 |--> 1, 5 |--> -1, 2 |--> -2
     """
     from sage.rings.arith import crt
     chi = self.newform().character()
     f = self.prime() ** self.conductor()
     N = self.newform().level() // f
     G = DirichletGroup(f, self.coefficient_field())
     chip = G([chi(crt(ZZ(x), 1, f, N)) for x in G.unit_gens()]).primitive_character()
     a = crt(1, self.prime(), f, N)        
     
     if chip.conductor() == 1:
         return SmoothCharacterGroupQp(self.prime(), self.coefficient_field()).character(0, [chi(a) * self.prime()**self.twist_factor()])
     else:
         return SmoothCharacterGroupQp(self.prime(), self.coefficient_field()).character(chip.conductor().valuation(self.prime()), list((~chip).values_on_gens()) + [chi(a) * self.prime()**self.twist_factor()])
开发者ID:jwbober,项目名称:sagelib,代码行数:33,代码来源:local_comp.py

示例2: set_info_for_navigation

def set_info_for_navigation(info, is_set, sbar):
    r"""
    Set information for the navigation page.
    """
    (friends, lifts) = sbar
    ## We always print the list of weights
    info['initial_list_of_weights'] = print_list_of_weights()
# ajax_more2(print_list_of_weights,{'kstart':[0,10,25,50],'klen':[15,15,15]},text=['<<','>>'])
    ## And the  list of characters if we know the level.

    if(is_set['level']):
        s = "<option value=" + str(0) + ">Trivial character</option>"
        D = DirichletGroup(info['level'])
        if(is_set['weight'] and is_even(info['weight'])):
            if(is_fundamental_discriminant(info['level'])):
                x = kronecker_character(info['level'])
                xi = D.list().index(x)
                s = s + "<option value=" + str(xi) + ">Kronecker character</option>"
        for x in D:
            if(is_set['weight'] and is_even(info['weight']) and x.is_odd()):
                continue
            if(is_set['weight'] and is_odd(info['weight']) and x.is_even()):
                continue
            xi = D.list().index(x)
#                       s=s+"<option value="+str(xi)+">\(\chi_{"+str(xi)+"}\)</option>"
            s = s + "<option value=" + str(xi) + ">" + str(xi) + "</option>"
        info['list_of_characters'] = s
    friends.append(('L-function', '/Lfunction/ModularForm/GL2/Q/holomorphic/'))
    lifts.append(('Half-Integral Weight Forms', '/ModularForm/Mp2/Q'))
    lifts.append(('Siegel Modular Forms', '/ModularForm/GSp4/Q'))
    return (info, lifts)
开发者ID:arbooker,项目名称:lmfdb,代码行数:31,代码来源:emf_main.py

示例3: dc_calc_gauss

def dc_calc_gauss(modulus, number):
    arg = request.args.get("val", [])
    if not arg:
        return flask.abort(404)
    try:
        from sage.modular.dirichlet import DirichletGroup

        chi = DirichletGroup(modulus)[number]
        gauss_sum_numerical = chi.gauss_sum_numerical(100, int(arg))
        return "\(%s\)" % (latex(gauss_sum_numerical))
    except Exception, e:
        return "<span style='color:red;'>ERROR: %s</span>" % e
开发者ID:swisherh,项目名称:swisherh-logo,代码行数:12,代码来源:DirichletCharacter.py

示例4: dc_calc_kloosterman

def dc_calc_kloosterman(modulus, number):
    arg = request.args.get("val", [])
    if not arg:
        return flask.abort(404)
    try:
        arg = map(int, arg.split(","))
        from sage.modular.dirichlet import DirichletGroup

        chi = DirichletGroup(modulus)[number]
        kloosterman_sum_numerical = chi.kloosterman_sum_numerical(100, arg[0], arg[1])
        return "\(%s\)" % (latex(kloosterman_sum_numerical))
    except Exception, e:
        return "<span style='color:red;'>ERROR: %s</span>" % e
开发者ID:swisherh,项目名称:swisherh-logo,代码行数:13,代码来源:DirichletCharacter.py

示例5: print_list_of_characters

def print_list_of_characters(level=1, weight=2):
    r"""
    Prints a list of characters compatible with the weight and level.
    """
    emf_logger.debug("print_list_of_chars")
    D = DirichletGroup(level)
    res = list()
    for j in range(len(D.list())):
        if D.list()[j].is_even() and is_even(weight):
            res.append(j)
        if D.list()[j].is_odd() and is_odd(weight):
            res.append(j)
    s = ""
    for j in res:
        s += "\(\chi_{" + str(j) + "}\)"
    return s
开发者ID:arbooker,项目名称:lmfdb,代码行数:16,代码来源:emf_main.py

示例6: dc_calc_jacobi

def dc_calc_jacobi(modulus, number):
    arg = request.args.get("val", [])
    if not arg:
        return flask.abort(404)
    try:
        arg = map(int, arg.split("."))
        mod = arg[0]
        num = arg[1]
        from sage.modular.dirichlet import DirichletGroup

        chi = DirichletGroup(modulus)[number]
        psi = DirichletGroup(mod)[num]
        jacobi_sum = chi.jacobi_sum(psi)
        return "\(%s\)" % (latex(jacobi_sum))
    except Exception, e:
        return "<span style='color:red;'>ERROR: %s</span>" % e
开发者ID:swisherh,项目名称:swisherh-logo,代码行数:16,代码来源:DirichletCharacter.py

示例7: render_elliptic_modular_form_space

def render_elliptic_modular_form_space(level=None, weight=None, character=None, label=None, **kwds):
    r"""
    Render the webpage for a elliptic modular forms space.
    """
    emf_logger.debug("In render_elliptic_modular_form_space kwds: {0}".format(kwds))
    emf_logger.debug("Input: level={0},weight={1},character={2},label={3}".format(level, weight, character, label))
    info = to_dict(kwds)
    info["level"] = level
    info["weight"] = weight
    info["character"] = character
    # if kwds.has_key('character') and kwds['character']=='*':
    #    return render_elliptic_modular_form_space_list_chars(level,weight)
    if character == 0:
        dimtbl = DimensionTable()
    else:
        dimtbl = DimensionTable(1)
    if not dimtbl.is_in_db(level, weight, character):
        emf_logger.debug("Data not available")
        if character == 0:
            d = dimension_new_cusp_forms(level, weight)
        else:
            D = DirichletGroup(level)
            x = D.galois_orbits(reps_only=True)[character]
            d = dimension_new_cusp_forms(x, weight)
        if d > 0:
            return render_template("not_available.html")
        else:
            info["is_empty"] = True
            return render_template("emf_space.html", **info)

    emf_logger.debug("Created dimension table in render_elliptic_modular_form_space")
    info = set_info_for_modular_form_space(**info)
    emf_logger.debug("keys={0}".format(info.keys()))
    if "download" in kwds and "error" not in kwds:
        return send_file(info["tempfile"], as_attachment=True, attachment_filename=info["filename"])
    if "dimension_newspace" in kwds and kwds["dimension_newspace"] == 1:
        # if there is only one orbit we list it
        emf_logger.debug("Dimension of newforms is one!")
        info["label"] = "a"
        return redirect(url_for("emf.render_elliptic_modular_forms", **info))
    info["title"] = "Newforms of weight %s on \(\Gamma_{0}(%s)\)" % (weight, level)
    bread = [(EMF_TOP, url_for("emf.render_elliptic_modular_forms"))]
    bread.append(("Level %s" % level, url_for("emf.render_elliptic_modular_forms", level=level)))
    bread.append(("Weight %s" % weight, url_for("emf.render_elliptic_modular_forms", level=level, weight=weight)))
    # emf_logger.debug("friends={0}".format(friends))
    info["bread"] = bread
    return render_template("emf_space.html", **info)
开发者ID:cgjj44,项目名称:lmfdb,代码行数:47,代码来源:emf_render_elliptic_modular_form_space.py

示例8: _Weyl_law_consts

    def _Weyl_law_consts(self):
        r"""
        Compute constants for the Weyl law on self._G

        OUTPUT:

        - tuple of real numbers

        EXAMPLES::


            sage: M=MaassWaveForms(MySubgroup(Gamma0(1)))
            sage: M._Weyl_law_consts()
            (0, 2/pi, (log(pi) - log(2) + 2)/pi, 0, -2)
        """
        import mpmath
        pi=mpmath.fp.pi
        ix=Integer(self._G.index())
        nc=Integer(len(self._G.cusps()))
        if(self._G.is_congruence()):
            lvl=Integer(self._G.level())
        else:
            lvl=0
        n2=Integer(self._G.nu2())
        n3=Integer(self._G.nu3())
        c1=ix/Integer(12)
        c2=Integer(2)*nc/pi
        c3=nc*(Integer(2)-ln(Integer(2))+ln(pi))/pi
        if(lvl<>0):
            A=1
            for q in divisors(lvl):
                num_prim_dc=0
                DG=DirichletGroup(q)
                for chi in DG.list():
                    if(chi.is_primitive()):
                        num_prim_dc=num_prim_dc+1
                for m in divisors(lvl):
                    if(lvl % (m*q) == 0   and m % q ==0 ): 
                        fak=(q*lvl)/gcd(m,lvl/m)
                        A=A*Integer(fak)**num_prim_dc        
            c4=-ln(A)/pi
        else:
            c4=Integer(0)
        # constant term
        c5=-ix/144+n2/8+n3*2/9-nc/4-1
        return (c1,c2,c3,c4,c5)
开发者ID:Alwnikrotikz,项目名称:purplesage,代码行数:46,代码来源:maass_forms.py

示例9: __init__

    def __init__(self, parent, k, chi=None):
        r"""
        Create a locally algebraic weight-character.

        EXAMPLES::

            sage: pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0)
            (13, 29, [2 + 2*29 + ... + O(29^20)])
        """
        WeightCharacter.__init__(self, parent)
        k = ZZ(k)
        self._k = k
        if chi is None: 
            chi = trivial_character(self._p, QQ)
        n = ZZ(chi.conductor())
        if n == 1: 
            n = self._p
        if not n.is_power_of(self._p):
            raise ValueError, "Character must have %s-power conductor" % p
        self._chi = DirichletGroup(n, chi.base_ring())(chi)
开发者ID:bgxcpku,项目名称:sagelib,代码行数:20,代码来源:weightspace.py

示例10: AlgebraicWeight

class AlgebraicWeight(WeightCharacter):
    r"""
    A point in weight space corresponding to a locally algebraic character, of
    the form `x \mapsto \chi(x) x^k` where `k` is an integer and `\chi` is a
    Dirichlet character modulo `p^n` for some `n`.

    TESTS::

        sage: w = pAdicWeightSpace(23)(12, DirichletGroup(23, QQ).0) # exact
        sage: w == loads(dumps(w))
        True
        sage: w = pAdicWeightSpace(23)(12, DirichletGroup(23, Qp(23)).0) # inexact
        sage: w == loads(dumps(w))
        True
        sage: w is loads(dumps(w)) # elements are not globally unique
        False
    """

    def __init__(self, parent, k, chi=None):
        r"""
        Create a locally algebraic weight-character.

        EXAMPLES::

            sage: pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0)
            (13, 29, [2 + 2*29 + ... + O(29^20)])
        """
        WeightCharacter.__init__(self, parent)
        k = ZZ(k)
        self._k = k
        if chi is None: 
            chi = trivial_character(self._p, QQ)
        n = ZZ(chi.conductor())
        if n == 1: 
            n = self._p
        if not n.is_power_of(self._p):
            raise ValueError, "Character must have %s-power conductor" % p
        self._chi = DirichletGroup(n, chi.base_ring())(chi)

    def __call__(self, x):
        r"""
        Evaluate this character at an element of `\ZZ_p^\times`.

        EXAMPLES:

        Exact answers are returned when this is possible::

            sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, QQ).0)
            sage: kappa(1)
            1
            sage: kappa(0)
            0
            sage: kappa(12)
            -106993205379072
            sage: kappa(-1)
            -1
            sage: kappa(13 + 4*29 + 11*29^2 + O(29^3))
            9 + 21*29 + 27*29^2 + O(29^3)

        When the character chi is defined over a p-adic field, the results returned are inexact::

            sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0^14)
            sage: kappa(1)
            1 + O(29^20)
            sage: kappa(0)
            0
            sage: kappa(12)
            17 + 11*29 + 7*29^2 + 4*29^3 + 5*29^4 + 2*29^5 + 13*29^6 + 3*29^7 + 18*29^8 + 21*29^9 + 28*29^10 + 28*29^11 + 28*29^12 + 28*29^13 + 28*29^14 + 28*29^15 + 28*29^16 + 28*29^17 + 28*29^18 + 28*29^19 + O(29^20)
            sage: kappa(12) == -106993205379072
            True
            sage: kappa(-1) == -1
            True
            sage: kappa(13 + 4*29 + 11*29^2 + O(29^3))
            9 + 21*29 + 27*29^2 + O(29^3)
        """
        if isinstance(x, pAdicGenericElement):
            if x.parent().prime() != self._p:
                raise TypeError, "x must be an integer or a %s-adic integer" % self._p
            if self._p**(x.precision_absolute()) < self._chi.conductor():
                raise Exception, "Precision too low"
            xint = x.lift()
        else:
            xint = x
        if (xint % self._p == 0): return 0
        return self._chi(xint) * x**self._k 

    def k(self):
        r"""
        If this character is `x \mapsto x^k \chi(x)` for an integer `k` and a
        Dirichlet character `\chi`, return `k`.

        EXAMPLE::
        
            sage: kappa = pAdicWeightSpace(29)(13, DirichletGroup(29, Qp(29)).0^14)
            sage: kappa.k()
            13
        """
        return self._k

    def chi(self):
#.........这里部分代码省略.........
开发者ID:bgxcpku,项目名称:sagelib,代码行数:101,代码来源:weightspace.py

示例11: set_table

def set_table(info, is_set, make_link=True):  # level_min,level_max,weight=2,chi=0,make_link=True):
    r"""
    make a bunch of html tables with information about spaces of modular forms
    with parameters in the given ranges.
    Should use database in the future...
    """
    D = 0
    rowlen = 10  # split into rows of this length...
    rowlen0 = rowlen
    rowlen1 = rowlen
    characters = dict()
    if('level_min' in info):
        level_min = int(info['level_min'])
    else:
        level_min = 1
    if('level_max' in info):
        level_max = int(info['level_max'])
    else:
        level_max = 50
    if (level_max - level_min + 1) < rowlen:
        rowlen0 = level_max - level_min + 1
    if(info['list_chars'] != '0'):
        char1 = 1
    else:
        char1 = 0
    if(is_set['weight']):
        weight = int(info['weight'])
    else:
        weight = 2
    ## setup the table
    # print "char11=",char1
    tbl = dict()
    if(char1 == 1):
        tbl['header'] = 'Dimension of \( S_{' + str(weight) + '}(N,\chi_{n})\)'
    else:
        tbl['header'] = 'Dimension of \( S_{' + str(weight) + '}(N)\)'
    tbl['headersv'] = list()
    tbl['headersh'] = list()
    tbl['corner_label'] = ""
    tbl['data'] = list()
    tbl['data_format'] = 'html'
    tbl['class'] = "dimension_table"
    tbl['atts'] = "border=\"0\" class=\"data_table\""
    num_rows = ceil(QQ(level_max - level_min + 1) / QQ(rowlen0))
    print "num_rows=", num_rows
    for i in range(1, rowlen0 + 1):
        tbl['headersh'].append(i + level_min - 1)

    for r in range(num_rows):
        tbl['headersv'].append(r * rowlen0)
    print "level_min=", level_min
    print "level_max=", level_max
    print "char=", char1
    for r in range(num_rows):
        row = list()
        for k in range(1, rowlen0 + 1):
            row.append("")
        # print "row nr. ",r
        for k in range(1, rowlen0 + 1):
            N = level_min - 1 + r * rowlen0 + k
            s = "<a name=\"#" + str(N) + "\"></a>"
            # print "col ",k,"=",N
            if(N > level_max or N < 1):
                continue
            if(char1 == 0):
                d = dimension_cusp_forms(N, weight)
                print "d=", d
                if(make_link):
                    url = "?weight=" + str(weight) + "&level=" + str(N) + "&character=0"
                    row.append(s + "<a target=\"mainWindow\" href=\"" + url + "\">" + str(d) + "</a>")
                else:
                    row.append(s + str(d))

                # print "dim(",N,weight,")=",d
            else:

                D = DirichletGroup(N)
                print "D=", D
                s = "<a name=\"#" + str(N) + "\"></a>"
                small_tbl = dict()
                # small_tbl['header']='Dimension of \( S_{'+str(weight)+'}(N)\)'
                small_tbl['headersv'] = ['\( d \)']
                small_tbl['headersh'] = list()
                small_tbl['corner_label'] = "\( n \)"
                small_tbl['data'] = list()
                small_tbl['atts'] = "border=\"1\" padding=\"1\""
                small_tbl['data_format'] = 'html'
                row1 = list()
                # num_small_rows = ceil(QQ(level_max) / QQ(rowlen))
                ii = 0
                for chi in range(0, len(D.list())):
                    x = D[chi]
                    S = CuspForms(x, weight)
                    d = S.dimension()
                    if(d == 0):
                        continue
                    small_tbl['headersh'].append(chi)
                    if(make_link):
                        url = "?weight=" + str(weight) + "&level=" + str(N) + "&character=" + str(chi)
                        row1.append("<a target=\"mainWindow\" href=\"" + url + "\">" + str(d) + "</a>")
#.........这里部分代码省略.........
开发者ID:arbooker,项目名称:lmfdb,代码行数:101,代码来源:emf_main.py

示例12: dimension_new_cusp_forms

    def dimension_new_cusp_forms(self, k=2, eps=None, p=0, algorithm="CohenOesterle"):
        r"""
        Dimension of the new subspace (or `p`-new subspace) of cusp forms of
        weight `k` and character `\varepsilon`.

        INPUT:

        - ``k`` - an integer (default: 2)

        - ``eps`` - a Dirichlet character

        -  ``p`` - a prime (default: 0); just the `p`-new subspace if given

        - ``algorithm`` - either "CohenOesterle" (the default) or "Quer". This
          specifies the method to use in the case of nontrivial character:
          either the Cohen--Oesterle formula as described in Stein's book, or
          by Moebius inversion using the subgroups GammaH (a method due to
          Jordi Quer).

        EXAMPLES::

            sage: G = DirichletGroup(9)
            sage: eps = G.0^3
            sage: eps.conductor()
            3
            sage: [Gamma1(9).dimension_new_cusp_forms(k, eps) for k in [2..10]]
            [0, 0, 0, 2, 0, 2, 0, 2, 0]
            sage: [Gamma1(9).dimension_cusp_forms(k, eps) for k in [2..10]]
            [0, 0, 0, 2, 0, 4, 0, 6, 0]
            sage: [Gamma1(9).dimension_new_cusp_forms(k, eps, 3) for k in [2..10]]
            [0, 0, 0, 2, 0, 2, 0, 2, 0]

        Double check using modular symbols (independent calculation)::

            sage: [ModularSymbols(eps,k,sign=1).cuspidal_subspace().new_subspace().dimension()  for k in [2..10]]
            [0, 0, 0, 2, 0, 2, 0, 2, 0]
            sage: [ModularSymbols(eps,k,sign=1).cuspidal_subspace().new_subspace(3).dimension()  for k in [2..10]]
            [0, 0, 0, 2, 0, 2, 0, 2, 0]

        Another example at level 33::

            sage: G = DirichletGroup(33)
            sage: eps = G.1
            sage: eps.conductor()
            11
            sage: [Gamma1(33).dimension_new_cusp_forms(k, G.1) for k in [2..4]]
            [0, 4, 0]
            sage: [Gamma1(33).dimension_new_cusp_forms(k, G.1, algorithm="Quer") for k in [2..4]]
            [0, 4, 0]
            sage: [Gamma1(33).dimension_new_cusp_forms(k, G.1^2) for k in [2..4]]
            [2, 0, 6]
            sage: [Gamma1(33).dimension_new_cusp_forms(k, G.1^2, p=3) for k in [2..4]]
            [2, 0, 6]

        """

        if eps == None:
            return GammaH_class.dimension_new_cusp_forms(self, k, p)

        N = self.level()
        eps = DirichletGroup(N)(eps)

        from all import Gamma0

        if eps.is_trivial():
            return Gamma0(N).dimension_new_cusp_forms(k, p)

        from congroup_gammaH import mumu

        if p == 0 or N%p != 0 or eps.conductor().valuation(p) == N.valuation(p):
            D = [eps.conductor()*d for d in divisors(N//eps.conductor())]
            return sum([Gamma1_constructor(M).dimension_cusp_forms(k, eps.restrict(M), algorithm)*mumu(N//M) for M in D])
        eps_p = eps.restrict(N//p)
        old = Gamma1_constructor(N//p).dimension_cusp_forms(k, eps_p, algorithm)
        return self.dimension_cusp_forms(k, eps, algorithm) - 2*old
开发者ID:biasse,项目名称:sage,代码行数:75,代码来源:congroup_gamma1.py

示例13: dimension_eis

    def dimension_eis(self, k=2, eps=None, algorithm="CohenOesterle"):
        r"""
        Return the dimension of the space of Eisenstein series forms for self,
        or the dimension of the subspace corresponding to the given character
        if one is supplied.

        INPUT:

        - ``k`` - an integer (default: 2), the weight.

        - ``eps`` - either None or a Dirichlet character modulo N, where N is
          the level of this group. If this is None, then the dimension of the
          whole space is returned; otherwise, the dimension of the subspace of
          Eisenstein series of character eps.

        - ``algorithm`` -- either "CohenOesterle" (the default) or "Quer". This
          specifies the method to use in the case of nontrivial character:
          either the Cohen--Oesterle formula as described in Stein's book, or
          by Moebius inversion using the subgroups GammaH (a method due to
          Jordi Quer).

        AUTHORS:

        - William Stein - Cohen--Oesterle algorithm

        - Jordi Quer - algorithm based on GammaH subgroups

        - David Loeffler (2009) - code refactoring

        EXAMPLES:

        The following two computations use different algorithms: ::

            sage: [Gamma1(36).dimension_eis(1,eps) for eps in DirichletGroup(36)]
            [0, 4, 3, 0, 0, 2, 6, 0, 0, 2, 3, 0]
            sage: [Gamma1(36).dimension_eis(1,eps,algorithm="Quer") for eps in DirichletGroup(36)]
            [0, 4, 3, 0, 0, 2, 6, 0, 0, 2, 3, 0]

        So do these: ::

            sage: [Gamma1(48).dimension_eis(3,eps) for eps in DirichletGroup(48)]
            [0, 12, 0, 4, 0, 8, 0, 4, 12, 0, 4, 0, 8, 0, 4, 0]
            sage: [Gamma1(48).dimension_eis(3,eps,algorithm="Quer") for eps in DirichletGroup(48)]
            [0, 12, 0, 4, 0, 8, 0, 4, 12, 0, 4, 0, 8, 0, 4, 0]
        """
        from all import Gamma0

        # first deal with special cases

        if eps is None:
            return GammaH_class.dimension_eis(self, k)

        N = self.level()
        eps = DirichletGroup(N)(eps)

        if eps.is_trivial():
            return Gamma0(N).dimension_eis(k)

        # Note case of k = 0 and trivial character already dealt with separately, so k <= 0 here is valid:
        if (k <= 0) or ((k % 2) == 1 and eps.is_even()) or ((k%2) == 0 and eps.is_odd()):
            return ZZ(0)

        if algorithm == "Quer":
            n = eps.order()
            dim = ZZ(0)
            for d in n.divisors():
                G = GammaH_constructor(N,(eps**d).kernel())
                dim = dim + moebius(d)*G.dimension_eis(k)
            return dim//phi(n)

        elif algorithm == "CohenOesterle":
            from sage.modular.dims import CohenOesterle
            K = eps.base_ring()
            j = 2-k
            # We use the Cohen-Oesterle formula in a subtle way to
            # compute dim M_k(N,eps) (see Ch. 6 of William Stein's book on
            # computing with modular forms).
            alpha = -ZZ( K(Gamma0(N).index()*(j-1)/ZZ(12)) + CohenOesterle(eps,j) )
            if k == 1:
                return alpha
            else:
                return alpha - self.dimension_cusp_forms(k, eps)

        else: #algorithm not in ["CohenOesterle", "Quer"]:
            raise ValueError, "Unrecognised algorithm in dimension_eis"
开发者ID:biasse,项目名称:sage,代码行数:85,代码来源:congroup_gamma1.py

示例14: dimension_cusp_forms

    def dimension_cusp_forms(self, k=2, eps=None, algorithm="CohenOesterle"):
        r"""
        Return the dimension of the space of cusp forms for self, or the
        dimension of the subspace corresponding to the given character if one
        is supplied.

        INPUT:

        - ``k`` - an integer (default: 2), the weight.

        - ``eps`` - either None or a Dirichlet character modulo N, where N is
          the level of this group. If this is None, then the dimension of the
          whole space is returned; otherwise, the dimension of the subspace of
          forms of character eps.

        - ``algorithm`` -- either "CohenOesterle" (the default) or "Quer". This
          specifies the method to use in the case of nontrivial character:
          either the Cohen--Oesterle formula as described in Stein's book, or
          by Moebius inversion using the subgroups GammaH (a method due to
          Jordi Quer).

        EXAMPLES:

        We compute the same dimension in two different ways ::

            sage: K = CyclotomicField(3)
            sage: eps = DirichletGroup(7*43,K).0^2
            sage: G = Gamma1(7*43)

        Via Cohen--Oesterle: ::

            sage: Gamma1(7*43).dimension_cusp_forms(2, eps)
            28

        Via Quer's method: ::

            sage: Gamma1(7*43).dimension_cusp_forms(2, eps, algorithm="Quer")
            28

        Some more examples: ::

            sage: G.<eps> = DirichletGroup(9)
            sage: [Gamma1(9).dimension_cusp_forms(k, eps) for k in [1..10]]
            [0, 0, 1, 0, 3, 0, 5, 0, 7, 0]
            sage: [Gamma1(9).dimension_cusp_forms(k, eps^2) for k in [1..10]]
            [0, 0, 0, 2, 0, 4, 0, 6, 0, 8]
        """

        from all import Gamma0

        # first deal with special cases

        if eps is None:
            return GammaH_class.dimension_cusp_forms(self, k)

        N = self.level()
        if eps.base_ring().characteristic() != 0:
            raise ValueError

        eps = DirichletGroup(N, eps.base_ring())(eps)

        if eps.is_trivial():
            return Gamma0(N).dimension_cusp_forms(k)

        if (k <= 0) or ((k % 2) == 1 and eps.is_even()) or ((k%2) == 0 and eps.is_odd()):
            return ZZ(0)

        if k == 1:
            try:
                n = self.dimension_cusp_forms(1)
                if n == 0:
                    return ZZ(0)
                else: # never happens at present
                    raise NotImplementedError, "Computations of dimensions of spaces of weight 1 cusp forms not implemented at present"
            except NotImplementedError:
                raise

        # now the main part

        if algorithm == "Quer":
            n = eps.order()
            dim = ZZ(0)
            for d in n.divisors():
                G = GammaH_constructor(N,(eps**d).kernel())
                dim = dim + moebius(d)*G.dimension_cusp_forms(k)
            return dim//phi(n)

        elif algorithm == "CohenOesterle":
            K = eps.base_ring()
            from sage.modular.dims import CohenOesterle
            from all import Gamma0
            return ZZ( K(Gamma0(N).index() * (k-1)/ZZ(12)) + CohenOesterle(eps,k) )

        else: #algorithm not in ["CohenOesterle", "Quer"]:
            raise ValueError, "Unrecognised algorithm in dimension_cusp_forms"
开发者ID:biasse,项目名称:sage,代码行数:95,代码来源:congroup_gamma1.py

示例15: dimension_of_ordinary_subspace

 def dimension_of_ordinary_subspace(self, p=None, cusp=False):
     """
     If ``cusp`` is ``True``, return dimension of cuspidal ordinary
     subspace. This does a weight 2 computation with sage's ModularSymbols.
     
     EXAMPLES::
     
         sage: M = OverconvergentModularSymbols(11, 0, sign=-1, p=3, prec_cap=4, base=ZpCA(3, 8))
         sage: M.dimension_of_ordinary_subspace()
         2
         sage: M.dimension_of_ordinary_subspace(cusp=True)
         2
         sage: M = OverconvergentModularSymbols(11, 0, sign=1, p=3, prec_cap=4, base=ZpCA(3, 8))
         sage: M.dimension_of_ordinary_subspace(cusp=True)
         2
         sage: M.dimension_of_ordinary_subspace()
         4
         sage: M = OverconvergentModularSymbols(11, 0, sign=0, p=3, prec_cap=4, base=ZpCA(3, 8))
         sage: M.dimension_of_ordinary_subspace()
         6
         sage: M.dimension_of_ordinary_subspace(cusp=True)
         4
         sage: M = OverconvergentModularSymbols(11, 0, sign=1, p=11, prec_cap=4, base=ZpCA(11, 8))
         sage: M.dimension_of_ordinary_subspace(cusp=True)
         1
         sage: M.dimension_of_ordinary_subspace()
         2
         sage: M = OverconvergentModularSymbols(11, 2, sign=1, p=11, prec_cap=4, base=ZpCA(11, 8))
         sage: M.dimension_of_ordinary_subspace(cusp=True)
         0
         sage: M.dimension_of_ordinary_subspace()
         1
         sage: M = OverconvergentModularSymbols(11, 10, sign=1, p=11, prec_cap=4, base=ZpCA(11, 8))
         sage: M.dimension_of_ordinary_subspace(cusp=True)
         1
         sage: M.dimension_of_ordinary_subspace()
         2
     
     An example with odd weight and hence non-trivial character::
     
         sage: K = Qp(11, 6)
         sage: DG = DirichletGroup(11, K)
         sage: chi = DG([K(378703)])
         sage: MM = FamiliesOfOMS(chi, 1, p=11, prec_cap=[4, 4], base_coeffs=ZpCA(11, 4), sign=-1)
         sage: MM.dimension_of_ordinary_subspace()
         1
     """
     try:
         p = self.prime()
     except AttributeError:
         if p is None:
             raise ValueError("If self doesn't have a prime, must specify p.")
     try:
         return self._ord_dim_dict[(p, cusp)]
     except AttributeError:
         self._ord_dim_dict = {}
     except KeyError:
         pass
     from sage.modular.dirichlet import DirichletGroup
     from sage.rings.finite_rings.constructor import GF
     try:
         chi = self.character()
     except AttributeError:
         chi = DirichletGroup(self.level(), GF(p))[0]
     if chi is None:
         chi = DirichletGroup(self.level(), GF(p))[0]
     
     from sage.modular.modsym.modsym import ModularSymbols
     r = self.weight() % (p-1)
     if chi.is_trivial():
         N = chi.modulus()
         if N % p != 0:
             N *= p
         else:
             e = N.valuation(p)
             N.divide_knowing_divisible_by(p ** (e-1))
         chi = DirichletGroup(N, GF(p))[0]
     elif chi.modulus() % p != 0:
         chi = DirichletGroup(chi.modulus() * p, GF(p))(chi)
     DG = DirichletGroup(chi.modulus(), GF(p))
     if r == 0:
         from sage.modular.arithgroup.congroup_gamma0 import Gamma0_constructor as Gamma0
         verbose("in dim: %s, %s, %s"%(self.sign(), chi, p))
         M = ModularSymbols(DG(chi), 2, self.sign(), GF(p))
     else:
         psi = [GF(p)(u) ** r for u in DG.unit_gens()]    #mod p Teichmuller^r
         psi = DG(psi)
         M = ModularSymbols(DG(chi) * psi, 2, self.sign(), GF(p))
     if cusp:
         M = M.cuspidal_subspace()
     hecke_poly = M.hecke_polynomial(p)
     verbose("in dim: %s"%(hecke_poly))
     x = hecke_poly.parent().gen()
     d = hecke_poly.degree() - hecke_poly.ord(x)
     self._ord_dim_dict[(p, cusp)] = d
     return d
开发者ID:lalitkumarj,项目名称:OMSCategory,代码行数:96,代码来源:modsym_space.py


注:本文中的sage.modular.dirichlet.DirichletGroup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。