コード例 #1
0
def print_list_of_coefficients(info):
    r"""
    Print a table of Fourier coefficients in the requested format
    """
    level = my_get(info, 'level', -1, int)
    weight = my_get(info, 'weight', -1, int)
    prec = my_get(info, 'prec', 12, int)  # number of digits
    bitprec = my_get(info, 'bitprec', 12, int)  # number of digits
    character = my_get(info, 'character', '', str)  # int(info.get('weight',0))
    if character == '':
        character = 0
    label = info.get('label', '')
    print "--------------"
    if label == '' or level == -1 or weight == -1:
        return "Need to specify a modular form completely!!"

    WMFS = WebModFormSpace(N=level, k=weight, chi=character)
    if not WMFS:
        return ""
    if ('number' in info):
        number = int(info['number'])
    else:
        number = max(WMFS.sturm_bound() + 1, 20)
    FS = list()
    if (label is not None):
        FS.append(WMFS.f(label))
    else:
        for a in WMFS.labels():
            FS.append(WMFS.f(a))
    shead = "Cusp forms of weight " + str(weight) + "on \(" + latex(
        WMFS.group()) + "\)"
    s = ""
    if ((character is not None) and (character > 0)):
        s = s + " and character \( \chi_{" + str(character) + "}\)"
        # s="<table><tr><td>"
    coefs = ""
    for F in FS:
        if len(FS) > 1:
            if info['format'] == 'html':
                coefs += F.label()
            else:
                coefs += F.label()
        coefs += print_coefficients_for_one_form(F,
                                                 number,
                                                 info['format'],
                                                 bitprec=bitprec)
    ss = coefs
    return ss
