Example #1
0
def render_bmf_webpage(field_label, level_label, label_suffix):
    label = "-".join([field_label, level_label, label_suffix])
    credit = "John Cremona"
    info = {}
    title = "Bianchi cusp forms"
    data = None
    properties = []
    friends = []
    bread = get_bread()

    try:
        numeigs = request.args['numeigs']
        numeigs = int(numeigs)
    except:
        numeigs = 20
    info['numeigs'] = numeigs

    try:
        data = WebBMF.by_label(label, max_eigs=numeigs)
        title = "Bianchi cusp form {} over {}".format(
            data.short_label, field_pretty(data.field_label))
        bread = get_bread([(field_pretty(data.field_label),
                            url_for(".render_bmf_field_dim_table_gl2",
                                    field_label=data.field_label)),
                           (data.level_label,
                            url_for('.render_bmf_space_webpage',
                                    field_label=data.field_label,
                                    level_label=data.level_label)),
                           (data.short_label, '')])
        properties = data.properties
        friends = data.friends
        info['downloads'] = [('Modular form to Magma',
                              url_for(".render_bmf_webpage_download",
                                      field_label=field_label,
                                      label_suffix=label_suffix,
                                      level_label=level_label,
                                      download_type='magma')),
                             ('Eigenvalues to Sage',
                              url_for(".render_bmf_webpage_download",
                                      field_label=field_label,
                                      label_suffix=label_suffix,
                                      level_label=level_label,
                                      download_type='sage'))]
    except ValueError:
        flash_error("No Bianchi modular form in the database has label %s",
                    label)
        return redirect(url_for(".index"))
    return render_template(
        "bmf-newform.html",
        downloads=info["downloads"],
        title=title,
        credit=credit,
        bread=bread,
        data=data,
        properties=properties,
        friends=friends,
        info=info,
        learnmore=learnmore_list(),
        KNOWL_ID="mf.bianchi.%s" % label,
    )
Example #2
0
def render_bmf_webpage(field_label, level_label, label_suffix):
    label = "-".join([field_label, level_label, label_suffix])
    credit = "John Cremona"
    bread = []
    info = {}
    title = "Bianchi cusp forms"
    data = None
    properties = []
    friends = []
    bread = [('Modular forms', url_for('modular_forms')),
             ('Bianchi', url_for(".index"))]
    try:
        data = WebBMF.by_label(label)
        title = "Bianchi cusp form {} over {}".format(
            data.short_label, field_pretty(data.field_label))
        bread = [('Modular forms', url_for('modular_forms')),
                 ('Bianchi', url_for(".index")),
                 (field_pretty(data.field_label),
                  url_for(".render_bmf_field_dim_table_gl2",
                          field_label=data.field_label)),
                 (data.level_label,
                  url_for('.render_bmf_space_webpage',
                          field_label=data.field_label,
                          level_label=data.level_label)),
                 (data.short_label, '')]
        properties = data.properties
        friends = data.friends
    except ValueError:
        raise
        info[
            'err'] = "No Bianchi modular form in the database has label {}".format(
                label)
    return render_template("bmf-newform.html",
                           title=title,
                           credit=credit,
                           bread=bread,
                           data=data,
                           properties=properties,
                           friends=friends,
                           info=info,
                           learnmore=learnmore_list())
Example #3
0
def render_bmf_webpage(field_label, level_label, label_suffix):
    label = "-".join([field_label, level_label, label_suffix])
    credit = "John Cremona"
    bread = []
    info = {}
    title = "Bianchi cusp forms"
    data = None
    properties2 = []
    friends = []
    bread = [('Bianchi modular forms', url_for(".index"))]
    try:
        data = WebBMF.by_label(label)
        title = "Bianchi cusp form {} over {}".format(data.short_label,field_pretty(data.field_label))
        bread = [('Bianchi modular forms', url_for(".index")),
                 (field_pretty(data.field_label), url_for(".render_bmf_field_dim_table_gl2", field_label=data.field_label)),
                 (data.level_label, url_for('.render_bmf_space_webpage', field_label=data.field_label, level_label=data.level_label)),
                 (data.short_label, '')]
        properties2 = data.properties2
        friends = data.friends
    except ValueError:
        info['err'] = "No Bianchi modular form in the database has label {}".format(label)
    return render_template("bmf-newform.html", title=title, credit=credit, bread=bread, data=data, properties2=properties2, friends=friends, info=info)
