Example #1
0
File: main.py Project: koffie/lmfdb
def render_artin_representation_webpage(label):
    if re.compile(r'^\d+$').match(label):
        return artin_representation_search(**{'dimension': label})

    bread = get_bread([(label, ' ')])

    # label=dim.cond.nTt.indexcj, c is literal, j is index in conj class
    # Should we have a big try around this to catch bad labels?
    clean_label = clean_input(label)
    if clean_label != label:
        return redirect(
            url_for('.render_artin_representation_webpage', label=clean_label),
            301)
    try:
        the_rep = ArtinRepresentation(label)
    except:
        flash(
            Markup(
                "Error: <span style='color:black'>%s</span> is not the label of an Artin representation in the database."
                % (label)), "error")
        return search_input_error({'err': ''}, bread)

    extra_data = {}  # for testing?
    extra_data['galois_knowl'] = group_display_knowl(5, 3)  # for testing?
    #artin_logger.info("Found %s" % (the_rep._data))

    title = "Artin Representation %s" % label
    the_nf = the_rep.number_field_galois_group()
    if the_rep.sign() == 0:
        processed_root_number = "not computed"
    else:
        processed_root_number = str(the_rep.sign())
    properties = [
        ("Label", label),
        ("Dimension", str(the_rep.dimension())),
        ("Group", the_rep.group()),
        #("Conductor", str(the_rep.conductor())),
        ("Conductor", "$" + the_rep.factored_conductor_latex() + "$"),
        #("Bad primes", str(the_rep.bad_primes())),
        ("Root number", processed_root_number),
        ("Frobenius-Schur indicator", str(the_rep.indicator()))
    ]

    friends = []
    nf_url = the_nf.url_for()
    if nf_url:
        friends.append(("Artin Field", nf_url))
    cc = the_rep.central_character()
    if cc is not None:
        if the_rep.dimension() == 1:
            if cc.order == 2:
                cc_name = cc.symbol
            else:
                cc_name = cc.texname
            friends.append(("Dirichlet character " + cc_name,
                            url_for("characters.render_Dirichletwebpage",
                                    modulus=cc.modulus,
                                    number=cc.number)))
        else:
            detrep = the_rep.central_character_as_artin_rep()
            friends.append(("Determinant representation " + detrep.label(),
                            detrep.url_for()))

    # once the L-functions are in the database, the link can always be shown
    #if the_rep.dimension() <= 6:
    if the_rep.dimension() == 1:
        # Zeta is loaded differently
        if cc.modulus == 1 and cc.number == 1:
            friends.append(("L-function",
                            url_for("l_functions.l_function_dirichlet_page",
                                    modulus=cc.modulus,
                                    number=cc.number)))
        else:
            # looking for Lhash dirichlet_L_modulus.number
            mylhash = 'dirichlet_L_%d.%d' % (cc.modulus, cc.number)
            lres = db.lfunc_instances.lucky({'Lhash': mylhash})
            if lres is not None:
                friends.append(
                    ("L-function",
                     url_for("l_functions.l_function_dirichlet_page",
                             modulus=cc.modulus,
                             number=cc.number)))

    # Dimension > 1
    elif int(the_rep.conductor())**the_rep.dimension() <= 729000000000000:
        friends.append(("L-function",
                        url_for("l_functions.l_function_artin_page",
                                label=the_rep.label())))
    info = {}
    #mychar = the_rep.central_char()
    #info['pol2']= str([((j+1),mychar(j+1, 2*the_rep.character_field())) for j in range(50)])
    #info['pol3']=str(the_rep.central_character())
    #info['pol3']=str(the_rep.central_char(3))
    #info['pol5']=str(the_rep.central_char(5))
    #info['pol7']=str(the_rep.central_char(7))
    #info['pol11']=str(the_rep.central_char(11))
    learnmore = [('Artin representations labels', url_for(".labels_page"))]

    return render_template("artin-representation-show.html",
                           credit=tim_credit,
                           support=support_credit,
                           title=title,
                           bread=bread,
                           friends=friends,
                           object=the_rep,
                           properties2=properties,
                           extra_data=extra_data,
                           info=info,
                           learnmore=learnmore)