def set_info_for_modular_form_space(level=None,
                                    weight=None,
                                    character=None,
                                    label=None,
                                    **kwds):
    r"""
    Set information about a space of modular forms.
    """
    info = dict()
    info['level'] = level
    info['weight'] = weight
    info['character'] = character
    emf_logger.debug("info={0}".format(info))
    if (level > N_max_db or weight > k_max_db):
        info['error'] = "Currently not available"
    WMFS = None
    if level <= 0:
        info['error'] = "Got wrong level: %s " % level
        return info
    try:
        if use_db:
            WMFS = WebModFormSpace(weight, level, character, use_db=True)
        else:
            WMFS = WebModFormSpace(weight, level, character)
        if 'download' in info and 'tempfile' in info:
            WNF._save_to_file(info['tempfile'])
            info['filename'] = str(weight) + '-' + str(level) + '-' + str(
                character) + '-' + label + '.sobj'
            return info
    except RuntimeError:
        info['error'] = "Sage error: Could not construct the desired space!"
    if WMFS.level() == 1:
        info['group'] = "\( \mathrm{SL}_{2}(\mathbb{Z})\)"
    else:
        info['group'] = "\( \Gamma_{{0}}( {0} ) \)".format(WMFS.level())
    if character == 0:
        info['name_new'] = "\(S_{ %s }^{new}(%s) \)" % (WMFS.weight(),
                                                        WMFS.level())
        info['name_old'] = "\(S_{ %s }^{old}(%s) \)" % (WMFS.weight(),
                                                        WMFS.level())
    else:
        conrey_char = WMFS.conrey_character()
        conrey_char_name = WMFS.conrey_character_name()
        info['conrey_character_name'] = '\( ' + conrey_char_name + '\)'
        info['character_url'] = url_character(type='Dirichlet',
                                              modulus=WMFS.level(),
                                              number=conrey_char.number())
        info['name_new'] = "\(S_{ %s }^{new}(%s,%s) \)" % (
            WMFS.weight(), WMFS.level(), conrey_char_name)
        info['name_old'] = "\(S_{ %s }^{old}(%s,%s) \)" % (
            WMFS.weight(), WMFS.level(), conrey_char_name)
    info['dimension_cusp_forms'] = WMFS.dimension_cusp_forms()
    info['dimension_mod_forms'] = WMFS.dimension_modular_forms()
    info['dimension_new_cusp_forms'] = WMFS.dimension_new_cusp_forms()
    info['dimension_newspace'] = WMFS.dimension_newspace()
    info['dimension_oldspace'] = WMFS.dimension_oldspace()
    info['dimension'] = WMFS.dimension()
    info['galois_orbits'] = WMFS.get_all_galois_orbit_info()
    lifts = list()
    if WMFS.dimension() == 0:  # we don't need to work with an empty space
        info['sturm_bound'] = 0
        info['new_decomposition'] = ''
        info['is_empty'] = 1
        lifts.append(('Half-Integral Weight Forms', '/ModularForm/Mp2/Q'))
        lifts.append(('Siegel Modular Forms', '/ModularForm/GSp4/Q'))
        info['lifts'] = lifts
        return info
    info['sturm_bound'] = WMFS.sturm_bound()
    info['new_decomposition'] = WMFS.print_galois_orbits()
    emf_logger.debug("new_decomp={0}".format(info['new_decomposition']))
    info['nontrivial_new'] = len(info['new_decomposition'])
    ## we try to catch well-known bugs...
    info['old_decomposition'] = "n/a"
    if level < N_max_comp:
        try:
            O = WMFS.print_oldspace_decomposition()
            info['old_decomposition'] = O
        except:
            emf_logger.critical("Error in computing oldspace decomposition")
            O = []
            info['old_decomposition'] = "n/a"
            (A, B, C) = sys.exc_info()
            # build an error message...
            errtype = A.__name__
            errmsg = B
            s = "%s: %s  at:" % (errtype, errmsg)
            next = C.tb_next
            while (next):
                ln = next.tb_lineno
                filen = next.tb_frame.f_code.co_filename
                s += "\n line no. %s in file %s" % (ln, filen)
                next = next.tb_next
                info['error_note'] = "Could not construct oldspace!\n" + s
    # properties for the sidebar
    prop = []
    if WMFS._cuspidal == 1:
        prop = [('Dimension newforms', [info['dimension_newspace']])]
        prop.append(('Dimension oldforms', [info['dimension_oldspace']]))
    else:
        prop = [('Dimension modular forms', [info['dimension_mod_forms']])]
        prop.append(('Dimension cusp forms', [info['dimension_cusp_forms']]))
    prop.append(('Sturm bound', [WMFS.sturm_bound()]))
    info['properties2'] = prop
    ## Make parent spaces of S_k(N,chi) for the sidebar
    par_lbl = '\( S_{*} (\Gamma_0(' + str(level) + '),\cdot )\)'
    par_url = '?level=' + str(level)
    parents = [[par_lbl, par_url]]
    par_lbl = '\( S_{k} (\Gamma_0(' + str(level) + '),\cdot )\)'
    par_url = '?level=' + str(level) + '&weight=' + str(weight)
    parents.append((par_lbl, par_url))
    info['parents'] = parents
    if 'character' in info:
        info['character_order'] = WMFS.character_order()
        info['character_conductor'] = WMFS.character_conductor()
    friends = list()
    lifts = list()
    if (('label' not in info) and info['old_decomposition'] != 'n/a'):
        O = WMFS.oldspace_decomposition()
        try:
            for (old_level, chi, mult, d) in O:
                if chi != 0:
                    s = "\(S_{%s}(\Gamma_0(%s),\chi_{%s}) \) " % (
                        weight, old_level, chi)
                    friends.append((s, '?weight=' + str(weight) + '&level=' +
                                    str(old_level) + '&character=' + str(chi)))
                else:
                    s = "\(S_{%s}(\Gamma_0(%s)) \) " % (weight, old_level)
                    friends.append((s, '?weight=' + str(weight) + '&level=' +
                                    str(old_level) + '&character=' + str(0)))
        except:
            pass
    info['friends'] = friends
    lifts.append(('Half-Integral Weight Forms', '/ModularForm/Mp2/Q'))
    lifts.append(('Siegel Modular Forms', '/ModularForm/GSp4/Q'))
    info['lifts'] = lifts
    return info