Example #4
0
def download_bmf_sage(**args):
    """Generates the sage code for the user to obtain the BMF eigenvalues.
    As in the HMF case, and unlike the website, we export *all* eigenvalues in
    the database, not just 50, and not just those away from the level."""

    label = "-".join([args['field_label'], args['level_label'], args['label_suffix']])

    try:
        f = WebBMF.by_label(label)
    except ValueError:
        return "Bianchi newform not found"

    hecke_pol  = f.hecke_poly_obj
    hecke_eigs = f.hecke_eigs

    F = WebNumberField(f.field_label)
    K = f.field.K()

    primes_in_K = [p for p,_ in zip(primes_iter(K),hecke_eigs)]
    prime_gens = [p.gens_reduced() for p in primes_in_K]

    outstr = '"""\n  This code can be loaded, or copied and paste using cpaste, into Sage.\n'
    outstr += '  It will load the data associated to the BMF, including\n'
    outstr += '  the field, level, and Hecke and Atkin-Lehner eigenvalue data (if known).\n'
    outstr += '"""\n\n'

    outstr += 'P = PolynomialRing(QQ, "x")\nx = P.gen()\n'
    outstr += 'g = P(' + str(F.coeffs()) + ')\n'
    outstr += 'F = NumberField(g, "{}")\n'.format(K.gen())
    outstr += '{} = F.gen()\n'.format(K.gen())
    outstr += 'ZF = F.ring_of_integers()\n\n'

    outstr += 'NN = ZF.ideal({})\n\n'.format(f.level.gens())

    outstr += 'primes_array = [\n' + ','.join([str(st).replace(' ', '') for st in prime_gens]).replace('],[',
                                                                                       '],\\\n[') + ']\n'
    outstr += 'primes = [ZF.ideal(I) for I in primes_array]\n\n'

    Qx = PolynomialRing(QQ,'x')

    if hecke_pol != 'x':
        outstr += 'heckePol = P({})\n'.format(str((Qx(hecke_pol)).list()))
        outstr += 'K = NumberField(heckePol, "z")\nz = K.gen()\n'
    else:
        outstr += 'heckePol = x\nK = QQ\ne = 1\n'

    hecke_eigs_processed = [str(st).replace(' ', '') if st != 'not known' else '"not known"' for st in hecke_eigs]
    outstr += '\nhecke_eigenvalues_array = [' + ', '.join(hecke_eigs_processed) + ']'
    outstr += '\nhecke_eigenvalues = {}\n'
    outstr += 'for i in range(len(hecke_eigenvalues_array)):\n    hecke_eigenvalues[primes[i]] = hecke_eigenvalues_array[i]\n\n'

    if f.have_AL:
        AL_eigs    = f.AL_table_data
        outstr += 'AL_eigenvalues = {}\n'
        for s in AL_eigs:
            outstr += 'AL_eigenvalues[ZF.ideal(%s)] = %s\n' % (s[0],s[1])
    else:
        outstr += 'AL_eigenvalues ="not known"\n'

    outstr += '\n# EXAMPLE:\n# pp = ZF.ideal(2).factor()[0][0]\n# hecke_eigenvalues[pp]\n'

    return outstr
