Esempio n. 1
0
def random_representation():
    rep = db.artin_reps.random(projection=2)
    num = random.randrange(len(rep['GaloisConjugates']))
    label = rep['Baselabel'] + "." + num2letters(num + 1)
    return redirect(
        url_for(".render_artin_representation_webpage", label=label), 307)
Esempio n. 2
0
def render_artin_representation_webpage(label):
    if re.compile(r'^\d+$').match(label):
        return artin_representation_search(**{
            'dimension': label,
            'search_array': ArtinSearchArray()
        })

    # 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)
    # We could have a single representation or a Galois orbit
    case = parse_any(label)
    if case[0] == 'malformed':
        try:
            raise ValueError
        except:
            flash_error(
                "%s is not in a valid form for the label for an Artin representation or a Galois orbit of Artin representations",
                label)
            return redirect(url_for(".index"))
    # Do this twice to customize error messages
    newlabel = case[1]
    case = case[0]
    if case == 'rep':
        try:
            the_rep = ArtinRepresentation(newlabel)
        except:
            newlabel = parse_artin_label(label)
            flash_error("Artin representation %s is not in database", label)
            return redirect(url_for(".index"))
    else:  # it is an orbit
        try:
            the_rep = ArtinRepresentation(newlabel + '.a')
        except:
            newlabel = parse_artin_orbit_label(newlabel)
            flash_error(
                "Galois orbit of Artin representations %s is not in database",
                label)
            return redirect(url_for(".index"))
        # in this case we want all characters
        num_conj = the_rep.galois_conjugacy_size()
        allchars = [
            ArtinRepresentation(newlabel + '.' +
                                num2letters(j)).character_formatted()
            for j in range(1, num_conj + 1)
        ]

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

    #artin_logger.info("Found %s" % (the_rep._data))

    if case == 'rep':
        title = "Artin representation %s" % label
    else:
        title = "Galois orbit of Artin representations %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", "$" + the_rep.factored_conductor_latex() + "$")
                  ]
    if case == 'rep':
        properties.append(("Root number", processed_root_number))
    properties.append(("Frobenius-Schur indicator", str(the_rep.indicator())))

    friends = []
    wnf = None
    nf_url = the_nf.url_for()
    if nf_url:
        friends.append(("Artin field", nf_url))
        wnf = the_nf.wnf()
    proj_nf = WebNumberField.from_coeffs(the_rep._data['Proj_Polynomial'])
    if proj_nf:
        friends.append(
            ("Projective Artin field",
             str(url_for("number_fields.by_label",
                         label=proj_nf.get_label()))))
    if case == 'rep':
        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()))
        add_lfunction_friends(friends, label)

        # 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())))
        orblabel = re.sub(r'\.[a-z]+$', '', label)
        friends.append(("Galois orbit " + orblabel,
                        url_for(".render_artin_representation_webpage",
                                label=orblabel)))
    else:
        add_lfunction_friends(friends, label)
        friends.append(("L-function",
                        url_for("l_functions.l_function_artin_page",
                                label=the_rep.label())))
        for j in range(1, 1 + the_rep.galois_conjugacy_size()):
            newlabel = label + '.' + num2letters(j)
            friends.append(("Artin representation " + newlabel,
                            url_for(".render_artin_representation_webpage",
                                    label=newlabel)))

    info = {}  # for testing

    if case == 'rep':
        return render_template("artin-representation-show.html",
                               credit=tim_credit,
                               support=support_credit,
                               title=title,
                               bread=bread,
                               friends=friends,
                               object=the_rep,
                               cycle_string=cycle_string,
                               wnf=wnf,
                               properties=properties,
                               info=info,
                               learnmore=learnmore_list())
    # else we have an orbit
    return render_template("artin-representation-galois-orbit.html",
                           credit=tim_credit,
                           support=support_credit,
                           title=title,
                           bread=bread,
                           allchars=allchars,
                           friends=friends,
                           object=the_rep,
                           cycle_string=cycle_string,
                           wnf=wnf,
                           properties=properties,
                           info=info,
                           learnmore=learnmore_list())