Example #5
0
def download_bmf_magma(**args):
    label = "-".join([args['field_label'], args['level_label'], args['label_suffix']])

    try:
        f = WebBMF.by_label(label)
    except ValueError:
        return "Bianchi newform not found"

    hecke_pol  = f.hecke_poly_obj
    hecke_eigs = f.hecke_eigs

    F = WebNumberField(f.field_label)
    K = f.field.K()

    primes_in_K = [p for p,_ in zip(primes_iter(K),hecke_eigs)]
    prime_gens = [list(p.gens()) for p in primes_in_K]

    outstr = '/*\n  This code can be loaded, or copied and pasted, into Magma.\n'
    outstr += '  It will load the data associated to the BMF, including\n'
    outstr += '  the field, level, and Hecke and Atkin-Lehner eigenvalue data.\n'
    outstr += '  At the *bottom* of the file, there is code to recreate the\n'
    outstr += '  Bianchi modular form in Magma, by creating the BMF space\n'
    outstr += '  and cutting out the corresponding Hecke irreducible subspace.\n'
    outstr += '  From there, you can ask for more eigenvalues or modify as desired.\n'
    outstr += '  It is commented out, as this computation may be lengthy.\n'
    outstr += '*/\n\n'

    outstr += 'P<x> := PolynomialRing(Rationals());\n'
    outstr += 'g := P!' + str(F.coeffs()) + ';\n'
    outstr += 'F<{}> := NumberField(g);\n'.format(K.gen())
    outstr += 'ZF := Integers(F);\n\n'

    outstr += 'NN := ideal<ZF | {}>;\n\n'.format(set(f.level.gens()))

    outstr += 'primesArray := [\n' + ','.join([str(st).replace(' ', '') for st in prime_gens]).replace('],[',
                                                                                       '],\n[') + '];\n'
    outstr += 'primes := [ideal<ZF | {F!x : x in I}> : I in primesArray];\n\n'

    if hecke_pol != 'x':
        outstr += 'heckePol := ' + hecke_pol + ';\n'
        outstr += 'K<z> := NumberField(heckePol);\n'
    else:
        outstr += 'heckePol := x;\nK := Rationals(); e := 1;\n'

    hecke_eigs_processed = [str(st).replace(' ', '') if st != 'not known' else '"not known"' for st in hecke_eigs]
    outstr += '\nheckeEigenvaluesList := [*\n'+ ',\n'.join(hecke_eigs_processed) + '\n*];\n'
    outstr += '\nheckeEigenvalues := AssociativeArray();\n'
    outstr += 'for i in [1..#heckeEigenvaluesList] do\n    heckeEigenvalues[primes[i]] := heckeEigenvaluesList[i];\nend for;\n'


    if f.have_AL:
        AL_eigs    = f.AL_table_data
        outstr += '\nALEigenvalues := AssociativeArray();\n'
        for s in AL_eigs:
            outstr += 'ALEigenvalues[ideal<ZF | {}>] := {};\n'.format(set(s[0]), s[1])
    else:
        outstr += '\nALEigenvalues := "not known";\n'

    outstr += '\n// EXAMPLE:\n// pp := Factorization(2*ZF)[1][1];\n// heckeEigenvalues[pp];\n\n'

    outstr += '\n'.join([
        'print "To reconstruct the Bianchi newform f, type',
        '  f, iso := Explode(make_newform());";',
        '',
        'function make_newform();',
        ' M := BianchiCuspForms(F, NN);',
        ' S := NewSubspace(M);',
        ' // SetVerbose("Bianchi", 1);',
        ' NFD := NewformDecomposition(S);',
        ' newforms := [* Eigenform(U) : U in NFD *];',
        '',
        ' if #newforms eq 0 then;',
        '  print "No Bianchi newforms at this level";',
        '  return 0;',
        ' end if;',
        '',
        ' print "Testing ", #newforms, " possible newforms";',
        ' newforms := [* f: f in newforms | IsIsomorphic(BaseField(f), K) *];',
        ' print #newforms, " newforms have the correct Hecke field";',
        '',
        ' if #newforms eq 0 then;',
        '  print "No Bianchi newform found with the correct Hecke field";',
        '  return 0;',
        ' end if;',
        '',
        ' autos := Automorphisms(K);',
        ' xnewforms := [* *];',
        ' for f in newforms do;',
        '  if K eq RationalField() then;',
        '   Append(~xnewforms, [* f, autos[1] *]);',
        '  else;',
        '   flag, iso := IsIsomorphic(K,BaseField(f));',
        '   for a in autos do;',
        '    Append(~xnewforms, [* f, a*iso *]);',
        '   end for;',
        '  end if;',
        ' end for;',
        ' newforms := xnewforms;',
        '',
        ' for P in primes do;',
        '  if Valuation(NN,P) eq 0 then;',
        '   xnewforms := [* *];',
        '   for f_iso in newforms do;',
        '    f, iso := Explode(f_iso);',
        '    if HeckeEigenvalue(f,P) eq iso(heckeEigenvalues[P]) then;',
        '     Append(~xnewforms, f_iso);',
        '    end if;',
        '   end for;',
        '   newforms := xnewforms;',
        '   if #newforms eq 0 then;',
        '    print "No Bianchi newform found which matches the Hecke eigenvalues";',
        '    return 0;',
        '   else if #newforms eq 1 then;',
        '    print "success: unique match";',
        '    return newforms[1];',
        '   end if;',
        '   end if;',
        '  end if;',
        ' end for;',
        ' print #newforms, "Bianchi newforms found which match the Hecke eigenvalues";',
        ' return newforms[1];',
        '',
        'end function;'])

    return outstr