Example #1
0
    def row(trclass, goodorbad, p, poly):
        out = ""
        try:
            if L.coefficient_field == "CDF" or None in poly:
                factors = str(pretty_poly(poly, prec = prec))
            elif not display_galois:
                factors = list_to_factored_poly_otherorder(poly, galois=display_galois, prec = prec, p = p)
            else:
                factors, gal_groups = list_to_factored_poly_otherorder(poly, galois=display_galois, p = p)
            out += "<tr" + trclass + "><td>" + goodorbad + "</td><td>" + str(p) + "</td>";
            if display_galois:
                out += "<td class='galois'>"
                if gal_groups[0]==[0,0]:
                    pass   # do nothing, because the local faco is 1
                elif gal_groups[0]==[1,1]:
                    out += group_display_knowl(gal_groups[0][0], gal_groups[0][1],'$C_1$')
                else:
                    out += group_display_knowl(gal_groups[0][0], gal_groups[0][1])
                for n, k in gal_groups[1:]:
                    out += "$\\times$"
                    out += group_display_knowl(n, k)
                out += "</td>"
            out += "<td>" +"$" + factors + "$" + "</td>"
            out += "</tr>\n"

        except IndexError:
            out += "<tr><td></td><td>" + str(j) + "</td><td>" + "not available" + "</td></tr>\n"
        return out
Example #2
0
    def row(trclass, goodorbad, p, poly):
        out = ""
        try:
            if L.coefficient_field == "CDF" or None in poly:
                factors = str(pretty_poly(poly, prec=prec))
            elif not display_galois:
                factors = list_to_factored_poly_otherorder(
                    poly, galois=display_galois, prec=prec, p=p)
            else:
                factors, gal_groups = list_to_factored_poly_otherorder(
                    poly, galois=display_galois, p=p)
            out += "<tr" + trclass + "><td>" + goodorbad + "</td><td>" + str(
                p) + "</td>"
            if display_galois:
                out += "<td class='galois'>"
                if gal_groups[0] == [0, 0]:
                    pass  # do nothing, because the local faco is 1
                elif gal_groups[0] == [1, 1]:
                    out += group_display_knowl(gal_groups[0][0],
                                               gal_groups[0][1], '$C_1$')
                else:
                    out += group_display_knowl(gal_groups[0][0],
                                               gal_groups[0][1])
                for n, k in gal_groups[1:]:
                    out += "$\\times$"
                    out += group_display_knowl(n, k)
                out += "</td>"
            out += "<td>" + "$" + factors + "$" + "</td>"
            out += "</tr>\n"

        except IndexError:
            out += "<tr><td></td><td>" + str(
                j) + "</td><td>" + "not available" + "</td></tr>\n"
        return out
Example #3
0
 def display_galois_group(self):
     if not self.gal or not self.gal[
             't']:  #the number field was not found in the database
         return "The Galois group of this isogeny class is not in the database."
     else:
         C = getDBConnection()
         return group_display_knowl(self.gal['n'], self.gal['t'], C)
Example #4
0
 def get_local_algebra(self, p):
     local_algebra_dict = self._data.get('loc_algebras', None)
     if local_algebra_dict is None:
         return None
     if str(p) in local_algebra_dict:
         R = PolynomialRing(QQ, 'x')
         palg = local_algebra_dict[str(p)]
         palgs = [R(str(s)) for s in palg.split(',')]
         palgstr = [
                 list2string([int(c) for c in pol.coefficients(sparse=False)])
                 for pol in palgs]
         palgrec = [db.lf_fields.lucky({'p': p, 'coeffs': map(int, c.split(','))}) for c in palgstr]
         return [
                 [
                     LF['label'],
                     latex(f),
                     int(LF['e']),
                     int(LF['f']),
                     int(LF['c']),
                     group_display_knowl(LF['n'], LF['galT']),
                     LF['t'],
                     LF['u'],
                     LF['slopes']
                 ]
                 for LF, f in zip(palgrec, palgs) ]
     return None
Example #5
0
 def display_galois_group(self):
     if not hasattr(
             self, 'galois_t'
     ) or not self.galois_t:  #the number field was not found in the database
         return "The Galois group of this isogeny class is not in the database."
     else:
         return group_display_knowl(self.galois_n, self.galois_t)
Example #6
0
def nf_knowl_guts(label):
    out = ''
    wnf = WebNumberField(label)
    if wnf.is_null():
        return 'Cannot find global number field %s' % label
    out += "Global number field %s" % label
    out += '<div>'
    out += 'Defining polynomial: '
    out += "\(%s\)" % latex(wnf.poly())
    D = wnf.disc()
    Dfact = wnf.disc_factored_latex()
    if D.abs().is_prime() or D == 1:
        Dfact = "\(%s\)" % str(D)
    else:
        Dfact = '%s = \(%s\)' % (str(D), Dfact)
    out += '<br>Discriminant: '
    out += Dfact
    out += '<br>Signature: '
    out += str(wnf.signature())
    out += '<br>Galois group: ' + group_display_knowl(wnf.degree(),
                                                      wnf.galois_t())
    out += '<br>Class number: %s ' % str(wnf.class_number_latex())
    if wnf.can_class_number():
        out += wnf.short_grh_string()
    out += '</div>'
    out += '<div align="right">'
    out += '<a href="%s">%s home page</a>' % (str(
        url_for("number_fields.number_field_render_webpage",
                natural=label)), label)
    out += '</div>'
    return out
Example #7
0
 def get_local_algebra(self, p):
     local_algebra_dict = self._data.get('loc_algebras', None)
     if local_algebra_dict is None:
         return None
     if str(p) in local_algebra_dict:
         R = PolynomialRing(QQ, 'x')
         palg = local_algebra_dict[str(p)]
         palgs = [R(str(s)) for s in palg.split(',')]
         palgstr = [
             list2string([int(c) for c in pol.coefficients(sparse=False)])
             for pol in palgs
         ]
         palgrec = [
             db.lf_fields.lucky({
                 'p': p,
                 'coeffs': map(int, c.split(','))
             }) for c in palgstr
         ]
         return [[
             LF['label'],
             latex(f),
             int(LF['e']),
             int(LF['f']),
             int(LF['c']),
             group_display_knowl(LF['n'], LF['galT']), LF['t'], LF['u'],
             LF['slopes']
         ] for LF, f in zip(palgrec, palgs)]
     return None
Example #8
0
def nf_knowl_guts(label, C):
    out = ''
    wnf = WebNumberField(label)
    if wnf.is_null():
        return 'Cannot find global number field %s' % label
    out += "Global number field %s" % label
    out += '<div>'
    out += 'Defining polynomial: '
    out += "\(%s\)" % latex(wnf.poly())
    D = wnf.disc()
    Dfact = wnf.disc_factored_latex()
    if D.abs().is_prime() or D == 1:
        Dfact = "\(%s\)" % str(D)
    else:
        Dfact = '%s = \(%s\)' % (str(D),Dfact)
    out += '<br>Discriminant: '
    out += Dfact
    out += '<br>Signature: '
    out += str(wnf.signature())
    out += '<br>Galois group: '+group_display_knowl(wnf.degree(),wnf.galois_t(),C)
    out += '</div>'
    out += '<div align="right">'
    out += '<a href="%s">%s home page</a>' % (url_for("number_fields.number_field_render_webpage", natural=label),label)
    out += '</div>'
    return out
Example #9
0
def av_data(label):
    abvar = db.av_fqisog.lookup(label)
    wnf = WebNumberField(abvar['nf'])
    inf = '<div>Dimension: ' + str(abvar['g']) + '<br />'
    if not wnf.is_null():
        inf += 'Number field: ' + nf_display_knowl(abvar['nf'], name = abvar['nf']) + '<br />'
        inf += 'Galois group: ' + group_display_knowl(abvar['gal']['n'],abvar['gal']['t']) + '<br />'
    inf += '$p$-rank: ' + str(abvar['p_rank']) + '</div>'
    inf += '<div align="right">'
    g, q, iso = split_label(label)
    url = url_for("abvarfq.abelian_varieties_by_gqi", g = g, q = q, iso = iso)
    inf += '<a href="%s">%s home page</a>' % (url, label)
    inf += '</div>'
    return inf
Example #10
0
def lf_knowl_guts(label, C):
    f = C.localfields.fields.find_one({'label':label})
    ans = 'Local number field %s<br><br>'% label
    ans += 'Extension of $\Q_{%s}$ defined by %s<br>'%(str(f['p']),web_latex(coeff_to_poly(string2list(f['coeffs']))))
    GG = f['gal']
    ans += 'Degree: %s<br>' % str(GG[0])
    ans += 'Ramification index $e$: %s<br>' % str(f['e'])
    ans += 'Residue field degree $f$: %s<br>' % str(f['f'])
    ans += 'Discriminant ideal:  $(p^{%s})$ <br>' % str(f['c'])
    ans += 'Galois group $G$: %s<br>' % group_display_knowl(GG[0], GG[1], C)
    ans += '<div align="right">'
    ans += '<a href="%s">%s home page</a>' % (str(url_for("local_fields.by_label", label=label)),label)
    ans += '</div>'
    return ans
Example #11
0
def lf_knowl_guts(label, C):
    f = C.localfields.fields.find_one({'label':label})
    ans = 'Local number field %s<br><br>'% label
    ans += 'Extension of $\Q_{%s}$ defined by %s<br>'%(str(f['p']),web_latex(coeff_to_poly(string2list(f['coeffs']))))
    GG = f['gal']
    ans += 'Degree: %s<br>' % str(GG[0])
    ans += 'Ramification index $e$: %s<br>' % str(f['e'])
    ans += 'Residue field degree $f$: %s<br>' % str(f['f'])
    ans += 'Discriminant ideal:  $(p^{%s})$ <br>' % str(f['c'])
    ans += 'Galois group $G$: %s<br>' % group_display_knowl(GG[0], GG[1], C)
    ans += '<div align="right">'
    ans += '<a href="%s">%s home page</a>' % (str(url_for("local_fields.by_label", label=label)),label)
    ans += '</div>'
    return ans
Example #12
0
def lf_knowl_guts(label, C):
    f = C.localfields.fields.find_one({"label": label})
    ans = "Local number field %s<br><br>" % label
    ans += "Extension of $\Q_{%s}$ defined by %s<br>" % (str(f["p"]), web_latex(coeff_to_poly(f["coeffs"])))
    GG = f["gal"]
    ans += "Degree: %s<br>" % str(GG[0])
    ans += "Ramification index $e$: %s<br>" % str(f["e"])
    ans += "Residue field degree $f$: %s<br>" % str(f["f"])
    ans += "Discriminant ideal:  $(p^{%s})$ <br>" % str(f["c"])
    ans += "Galois group $G$: %s<br>" % group_display_knowl(GG[0], GG[1], C)
    ans += '<div align="right">'
    ans += '<a href="%s">%s home page</a>' % (str(url_for("local_fields.by_label", label=label)), label)
    ans += "</div>"
    return ans
Example #13
0
def av_data(label):
    C = getDBConnection()
    abvar = C.abvar.fq_isog.find_one({ 'label' : label })
    wnf = WebNumberField(abvar['nf'])
    inf = '<div>Dimension: ' + str(abvar['g']) + '<br />'
    if not wnf.is_null():
        inf += 'Number field: ' + nf_display_knowl(abvar['nf'], C, name = abvar['nf']) + '<br />'
        inf += 'Galois group: ' + group_display_knowl(abvar['gal']['n'],abvar['gal']['t'],C) + '<br />'
    inf += '$p$-rank: ' + str(abvar['p_rank']) + '</div>'
    inf += '<div align="right">'
    g, q, iso = split_label(label)
    url = url_for("abvarfq.abelian_varieties_by_gqi", g = g, q = q, iso = iso)
    inf += '<a href="%s">%s home page</a>' % (url, label)
    inf += '</div>'
    return inf
Example #14
0
 def get_local_algebra(self, p):
     local_algebra_dict = self._data.get('loc_algebras', None)
     if local_algebra_dict is None:
         return None
     if str(p) in local_algebra_dict:
         R = PolynomialRing(QQ, 'x')
         palg = local_algebra_dict[str(p)]
         palgs = [R(str(s)) for s in palg.split(',')]
         palgs = [list2string([int(c) for c in 
             pol.coefficients(sparse=False)]) for pol in palgs]
         palgs = [lfdb().find_one({'p': p, 'coeffs': c}) for c in palgs]
         return [[f['label'], latex(R(string2list(f['coeffs']))), 
             int(f['e']), int(f['f']),int(f['c']),
             group_display_knowl(f['gal'][0], f['gal'][1], db()),
             f['t'],f['u'],f['slopes']]
             for f in palgs]
     return None
Example #15
0
 def get_local_algebra(self, p):
     local_algebra_dict = self._data.get('loc_algebras', None)
     if local_algebra_dict is None:
         return None
     if str(p) in local_algebra_dict:
         R = PolynomialRing(QQ, 'x')
         palg = local_algebra_dict[str(p)]
         palgs = [R(str(s)) for s in palg.split(',')]
         palgs = [list2string([int(c) for c in 
             pol.coefficients(sparse=False)]) for pol in palgs]
         palgs = [lfdb().find_one({'p': p, 'coeffs': c}) for c in palgs]
         return [[f['label'], latex(R(string2list(f['coeffs']))), 
             int(f['e']), int(f['f']),int(f['c']),
             group_display_knowl(f['gal'][0], f['gal'][1], db()),
             f['t'],f['u'],f['slopes']]
             for f in palgs]
     return None
Example #16
0
def local_field_data(label):
    f = db.lf_fields.lookup(label)
    nicename = ''
    if f['n'] < 3:
        nicename = ' = '+ prettyname(f)
    ans = 'Local number field %s%s<br><br>'% (label, nicename)
    ans += 'Extension of $\Q_{%s}$ defined by %s<br>'%(str(f['p']),web_latex(coeff_to_poly(f['coeffs'])))
    gt = f['gal']
    gn = f['n']
    ans += 'Degree: %s<br>' % str(gt)
    ans += 'Ramification index $e$: %s<br>' % str(f['e'])
    ans += 'Residue field degree $f$: %s<br>' % str(f['f'])
    ans += 'Discriminant ideal:  $(p^{%s})$ <br>' % str(f['c'])
    ans += 'Galois group $G$: %s<br>' % group_display_knowl(gn, gt)
    ans += '<div align="right">'
    ans += '<a href="%s">%s home page</a>' % (str(url_for("local_fields.by_label", label=label)),label)
    ans += '</div>'
    return ans
Example #17
0
def lf_algebra_knowl_guts(labels, C):
    labs = labels.split(',')
    f1 = labs[0].split('.')
    labs = sorted(labs, key=lambda u: (int(j) for j in u.split('.')), reverse=True)
    ans = '<div align="center">'
    ans += '$%s$-adic algebra'%str(f1[0])
    ans += '</div>'
    ans += '<p>'
    ans += "<table class='ntdata'><th>Label<th>Polynomial<th>$e$<th>$f$<th>$c$<th>$G$<th>Slopes"
    fall = [C.localfields.fields.find_one({'label':label}) for label in labs]
    for f in fall:
        l = str(f['label'])
        ans += '<tr><td><a href="/LocalNumberField/%s">%s</a><td>'%(l,l)
        ans += format_coeffs(f['coeffs'])
        ans += '<td>%d<td>%d<td>%d<td>'%(f['e'],f['f'],f['c'])
        ans += group_display_knowl(f['gal'][0],f['gal'][1],db())
        ans += '<td>$'+ show_slope_content(f['slopes'],f['t'],f['u'])+'$'
    ans += '</table>'
    if len(labs) != len(set(labs)):
        ans +='<p>Fields which appear more than once occur according to their given multiplicities in the algebra'
    return ans
Example #18
0
def lf_algebra_knowl_guts(labels, C):
    labs = labels.split(',')
    f1 = labs[0].split('.')
    labs = sorted(labs, key=lambda u: (int(j) for j in u.split('.')), reverse=True)
    ans = '<div align="center">'
    ans += '$%s$-adic algebra'%str(f1[0])
    ans += '</div>'
    ans += '<p>'
    ans += "<table class='ntdata'><th>Label<th>Polynomial<th>$e$<th>$f$<th>$c$<th>$G$<th>Slopes"
    fall = [C.localfields.fields.find_one({'label':label}) for label in labs]
    for f in fall:
        l = str(f['label'])
        ans += '<tr><td><a href="/LocalNumberField/%s">%s</a><td>'%(l,l)
        ans += format_coeffs(f['coeffs'])
        ans += '<td>%d<td>%d<td>%d<td>'%(f['e'],f['f'],f['c'])
        ans += group_display_knowl(f['gal'][0],f['gal'][1],db())
        ans += '<td>$'+ show_slope_content(f['slopes'],f['t'],f['u'])+'$'
    ans += '</table>'
    if len(labs) != len(set(labs)):
        ans +='<p>Fields which appear more than once occur according to their given multiplicities in the algebra'
    return ans
Example #19
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)
Example #20
0
    def make_object(self, curve, endo, tama, ratpts, is_curve):
        from lmfdb.genus2_curves.main import url_for_curve_label

        # all information about the curve, its Jacobian, isogeny class, and endomorphisms goes in the data dictionary
        # most of the data from the database gets polished/formatted before we put it in the data dictionary
        data = self.data = {}

        data['label'] = curve['label'] if is_curve else curve['class']
        data['slabel'] = data['label'].split('.')

        # set attributes common to curves and isogeny classes here
        data['Lhash'] = curve['Lhash']
        data['cond'] = ZZ(curve['cond'])
        data['cond_factor_latex'] = web_latex(factor(int(data['cond'])))
        data['analytic_rank'] = ZZ(curve['analytic_rank'])
        data['st_group'] = curve['st_group']
        data['st_group_link'] = st_link_by_name(1,4,data['st_group'])
        data['st0_group_name'] = st0_group_name(curve['real_geom_end_alg'])
        data['is_gl2_type'] = curve['is_gl2_type']
        data['root_number'] = ZZ(curve['root_number'])
        data['lfunc_url'] = url_for("l_functions.l_function_genus2_page", cond=data['slabel'][0], x=data['slabel'][1])
        data['bad_lfactors'] = literal_eval(curve['bad_lfactors'])
        data['bad_lfactors_pretty'] = [ (c[0], list_to_factored_poly_otherorder(c[1])) for c in data['bad_lfactors']]

        if is_curve:
            # invariants specific to curve
            data['class'] = curve['class']
            data['abs_disc'] = ZZ(curve['disc_key'][3:]) # use disc_key rather than abs_disc (will work when abs_disc > 2^63)
            data['disc'] = curve['disc_sign'] * curve['abs_disc']
            data['min_eqn'] = literal_eval(curve['eqn'])
            data['min_eqn_display'] = list_to_min_eqn(data['min_eqn'])
            data['disc_factor_latex'] = web_latex(factor(data['disc']))
            data['igusa_clebsch'] = [ZZ(a) for a in literal_eval(curve['igusa_clebsch_inv'])]
            data['igusa'] = [ZZ(a) for a in literal_eval(curve['igusa_inv'])]
            data['g2'] = [QQ(a) for a in literal_eval(curve['g2_inv'])]
            data['igusa_clebsch_factor_latex'] = [web_latex(zfactor(i)) for i in data['igusa_clebsch']]
            data['igusa_factor_latex'] = [ web_latex(zfactor(j)) for j in data['igusa'] ]
            data['aut_grp_id'] = curve['aut_grp_id']
            data['geom_aut_grp_id'] = curve['geom_aut_grp_id']
            data['num_rat_wpts'] = ZZ(curve['num_rat_wpts'])
            data['two_selmer_rank'] = ZZ(curve['two_selmer_rank'])
            data['has_square_sha'] = "square" if curve['has_square_sha'] else "twice a square"
            P = curve['non_solvable_places']
            if len(P):
                sz = "except over "
                sz += ", ".join([QpName(p) for p in P])
                last = " and"
                if len(P) > 2:
                    last = ", and"
                sz = last.join(sz.rsplit(",",1))
            else:
                sz = "everywhere"
            data['non_solvable_places'] = sz
            data['torsion_order'] = curve['torsion_order']
            data['torsion_factors'] = [ ZZ(a) for a in literal_eval(curve['torsion_subgroup']) ]
            if len(data['torsion_factors']) == 0:
                data['torsion_subgroup'] = '\mathrm{trivial}'
            else:
                data['torsion_subgroup'] = ' \\times '.join([ '\Z/{%s}\Z' % n for n in data['torsion_factors'] ])
            data['end_ring_base'] = endo['ring_base']
            data['end_ring_geom'] = endo['ring_geom']
            data['tama'] = ''
            for i in range(tama.count()):
            	item = tama.next()
            	if item['tamagawa_number'] > 0:
            		tamgwnr = str(item['tamagawa_number'])
            	else:
            		tamgwnr = 'N/A'
            	data['tama'] += tamgwnr + ' (p = ' + str(item['p']) + ')'
            	if (i+1 < tama.count()):
            		data['tama'] += ', '
            if ratpts:
                if len(ratpts['rat_pts']):
                    data['rat_pts'] = ',  '.join(web_latex('(' +' : '.join(P) + ')') for P in ratpts['rat_pts'])
                data['rat_pts_v'] =  2 if ratpts['rat_pts_v'] else 1
                # data['mw_rank'] = ratpts['mw_rank']
                # data['mw_rank_v'] = ratpts['mw_rank_v']
            else:
                data['rat_pts_v'] = 0
            if curve['two_torsion_field'][0]:
                data['two_torsion_field_knowl'] = nf_display_knowl (curve['two_torsion_field'][0], getDBConnection(), field_pretty(curve['two_torsion_field'][0]))
            else:
                t = curve['two_torsion_field']
                data['two_torsion_field_knowl'] = """splitting field of \(%s\) with Galois group %s"""%(intlist_to_poly(t[1]),group_display_knowl(t[2][0],t[2][1],getDBConnection()))
        else:
            # invariants specific to isogeny class
            curves_data = g2c_db_curves().find({"class" : curve['class']},{'_id':int(0),'label':int(1),'eqn':int(1),'disc_key':int(1)}).sort([("disc_key", ASCENDING), ("label", ASCENDING)])
            if not curves_data:
                raise KeyError("No curves found in database for isogeny class %s of genus 2 curve %s." %(curve['class'],curve['label']))
            data['curves'] = [ {"label" : c['label'], "equation_formatted" : list_to_min_eqn(literal_eval(c['eqn'])), "url": url_for_curve_label(c['label'])} for c in curves_data ]
            lfunc_data = g2c_db_lfunction_by_hash(curve['Lhash'])
            if not lfunc_data:
                raise KeyError("No Lfunction found in database for isogeny class of genus 2 curve %s." %curve['label'])
            if lfunc_data and lfunc_data.get('euler_factors'):
                data['good_lfactors'] = [[nth_prime(n+1),lfunc_data['euler_factors'][n]] for n in range(len(lfunc_data['euler_factors'])) if nth_prime(n+1) < 30 and (data['cond'] % nth_prime(n+1))]
                data['good_lfactors_pretty'] = [ (c[0], list_to_factored_poly_otherorder(c[1])) for c in data['good_lfactors']]
        # Endomorphism data over QQ:
        data['gl2_statement_base'] = gl2_statement_base(endo['factorsRR_base'], r'\(\Q\)')
        data['factorsQQ_base'] = endo['factorsQQ_base']
        data['factorsRR_base'] = endo['factorsRR_base']
        data['end_statement_base'] = """Endomorphism %s over \(\Q\):<br>""" %("ring" if is_curve else "algebra") + \
            end_statement(data['factorsQQ_base'], endo['factorsRR_base'], ring=data['end_ring_base'] if is_curve else None)

        # Field over which all endomorphisms are defined
        data['end_field_label'] = endo['fod_label']
        data['end_field_poly'] = intlist_to_poly(endo['fod_coeffs'])
        data['end_field_statement'] = end_field_statement(data['end_field_label'], data['end_field_poly'])
        
        # Endomorphism data over QQbar:
        data['factorsQQ_geom'] = endo['factorsQQ_geom']
        data['factorsRR_geom'] = endo['factorsRR_geom']
        if data['end_field_label'] != '1.1.1.1':
            data['gl2_statement_geom'] = gl2_statement_base(data['factorsRR_geom'], r'\(\overline{\Q}\)')
            data['end_statement_geom'] = """Endomorphism %s over \(\overline{\Q}\):""" %("ring" if is_curve else "algebra") + \
                end_statement(data['factorsQQ_geom'], data['factorsRR_geom'], field=r'\overline{\Q}', ring=data['end_ring_geom'] if is_curve else None)
        data['real_geom_end_alg_name'] = end_alg_name(curve['real_geom_end_alg'])

        # Endomorphism data over intermediate fields not already treated (only for curves, not necessarily isogeny invariant):
        if is_curve:
            data['end_lattice'] = (endo['lattice'])[1:-1]
            if data['end_lattice']:
                data['end_lattice_statement'] = end_lattice_statement(data['end_lattice'])

        # Field over which the Jacobian decomposes (base field if Jacobian is geometrically simple)
        data['is_simple_geom'] = endo['is_simple_geom']
        data['split_field_label'] = endo['spl_fod_label']
        data['split_field_poly'] = intlist_to_poly(endo['spl_fod_coeffs'])
        data['split_field_statement'] = split_field_statement(data['is_simple_geom'], data['split_field_label'], data['split_field_poly'])

        # Elliptic curve factors for non-simple Jacobians
        if not data['is_simple_geom']:
            data['split_coeffs'] = endo['spl_facs_coeffs']
            if 'spl_facs_labels' in endo and len(endo['spl_facs_labels']) == len(endo['spl_facs_coeffs']):
                data['split_labels'] = endo['spl_facs_labels']
            data['split_condnorms'] = endo['spl_facs_condnorms']
            data['split_statement'] = split_statement(data['split_coeffs'], data.get('split_labels'), data['split_condnorms'])

        # Properties
        self.properties = properties = [('Label', data['label'])]
        if is_curve:
            self.plot = encode_plot(eqn_list_to_curve_plot(data['min_eqn'], data['rat_pts'].split(',') if 'rat_pts' in data else []))
            plot_link = '<a href="{0}"><img src="{0}" width="200" height="150"/></a>'.format(self.plot)

            properties += [
                (None, plot_link),
                ('Conductor',str(data['cond'])),
                ('Discriminant', str(data['disc'])),
                ]
        properties += [
            ('Sato-Tate group', data['st_group_link']),
            ('\(\\End(J_{\\overline{\\Q}}) \\otimes \\R\)', '\(%s\)' % data['real_geom_end_alg_name']),
            ('\(\\overline{\\Q}\)-simple', bool_pretty(data['is_simple_geom'])),
            ('\(\mathrm{GL}_2\)-type', bool_pretty(data['is_gl2_type'])),
            ]

        # Friends
        self.friends = friends = [('L-function', data['lfunc_url'])]
        if is_curve:
            friends.append(('Isogeny class %s.%s' % (data['slabel'][0], data['slabel'][1]), url_for(".by_url_isogeny_class_label", cond=data['slabel'][0], alpha=data['slabel'][1])))
        for friend in g2c_db_lfunction_instances().find({'Lhash':data['Lhash']},{'_id':False,'url':True}):
            if 'url' in friend:
                add_friend (friends, lfunction_friend_from_url(friend['url']))
            if 'urls' in friend:
                for url in friends['urls']:
                    add_friend (friends, lfunction_friend_from_url(friend['url']))
        if 'split_labels' in data:
            for friend_label in data['split_labels']:
                if is_curve:
                    add_friend (friends, ("Elliptic curve " + friend_label, url_for_ec(friend_label)))
                else:
                    add_friend (friends, ("EC isogeny class " + ec_label_class(friend_label), url_for_ec_class(friend_label)))
        if is_curve:
            friends.append(('Twists', url_for(".index_Q", g20 = str(data['g2'][0]), g21 = str(data['g2'][1]), g22 = str(data['g2'][2]))))

        # Breadcrumbs
        self.bread = bread = [
             ('Genus 2 Curves', url_for(".index")),
             ('$\Q$', url_for(".index_Q")),
             ('%s' % data['slabel'][0], url_for(".by_conductor", cond=data['slabel'][0])),
             ('%s' % data['slabel'][1], url_for(".by_url_isogeny_class_label", cond=data['slabel'][0], alpha=data['slabel'][1]))
             ]
        if is_curve:
            bread += [
                ('%s' % data['slabel'][2], url_for(".by_url_isogeny_class_discriminant", cond=data['slabel'][0], alpha=data['slabel'][1], disc=data['slabel'][2])),
                ('%s' % data['slabel'][3], url_for(".by_url_curve_label", cond=data['slabel'][0], alpha=data['slabel'][1], disc=data['slabel'][2], num=data['slabel'][3]))
                ]

        # Title
        self.title = "Genus 2 " + ("Curve " if is_curve else "Isogeny Class ") + data['label']

        # Code snippets (only for curves)
        if not is_curve:
            return
        self.code = code = {}
        code['show'] = {'sage':'','magma':''} # use default show names
        code['curve'] = {'sage':'R.<x> = PolynomialRing(QQ); C = HyperellipticCurve(R(%s), R(%s))'%(data['min_eqn'][0],data['min_eqn'][1]),
                              'magma':'R<x> := PolynomialRing(Rationals()); C := HyperellipticCurve(R!%s, R!%s);'%(data['min_eqn'][0],data['min_eqn'][1])}
        if data['abs_disc'] % 4096 == 0:
            ind2 = [a[0] for a in data['bad_lfactors']].index(2)
            bad2 = data['bad_lfactors'][ind2][1]
            magma_cond_option = ': ExcFactors:=[*<2,Valuation('+str(data['cond'])+',2),R!'+str(bad2)+'>*]'
        else:
            magma_cond_option = ''
        code['cond'] = {'magma': 'Conductor(LSeries(C%s)); Factorization($1);'% magma_cond_option}
        code['disc'] = {'magma':'Discriminant(C); Factorization(Integers()!$1);'}
        code['igusa_clebsch'] = {'sage':'C.igusa_clebsch_invariants(); [factor(a) for a in _]',
                                      'magma':'IgusaClebschInvariants(C); [Factorization(Integers()!a): a in $1];'}
        code['igusa'] = {'magma':'IgusaInvariants(C); [Factorization(Integers()!a): a in $1];'}
        code['g2'] = {'magma':'G2Invariants(C);'}
        code['aut'] = {'magma':'AutomorphismGroup(C); IdentifyGroup($1);'}
        code['autQbar'] = {'magma':'AutomorphismGroup(ChangeRing(C,AlgebraicClosure(Rationals()))); IdentifyGroup($1);'}
        code['num_rat_wpts'] = {'magma':'#Roots(HyperellipticPolynomials(SimplifiedModel(C)));'}
        if ratpts:
            code['rat_pts'] = {'magma': '[' + ','.join(["C![%s,%s,%s]"%(p[0],p[1],p[2]) for p in ratpts['rat_pts']]) + '];' }
        code['two_selmer'] = {'magma':'TwoSelmerGroup(Jacobian(C)); NumberOfGenerators($1);'}
        code['has_square_sha'] = {'magma':'HasSquareSha(Jacobian(C));'}
        code['locally_solvable'] = {'magma':'f,h:=HyperellipticPolynomials(C); g:=4*f+h^2; HasPointsEverywhereLocally(g,2) and (#Roots(ChangeRing(g,RealField())) gt 0 or LeadingCoefficient(g) gt 0);'}
        code['torsion_subgroup'] = {'magma':'TorsionSubgroup(Jacobian(SimplifiedModel(C))); AbelianInvariants($1);'}
Example #21
0
def render_field_webpage(args):
    data = None
    info = {}
    if 'label' in args:
        label = clean_input(args['label'])
        data = lfdb().find_one({'label': label})
        if data is None:
            bread = get_bread([("Search error", ' ')])
            info['err'] = "Field " + label + " was not found in the database."
            info['label'] = label
            return search_input_error(info, bread)
        title = 'Local Number Field ' + label
        polynomial = coeff_to_poly(string2list(data['coeffs']))
        p = data['p']
        e = data['e']
        f = data['f']
        cc = data['c']
        GG = data['gal']
        gn = GG[0]
        gt = GG[1]
        the_gal = WebGaloisGroup.from_nt(gn,gt)
        isgal = ' Galois' if the_gal.order() == gn else ' not Galois'
        abelian = ' and abelian' if the_gal.is_abelian() else ''
        galphrase = 'This field is'+isgal+abelian+' over $\Q_{%d}$.'%p
        autstring = r'\Gal' if the_gal.order() == gn else r'\Aut'
        prop2 = [
            ('Label', label),
            ('Base', '\(\Q_{%s}\)' % p),
            ('Degree', '\(%s\)' % data['n']),
            ('e', '\(%s\)' % e),
            ('f', '\(%s\)' % f),
            ('c', '\(%s\)' % cc),
            ('Galois group', group_display_short(gn, gt, db())),
        ]
        Pt = PolynomialRing(QQ, 't')
        Pyt = PolynomialRing(Pt, 'y')
        eisenp = Pyt(str(data['eisen']))
        unramp = Pyt(str(data['unram']))
        # Look up the unram poly so we can link to it
        unramdata = lfdb().find_one({'p': p, 'n': f, 'c': 0})
        if unramdata is not None:
            unramfriend = "/LocalNumberField/%s" % unramdata['label']
        else:
            logger.fatal("Cannot find unramified field!")
            unramfriend = ''
        rfdata = lfdb().find_one({'p': p, 'n': {'$in': [1, 2]}, 'rf': data['rf']})
        if rfdata is None:
            logger.fatal("Cannot find discriminant root field!")
            rffriend = ''
        else:
            rffriend = "/LocalNumberField/%s" % rfdata['label']
        gsm = data['gsm']
        if gsm == '0':
            gsm = 'Not computed'
        elif gsm == '-1':
            gsm = 'Does not exist'
        else:
            gsm = web_latex(coeff_to_poly(string2list(gsm)))


        info.update({
                    'polynomial': web_latex(polynomial),
                    'n': data['n'],
                    'p': p,
                    'c': data['c'],
                    'e': data['e'],
                    'f': data['f'],
                    't': data['t'],
                    'u': data['u'],
                    'rf': printquad(data['rf'], p),
                    'hw': data['hw'],
                    'slopes': show_slopes(data['slopes']),
                    'gal': group_display_knowl(gn, gt, db()),
                    'gt': gt,
                    'inertia': group_display_inertia(data['inertia'], db()),
                    'unram': web_latex(unramp),
                    'eisen': web_latex(eisenp),
                    'gms': data['gms'],
                    'gsm': gsm,
                    'galphrase': galphrase,
                    'autstring': autstring,
                    'subfields': format_subfields(data['subfields'],p),
                    'aut': data['aut'],
                    })
        friends = [('Galois group', "/GaloisGroup/%dT%d" % (gn, gt))]
        if unramfriend != '':
            friends.append(('Unramified subfield', unramfriend))
        if rffriend != '':
            friends.append(('Discriminant root field', rffriend))

        bread = get_bread([(label, ' ')])
        learnmore = [('Completeness of the data', url_for(".completeness_page")),
                ('Source of the data', url_for(".how_computed_page")),
                ('Local field labels', url_for(".labels_page"))]
        return render_template("lf-show-field.html", credit=LF_credit, title=title, bread=bread, info=info, properties2=prop2, friends=friends, learnmore=learnmore)
Example #22
0
def render_field_webpage(args):
    data = None
    info = {}
    bread = [('Global Number Fields', url_for(".number_field_render_webpage"))]

    # This function should not be called unless label is set.
    label = clean_input(args['label'])
    nf = WebNumberField(label)
    data = {}
    if nf.is_null():
        bread.append(('Search Results', ' '))
        info['err'] = 'There is no field with label %s in the database' % label
        info['label'] = args['label_orig'] if 'label_orig' in args else args[
            'label']
        return search_input_error(info, bread)

    info['wnf'] = nf
    data['degree'] = nf.degree()
    data['class_number'] = nf.class_number_latex()
    ram_primes = nf.ramified_primes()
    t = nf.galois_t()
    n = nf.degree()
    data['is_galois'] = nf.is_galois()
    data['is_abelian'] = nf.is_abelian()
    if nf.is_abelian():
        conductor = nf.conductor()
        data['conductor'] = conductor
        dirichlet_chars = nf.dirichlet_group()
        if len(dirichlet_chars) > 0:
            data['dirichlet_group'] = [
                '<a href = "%s">$\chi_{%s}(%s,&middot;)$</a>' %
                (url_for('characters.render_Dirichletwebpage',
                         modulus=data['conductor'],
                         number=j), data['conductor'], j)
                for j in dirichlet_chars
            ]
            data['dirichlet_group'] = r'$\lbrace$' + ', '.join(
                data['dirichlet_group']) + r'$\rbrace$'
        if data['conductor'].is_prime() or data['conductor'] == 1:
            data['conductor'] = "\(%s\)" % str(data['conductor'])
        else:
            factored_conductor = factor_base_factor(data['conductor'],
                                                    ram_primes)
            factored_conductor = factor_base_factorization_latex(
                factored_conductor)
            data['conductor'] = "\(%s=%s\)" % (str(
                data['conductor']), factored_conductor)
    data['galois_group'] = group_display_knowl(n, t)
    data['cclasses'] = cclasses_display_knowl(n, t)
    data['character_table'] = character_table_display_knowl(n, t)
    data['class_group'] = nf.class_group()
    data['class_group_invs'] = nf.class_group_invariants()
    data['signature'] = nf.signature()
    data['coefficients'] = nf.coeffs()
    nf.make_code_snippets()
    D = nf.disc()
    data['disc_factor'] = nf.disc_factored_latex()
    if D.abs().is_prime() or D == 1:
        data['discriminant'] = "\(%s\)" % str(D)
    else:
        data['discriminant'] = "\(%s=%s\)" % (str(D), data['disc_factor'])
    data['frob_data'], data['seeram'] = frobs(nf)
    # Bad prime information
    npr = len(ram_primes)
    ramified_algebras_data = nf.ramified_algebras_data()
    if isinstance(ramified_algebras_data, str):
        loc_alg = ''
    else:
        # [label, latex, e, f, c, gal]
        loc_alg = ''
        for j in range(npr):
            if ramified_algebras_data[j] is None:
                loc_alg += '<tr><td>%s<td colspan="7">Data not computed' % str(
                    ram_primes[j])
            else:
                mydat = ramified_algebras_data[j]
                p = ram_primes[j]
                loc_alg += '<tr><td rowspan="%d">$%s$</td>' % (len(mydat),
                                                               str(p))
                mm = mydat[0]
                myurl = url_for('local_fields.by_label', label=mm[0])
                lab = mm[0]
                if mm[3] * mm[2] == 1:
                    lab = r'$\Q_{%s}$' % str(p)
                loc_alg += '<td><a href="%s">%s</a><td>$%s$<td>$%d$<td>$%d$<td>$%d$<td>%s<td>$%s$' % (
                    myurl, lab, mm[1], mm[2], mm[3], mm[4], mm[5],
                    show_slope_content(mm[8], mm[6], mm[7]))
                for mm in mydat[1:]:
                    lab = mm[0]
                    if mm[3] * mm[2] == 1:
                        lab = r'$\Q_{%s}$' % str(p)
                    loc_alg += '<tr><td><a href="%s">%s</a><td>$%s$<td>$%d$<td>$%d$<td>$%d$<td>%s<td>$%s$' % (
                        myurl, lab, mm[1], mm[2], mm[3], mm[4], mm[5],
                        show_slope_content(mm[8], mm[6], mm[7]))
        loc_alg += '</tbody></table>'

    ram_primes = str(ram_primes)[1:-1]
    if ram_primes == '':
        ram_primes = r'\textrm{None}'
    data['phrase'] = group_phrase(n, t)
    zk = nf.zk()
    Ra = PolynomialRing(QQ, 'a')
    zk = [latex(Ra(x)) for x in zk]
    zk = ['$%s$' % x for x in zk]
    zk = ', '.join(zk)
    grh_label = '<small>(<a title="assuming GRH" knowl="nf.assuming_grh">assuming GRH</a>)</small>' if nf.used_grh(
    ) else ''
    # Short version for properties
    grh_lab = nf.short_grh_string()
    if 'Not' in str(data['class_number']):
        grh_lab = ''
        grh_label = ''
    pretty_label = field_pretty(label)
    if label != pretty_label:
        pretty_label = "%s: %s" % (label, pretty_label)

    info.update(data)
    if nf.degree() > 1:
        gpK = nf.gpK()
        rootof1coeff = gpK.nfrootsof1()
        rootofunityorder = int(rootof1coeff[1])
        rootof1coeff = rootof1coeff[2]
        rootofunity = web_latex(
            Ra(
                str(pari("lift(%s)" % gpK.nfbasistoalg(rootof1coeff))).replace(
                    'x', 'a')))
        rootofunity += ' (order $%d$)' % rootofunityorder
    else:
        rootofunity = web_latex(Ra('-1')) + ' (order $2$)'

    info.update({
        'label': pretty_label,
        'label_raw': label,
        'polynomial': web_latex_split_on_pm(nf.poly()),
        'ram_primes': ram_primes,
        'integral_basis': zk,
        'regulator': web_latex(nf.regulator()),
        'unit_rank': nf.unit_rank(),
        'root_of_unity': rootofunity,
        'fund_units': nf.units(),
        'grh_label': grh_label,
        'loc_alg': loc_alg
    })

    bread.append(('%s' % info['label_raw'], ' '))
    info['downloads_visible'] = True
    info['downloads'] = [('worksheet', '/')]
    info['friends'] = []
    if nf.can_class_number():
        # hide ones that take a lond time to compute on the fly
        # note that the first degree 4 number field missed the zero of the zeta function
        if abs(D**n) < 50000000:
            info['friends'].append(('L-function', "/L/NumberField/%s" % label))
    info['friends'].append(('Galois group', "/GaloisGroup/%dT%d" % (n, t)))
    if 'dirichlet_group' in info:
        info['friends'].append(('Dirichlet character group',
                                url_for("characters.dirichlet_group_table",
                                        modulus=int(conductor),
                                        char_number_list=','.join(
                                            [str(a) for a in dirichlet_chars]),
                                        poly=info['polynomial'])))
    resinfo = []
    galois_closure = nf.galois_closure()
    if galois_closure[0] > 0:
        if len(galois_closure[1]) > 0:
            resinfo.append(('gc', galois_closure[1]))
            if len(galois_closure[2]) > 0:
                info['friends'].append(('Galois closure',
                                        url_for(".by_label",
                                                label=galois_closure[2][0])))
        else:
            resinfo.append(('gc', [dnc]))

    sextic_twins = nf.sextic_twin()
    if sextic_twins[0] > 0:
        if len(sextic_twins[1]) > 0:
            resinfo.append(('sex', r' $\times$ '.join(sextic_twins[1])))
        else:
            resinfo.append(('sex', dnc))

    siblings = nf.siblings()
    # [degsib list, label list]
    # first is list of [deg, num expected, list of knowls]
    if len(siblings[0]) > 0:
        for sibdeg in siblings[0]:
            if len(sibdeg[2]) == 0:
                sibdeg[2] = dnc
            else:
                sibdeg[2] = ', '.join(sibdeg[2])
                if len(sibdeg[2]) < sibdeg[1]:
                    sibdeg[2] += ', some ' + dnc

        resinfo.append(('sib', siblings[0]))
        for lab in siblings[1]:
            if lab != '':
                labparts = lab.split('.')
                info['friends'].append(("Degree %s sibling" % labparts[0],
                                        url_for(".by_label", label=lab)))

    arith_equiv = nf.arith_equiv()
    if arith_equiv[0] > 0:
        if len(arith_equiv[1]) > 0:
            resinfo.append(
                ('ae', ', '.join(arith_equiv[1]), len(arith_equiv[1])))
            for aelab in arith_equiv[2]:
                info['friends'].append(('Arithmetically equivalent sibling',
                                        url_for(".by_label", label=aelab)))
        else:
            resinfo.append(('ae', dnc, len(arith_equiv[1])))

    info['resinfo'] = resinfo
    learnmore = learnmore_list()
    #if info['signature'] == [0,1]:
    #    info['learnmore'].append(('Quadratic imaginary class groups', url_for(".render_class_group_data")))
    # With Galois group labels, probably not needed here
    # info['learnmore'] = [('Global number field labels',
    # url_for(".render_labels_page")), ('Galois group
    # labels',url_for(".render_groups_page")),
    # (Completename,url_for(".render_discriminants_page"))]
    title = "Global Number Field %s" % info['label']

    if npr == 1:
        primes = 'prime'
    else:
        primes = 'primes'

    properties2 = [('Label', label), ('Degree', '$%s$' % data['degree']),
                   ('Signature', '$%s$' % data['signature']),
                   ('Discriminant', '$%s$' % data['disc_factor']),
                   ('Ramified ' + primes + '', '$%s$' % ram_primes),
                   ('Class number', '%s %s' % (data['class_number'], grh_lab)),
                   ('Class group',
                    '%s %s' % (data['class_group_invs'], grh_lab)),
                   ('Galois Group', group_display_short(data['degree'], t))]
    downloads = []
    for lang in [["Magma", "magma"], ["SageMath", "sage"], ["Pari/GP", "gp"]]:
        downloads.append(('Download {} code'.format(lang[0]),
                          url_for(".nf_code_download",
                                  nf=label,
                                  download_type=lang[1])))
    from lmfdb.artin_representations.math_classes import NumberFieldGaloisGroup
    try:
        info["tim_number_field"] = NumberFieldGaloisGroup(nf._data['coeffs'])
        v = nf.factor_perm_repn(info["tim_number_field"])

        def dopow(m):
            if m == 0: return ''
            if m == 1: return '*'
            return '*<sup>%d</sup>' % m

        info["mydecomp"] = [dopow(x) for x in v]
    except AttributeError:
        pass
    return render_template("number_field.html",
                           properties2=properties2,
                           credit=NF_credit,
                           title=title,
                           bread=bread,
                           code=nf.code,
                           friends=info.pop('friends'),
                           downloads=downloads,
                           learnmore=learnmore,
                           info=info)
Example #23
0
 def pretty_galois_knowl(self):
     C = getDBConnection()
     return group_display_knowl(self._data["Galois_nt"][0], self._data["Galois_nt"][1], C)
Example #24
0
 def smallest_gal_t_format(self):
     galnt = self.smallest_gal_t()
     if len(galnt)==1:
         return galnt[0]
     C = getDBConnection()
     return group_display_knowl(galnt[0],galnt[1],C)
Example #25
0
def render_field_webpage(args):
    data = None
    info = {}
    if 'label' in args:
        label = clean_input(args['label'])
        C = base.getDBConnection()
        data = C.localfields.fields.find_one({'label': label})
        if data is None:
            bread = get_bread([("Search error", ' ')])
            info['err'] = "Field " + label + " was not found in the database."
            info['label'] = label
            return search_input_error(info, bread)
        title = 'Local Number Field ' + label
        polynomial = coeff_to_poly(data['coeffs'])
        p = data['p']
        e = data['e']
        f = data['f']
        cc = data['c']
        GG = data['gal']
        gn = GG[0]
        gt = GG[1]
        prop2 = [
            ('Label', label),
            ('Base', '\(\Q_{%s}\)' % p),
            ('Degree', '\(%s\)' % data['n']),
            ('e', '\(%s\)' % e),
            ('f', '\(%s\)' % f),
            ('c', '\(%s\)' % cc),
            ('Galois group', group_display_short(gn, gt, C)),
        ]
        Pt = PolynomialRing(QQ, 't')
        Pyt = PolynomialRing(Pt, 'y')
        eisenp = Pyt(str(data['eisen']))
        unramp = Pyt(str(data['unram']))
        # Look up the unram poly so we can link to it
        unramdata = C.localfields.fields.find_one({'p': p, 'n': f, 'c': 0})
        if len(unramdata) > 0:
            unramfriend = "/LocalNumberField/%s" % unramdata['label']
        else:
            logger.fatal("Cannot find unramified field!")
            unramfriend = ''
        rfdata = C.localfields.fields.find_one({
            'p': p,
            'n': {
                '$in': [1, 2]
            },
            'rf': data['rf']
        })
        if rfdata is None:
            logger.fatal("Cannot find discriminant root field!")
            rffriend = ''
        else:
            rffriend = "/LocalNumberField/%s" % rfdata['label']

        info.update({
            'polynomial': web_latex(polynomial),
            'n': data['n'],
            'p': data['p'],
            'c': data['c'],
            'e': data['e'],
            'f': data['f'],
            't': data['t'],
            'u': data['u'],
            'rf': printquad(data['rf'], p),
            'hw': data['hw'],
            'slopes': show_slopes(data['slopes']),
            'gal': group_display_knowl(gn, gt, C),
            'gt': gt,
            'inertia': group_display_inertia(data['inertia'], C),
            'unram': web_latex(unramp),
            'eisen': web_latex(eisenp),
            'gms': data['gms'],
            'aut': data['aut'],
        })
        friends = [('Galois group', "/GaloisGroup/%dT%d" % (gn, gt))]
        if unramfriend != '':
            friends.append(('Unramified subfield', unramfriend))
        if rffriend != '':
            friends.append(('Discriminant root field', rffriend))

        bread = get_bread([(label, ' ')])
        learnmore = [('Completeness of the data',
                      url_for(".completeness_page")),
                     ('Source of the data', url_for(".how_computed_page")),
                     ('Local field labels', url_for(".labels_page"))]
        return render_template("lf-show-field.html",
                               credit=LF_credit,
                               title=title,
                               bread=bread,
                               info=info,
                               properties2=prop2,
                               friends=friends,
                               learnmore=learnmore)
Example #26
0
    def make_passport_object(self, passport):
        from lmfdb.belyi.main import url_for_belyi_galmap_label
        # all information about the map goes in the data dictionary
        # most of the data from the database gets polished/formatted before we put it in the data dictionary
        data = self.data = {}

        for elt in ('plabel', 'abc', 'num_orbits', 'g', 'abc', 'deg', 'maxdegbf'):
            data[elt] = passport[elt]

        nt = passport['group'].split('T')
        data['group'] = group_display_knowl(int(nt[0]),int(nt[1]))

        data['geomtype'] = geomtypelet_to_geomtypename_dict[passport['geomtype']]
        data['lambdas'] = [str(c)[1:-1] for c in passport['lambdas']]
        data['pass_size'] = passport['pass_size']

        # Permutation triples
        galmaps_for_plabel = db.belyi_galmaps.search( {"plabel" : passport['plabel']})#, sort = ['label_index'])
        galmapdata = []
        for galmap in galmaps_for_plabel:
            # wrap number field nonsense
            F = belyi_base_field(galmap)
            # inLMFDB = False;
            field = {};
            if F._data == None:
                field['in_LMFDB'] = False;
                fld_coeffs = galmap['base_field']
                pol = PolynomialRing(QQ, 'x')(fld_coeffs)
                field['base_field'] = latex(pol)
                field['isQQ'] = False;
            else:
                field['in_LMFDB'] = True;
                if F.poly().degree()==1:
                    field['isQQ'] = True
                F.latex_poly = web_latex(F.poly())
                field['base_field'] = F

            galmapdatum = [galmap['label'].split('-')[-1],
                           url_for_belyi_galmap_label(galmap['label']),
                           galmap['orbit_size'],
                           field,
                           galmap['triples_cyc'][0][0],
                           galmap['triples_cyc'][0][1],
                           galmap['triples_cyc'][0][2],
                           ]
            galmapdata.append(galmapdatum)
        data['galmapdata'] = galmapdata

        # Properties
        properties = [('Label', passport['plabel']),
            ('Group', str(passport['group'])),
            ('Orders', str(passport['abc'])), 
            ('Genus', str(passport['g'])),
            ('Size', str(passport['pass_size'])),
            ('Galois orbits', str(passport['num_orbits']))
            ]
        self.properties = properties

        # Friends
        self.friends = []

        # Breadcrumbs

        groupstr, abcstr, sigma0, sigma1, sigmaoo, gstr = data['plabel'].split("-");
        lambdasstr = '%s-%s-%s' % (sigma0, sigma1, sigmaoo);
        lambdasgstr = lambdasstr + "-" + gstr;
        self.bread = [
                ('Belyi Maps', url_for(".index")),
                (groupstr,
                    url_for(".by_url_belyi_search_group",
                        group=groupstr
                        )
                    ),
                (abcstr,
                    url_for(".by_url_belyi_search_group_triple",
                        group=groupstr,
                        abc=abcstr
                        )
                    ),
                (lambdasgstr,
                    url_for(".by_url_belyi_passport_label",
                        group=groupstr,
                        abc=abcstr,
                        sigma0=sigma0,
                        sigma1=sigma1,
                        sigmaoo=sigmaoo,
                        g = gstr )
                    )
                ];

        # Title
        self.title = "Passport " + data['plabel']

        # Code snippets (only for curves)
        self.code = {}
        return
Example #27
0
    def make_galmap_object(self, galmap):
        from lmfdb.belyi.main import url_for_belyi_passport_label

        # all information about the map goes in the data dictionary
        # most of the data from the database gets polished/formatted before we put it in the data dictionary
        data = self.data = {}
        # the stuff that does not need to be polished
        for elt in ('label', 'plabel', 'triples_cyc', 'orbit_size', 'g', 'abc', 'deg'):
            data[elt] = galmap[elt]
        nt = galmap['group'].split('T')
        data['group'] = group_display_knowl(int(nt[0]),int(nt[1]))

        data['geomtype'] = geomtypelet_to_geomtypename_dict[galmap['geomtype']]
        data['lambdas'] = [str(c)[1:-1] for c in galmap['lambdas']]

        data['isQQ'] = False
        data['in_LMFDB'] = False
        F = belyi_base_field(galmap)
        if F._data == None:
            fld_coeffs = galmap['base_field']
            pol = PolynomialRing(QQ, 'x')(fld_coeffs)
            data['base_field'] = latex(pol)
        else:
            data['in_LMFDB'] = True 
            if F.poly().degree()==1:
                data['isQQ'] = True 
            F.latex_poly = web_latex(F.poly())
            data['base_field'] = F
        crv_str = galmap['curve']
        if crv_str=='PP1':
            data['curve'] = '\mathbb{P}^1'
        else:
            data['curve'] = make_curve_latex(crv_str)

        # change pairs of floats to complex numbers
        embeds = galmap['embeddings']
        embed_strs = []
        for el in embeds:
            if el[1] < 0:
                el_str = str(el[0]) + str(el[1]) + "\sqrt{-1}"
            else:
                el_str = str(el[0]) + "+" + str(el[1]) + "\sqrt{-1}"
            embed_strs.append(el_str)

        data['map'] = make_map_latex(galmap['map'])
        data['embeddings_and_triples'] = []
        if data['isQQ']:
            for i in range(0,len(data['triples_cyc'])):
                triple_cyc = data['triples_cyc'][i]
                data['embeddings_and_triples'].append(["\\text{not applicable (over $\mathbb{Q}$)}", triple_cyc[0], triple_cyc[1], triple_cyc[2]])
        else:
            for i in range(0,len(data['triples_cyc'])):
                triple_cyc = data['triples_cyc'][i]
                data['embeddings_and_triples'].append([embed_strs[i], triple_cyc[0], triple_cyc[1], triple_cyc[2]])

        data['lambdas'] = [str(c)[1:-1] for c in galmap['lambdas']]

        # Properties
        properties = [('Label', galmap['label']),
            ('Group', str(galmap['group'])),
            ('Orders', str(galmap['abc'])), 
            ('Genus', str(galmap['g'])),
            ('Size', str(galmap['orbit_size'])),
        ]
        self.properties = properties

        # Friends
        self.friends = [('Passport', url_for_belyi_passport_label(galmap['plabel']))]

        # Breadcrumbs
        groupstr, abcstr, sigma0, sigma1, sigmaoo, gstr, letnum = data['label'].split("-");
        lambdasstr = '%s-%s-%s' % (sigma0, sigma1, sigmaoo);
        lambdasgstr = lambdasstr + "-" + gstr;
        self.bread = [
                ('Belyi Maps', url_for(".index")),
                (groupstr,
                    url_for(".by_url_belyi_search_group",
                        group=groupstr
                        )
                    ),
                (abcstr,
                    url_for(".by_url_belyi_search_group_triple",
                        group=groupstr,
                        abc=abcstr
                        )
                    ),
                (lambdasgstr,
                    url_for(".by_url_belyi_passport_label",
                        group=groupstr,
                        abc=abcstr,
                        sigma0=sigma0,
                        sigma1=sigma1,
                        sigmaoo=sigmaoo,
                        g = gstr )
                    ),
                (letnum,
                    url_for(".by_url_belyi_galmap_label",
                        group=groupstr,
                        abc=abcstr,
                        sigma0=sigma0,
                        sigma1=sigma1,
                        sigmaoo=sigmaoo,
                        g = gstr,
                        letnum = letnum)
                    ),
                ];

        # Title
        self.title = "Belyi map " + data['label']

        # Code snippets (only for curves)
        self.code = {}
        return
Example #28
0
def render_field_webpage(args):
    data = None
    info = {}
    bread = [('Global Number Fields', url_for(".number_field_render_webpage"))]

    # This function should not be called unless label is set.
    label = clean_input(args['label'])
    nf = WebNumberField(label)
    data = {}
    if nf.is_null():
        bread.append(('Search Results', ' '))
        info['err'] = 'There is no field with label %s in the database' % label
        info['label'] = args['label_orig'] if 'label_orig' in args else args['label']
        return search_input_error(info, bread)

    info['wnf'] = nf
    data['degree'] = nf.degree()
    data['class_number'] = nf.class_number_latex()
    ram_primes = nf.ramified_primes()
    t = nf.galois_t()
    n = nf.degree()
    data['is_galois'] = nf.is_galois()
    data['is_abelian'] = nf.is_abelian()
    if nf.is_abelian():
        conductor = nf.conductor()
        data['conductor'] = conductor
        dirichlet_chars = nf.dirichlet_group()
        if len(dirichlet_chars)>0:
            data['dirichlet_group'] = ['<a href = "%s">$\chi_{%s}(%s,&middot;)$</a>' % (url_for('characters.render_Dirichletwebpage',modulus=data['conductor'], number=j), data['conductor'], j) for j in dirichlet_chars]
            data['dirichlet_group'] = r'$\lbrace$' + ', '.join(data['dirichlet_group']) + r'$\rbrace$'
        if data['conductor'].is_prime() or data['conductor'] == 1:
            data['conductor'] = "\(%s\)" % str(data['conductor'])
        else:
            factored_conductor = factor_base_factor(data['conductor'], ram_primes)
            factored_conductor = factor_base_factorization_latex(factored_conductor)
            data['conductor'] = "\(%s=%s\)" % (str(data['conductor']), factored_conductor)
    data['galois_group'] = group_display_knowl(n, t)
    data['cclasses'] = cclasses_display_knowl(n, t)
    data['character_table'] = character_table_display_knowl(n, t)
    data['class_group'] = nf.class_group()
    data['class_group_invs'] = nf.class_group_invariants()
    data['signature'] = nf.signature()
    data['coefficients'] = nf.coeffs()
    nf.make_code_snippets()
    D = nf.disc()
    data['disc_factor'] = nf.disc_factored_latex()
    if D.abs().is_prime() or D == 1:
        data['discriminant'] = "\(%s\)" % str(D)
    else:
        data['discriminant'] = "\(%s=%s\)" % (str(D), data['disc_factor'])
    data['frob_data'], data['seeram'] = frobs(nf)
    # Bad prime information
    npr = len(ram_primes)
    ramified_algebras_data = nf.ramified_algebras_data()
    if isinstance(ramified_algebras_data,str):
        loc_alg = ''
    else:
        # [label, latex, e, f, c, gal]
        loc_alg = ''
        for j in range(npr):
            if ramified_algebras_data[j] is None:
                loc_alg += '<tr><td>%s<td colspan="7">Data not computed'%str(ram_primes[j])
            else:
                mydat = ramified_algebras_data[j]
                p = ram_primes[j]
                loc_alg += '<tr><td rowspan="%d">$%s$</td>'%(len(mydat),str(p))
                mm = mydat[0]
                myurl = url_for('local_fields.by_label', label=mm[0])
                lab = mm[0]
                if mm[3]*mm[2]==1:
                    lab = r'$\Q_{%s}$'%str(p)
                loc_alg += '<td><a href="%s">%s</a><td>$%s$<td>$%d$<td>$%d$<td>$%d$<td>%s<td>$%s$'%(myurl,lab,mm[1],mm[2],mm[3],mm[4],mm[5],show_slope_content(mm[8],mm[6],mm[7]))
                for mm in mydat[1:]:
                    lab = mm[0]
                    if mm[3]*mm[2]==1:
                        lab = r'$\Q_{%s}$'%str(p)
                    loc_alg += '<tr><td><a href="%s">%s</a><td>$%s$<td>$%d$<td>$%d$<td>$%d$<td>%s<td>$%s$'%(myurl,lab,mm[1],mm[2],mm[3],mm[4],mm[5],show_slope_content(mm[8],mm[6],mm[7]))
        loc_alg += '</tbody></table>'

    ram_primes = str(ram_primes)[1:-1]
    if ram_primes == '':
        ram_primes = r'\textrm{None}'
    data['phrase'] = group_phrase(n, t)
    zk = nf.zk()
    Ra = PolynomialRing(QQ, 'a')
    zk = [latex(Ra(x)) for x in zk]
    zk = ['$%s$' % x for x in zk]
    zk = ', '.join(zk)
    grh_label = '<small>(<a title="assuming GRH" knowl="nf.assuming_grh">assuming GRH</a>)</small>' if nf.used_grh() else ''
    # Short version for properties
    grh_lab = nf.short_grh_string()
    if 'Not' in str(data['class_number']):
        grh_lab=''
        grh_label=''
    pretty_label = field_pretty(label)
    if label != pretty_label:
        pretty_label = "%s: %s" % (label, pretty_label)

    info.update(data)
    if nf.degree() > 1:
        gpK = nf.gpK()
        rootof1coeff = gpK.nfrootsof1()
        rootofunityorder = int(rootof1coeff[1])
        rootof1coeff = rootof1coeff[2]
        rootofunity = web_latex(Ra(str(pari("lift(%s)" % gpK.nfbasistoalg(rootof1coeff))).replace('x','a'))) 
        rootofunity += ' (order $%d$)' % rootofunityorder
    else:
        rootofunity = web_latex(Ra('-1'))+ ' (order $2$)'

    info.update({
        'label': pretty_label,
        'label_raw': label,
        'polynomial': web_latex_split_on_pm(nf.poly()),
        'ram_primes': ram_primes,
        'integral_basis': zk,
        'regulator': web_latex(nf.regulator()),
        'unit_rank': nf.unit_rank(),
        'root_of_unity': rootofunity,
        'fund_units': nf.units(),
        'grh_label': grh_label,
        'loc_alg': loc_alg
    })

    bread.append(('%s' % info['label_raw'], ' '))
    info['downloads_visible'] = True
    info['downloads'] = [('worksheet', '/')]
    info['friends'] = []
    if nf.can_class_number():
        # hide ones that take a lond time to compute on the fly
        # note that the first degree 4 number field missed the zero of the zeta function
        if abs(D**n) < 50000000:
            info['friends'].append(('L-function', "/L/NumberField/%s" % label))
    info['friends'].append(('Galois group', "/GaloisGroup/%dT%d" % (n, t)))
    if 'dirichlet_group' in info:
        info['friends'].append(('Dirichlet character group', url_for("characters.dirichlet_group_table",
                                                           modulus=int(conductor),
                                                           char_number_list=','.join(
                                                               [str(a) for a in dirichlet_chars]),
                                                           poly=info['polynomial'])))
    resinfo=[]
    galois_closure = nf.galois_closure()
    if galois_closure[0]>0:
        if len(galois_closure[1])>0:
            resinfo.append(('gc', galois_closure[1]))
            if len(galois_closure[2]) > 0:
                info['friends'].append(('Galois closure',url_for(".by_label", label=galois_closure[2][0])))
        else:
            resinfo.append(('gc', [dnc]))

    sextic_twins = nf.sextic_twin()
    if sextic_twins[0]>0:
        if len(sextic_twins[1])>0:
            resinfo.append(('sex', r' $\times$ '.join(sextic_twins[1])))
        else:
            resinfo.append(('sex', dnc))

    siblings = nf.siblings()
    # [degsib list, label list]
    # first is list of [deg, num expected, list of knowls]
    if len(siblings[0])>0:
        for sibdeg in siblings[0]:
            if len(sibdeg[2]) ==0:
                sibdeg[2] = dnc
            else:
                sibdeg[2] = ', '.join(sibdeg[2])
                if len(sibdeg[2])<sibdeg[1]:
                    sibdeg[2] += ', some '+dnc
                
        resinfo.append(('sib', siblings[0]))
        for lab in siblings[1]:
            if lab != '':
                labparts = lab.split('.')
                info['friends'].append(("Degree %s sibling"%labparts[0] ,url_for(".by_label", label=lab)))

    arith_equiv = nf.arith_equiv()
    if arith_equiv[0]>0:
        if len(arith_equiv[1])>0:
            resinfo.append(('ae', ', '.join(arith_equiv[1]), len(arith_equiv[1])))
            for aelab in arith_equiv[2]:
                info['friends'].append(('Arithmetically equivalent sibling',url_for(".by_label", label=aelab)))
        else:
            resinfo.append(('ae', dnc, len(arith_equiv[1])))

    info['resinfo'] = resinfo
    learnmore = learnmore_list()
    #if info['signature'] == [0,1]:
    #    info['learnmore'].append(('Quadratic imaginary class groups', url_for(".render_class_group_data")))
    # With Galois group labels, probably not needed here
    # info['learnmore'] = [('Global number field labels',
    # url_for(".render_labels_page")), ('Galois group
    # labels',url_for(".render_groups_page")),
    # (Completename,url_for(".render_discriminants_page"))]
    title = "Global Number Field %s" % info['label']

    if npr == 1:
        primes = 'prime'
    else:
        primes = 'primes'

    properties2 = [('Label', label),
                   ('Degree', '$%s$' % data['degree']),
                   ('Signature', '$%s$' % data['signature']),
                   ('Discriminant', '$%s$' % data['disc_factor']),
                   ('Ramified ' + primes + '', '$%s$' % ram_primes),
                   ('Class number', '%s %s' % (data['class_number'], grh_lab)),
                   ('Class group', '%s %s' % (data['class_group_invs'], grh_lab)),
                   ('Galois Group', group_display_short(data['degree'], t))
                   ]
    downloads = []
    for lang in [["Magma","magma"], ["SageMath","sage"], ["Pari/GP", "gp"]]:
        downloads.append(('Download {} code'.format(lang[0]),
                          url_for(".nf_code_download", nf=label, download_type=lang[1])))
    from lmfdb.artin_representations.math_classes import NumberFieldGaloisGroup
    try:
        info["tim_number_field"] = NumberFieldGaloisGroup(nf._data['coeffs'])
        v = nf.factor_perm_repn(info["tim_number_field"])
        def dopow(m):
            if m==0: return ''
            if m==1: return '*'
            return '*<sup>%d</sup>'% m

        info["mydecomp"] = [dopow(x) for x in v]
    except AttributeError:
        pass
    return render_template("number_field.html", properties2=properties2, credit=NF_credit, title=title, bread=bread, code=nf.code, friends=info.pop('friends'), downloads=downloads, learnmore=learnmore, info=info)
Example #29
0
    def make_passport_object(self, passport):
        from lmfdb.belyi.main import url_for_belyi_galmap_label
        # all information about the map goes in the data dictionary
        # most of the data from the database gets polished/formatted before we put it in the data dictionary
        data = self.data = {}

        for elt in ('plabel', 'abc', 'num_orbits', 'g', 'abc', 'deg',
                    'maxdegbf'):
            data[elt] = passport[elt]

        nt = passport['group'].split('T')
        data['group'] = group_display_knowl(int(nt[0]), int(nt[1]),
                                            getDBConnection())

        data['geomtype'] = geomtypelet_to_geomtypename_dict[
            passport['geomtype']]
        data['lambdas'] = [str(c)[1:-1] for c in passport['lambdas']]
        data['pass_size'] = passport['pass_size']

        # Permutation triples
        galmaps_for_plabel = belyi_db_galmaps().find({
            "plabel":
            passport['plabel']
        }).sort([('label_index', ASCENDING)])
        galmapdata = []
        for galmap in galmaps_for_plabel:
            # wrap number field nonsense
            F = belyi_base_field(galmap)
            # inLMFDB = False;
            field = {}
            if F._data == None:
                field['in_LMFDB'] = False
                fld_coeffs = galmap['base_field']
                pol = PolynomialRing(QQ, 'x')(fld_coeffs)
                field['base_field'] = latex(pol)
                field['isQQ'] = False
            else:
                field['in_LMFDB'] = True
                if F.poly().degree() == 1:
                    field['isQQ'] = True
                F.latex_poly = web_latex(F.poly())
                field['base_field'] = F

            galmapdatum = [
                galmap['label'].split('-')[-1],
                url_for_belyi_galmap_label(galmap['label']),
                galmap['orbit_size'],
                field,
                galmap['triples_cyc'][0][0],
                galmap['triples_cyc'][0][1],
                galmap['triples_cyc'][0][2],
            ]
            galmapdata.append(galmapdatum)
        data['galmapdata'] = galmapdata

        # Properties
        properties = [('Label', passport['plabel']),
                      ('Group', str(passport['group'])),
                      ('Orders', str(passport['abc'])),
                      ('Genus', str(passport['g'])),
                      ('Size', str(passport['pass_size'])),
                      ('Galois orbits', str(passport['num_orbits']))]
        self.properties = properties

        # Friends
        self.friends = []

        # Breadcrumbs

        groupstr, abcstr, sigma0, sigma1, sigmaoo, gstr = data['plabel'].split(
            "-")
        lambdasstr = '%s-%s-%s' % (sigma0, sigma1, sigmaoo)
        lambdasgstr = lambdasstr + "-" + gstr
        self.bread = [('Belyi Maps', url_for(".index")),
                      (groupstr,
                       url_for(".by_url_belyi_search_group", group=groupstr)),
                      (abcstr,
                       url_for(".by_url_belyi_search_group_triple",
                               group=groupstr,
                               abc=abcstr)),
                      (lambdasgstr,
                       url_for(".by_url_belyi_passport_label",
                               group=groupstr,
                               abc=abcstr,
                               sigma0=sigma0,
                               sigma1=sigma1,
                               sigmaoo=sigmaoo,
                               g=gstr))]

        # Title
        self.title = "Passport " + data['plabel']

        # Code snippets (only for curves)
        self.code = {}
        return
Example #30
0
def lfuncEPhtml(L, fmt):
    """ Euler product as a formula and a table of local factors.
    """
    texform_gen = "\[L(s) = "  # "\[L(A,s) = "
    texform_gen += "\prod_{p \\text{ prime}} F_p(p^{-s})^{-1} \]\n"

    pfactors = prime_divisors(L.level)
    if len(pfactors) == 1:  #i.e., the conductor is prime
        pgoodset = "$p \\neq " + str(pfactors[0]) + "$"
        pbadset = "$p = " + str(pfactors[0]) + "$"
    else:
        badset = "\\{" + str(pfactors[0])
        for j in range(1, len(pfactors)):
            badset += ",\\;"
            badset += str(pfactors[j])
        badset += "\\}"
        pgoodset = "$p \\notin " + badset + "$"
        pbadset = "$p \\in " + badset + "$"

    ans = ""
    ans += texform_gen + "where, for " + pgoodset + ",\n"
    if L.degree == 4 and L.motivic_weight == 1:
        ans += "\[F_p(T) = 1 - a_p T + b_p T^2 -  a_p p T^3 + p^2 T^4 \]"
        ans += "with $b_p = a_p^2 - a_{p^2}$. "
    elif L.degree == 2 and L.motivic_weight == 1:
        ans += "\[F_p(T) = 1 - a_p T + p T^2 .\]"
    else:
        ans += "\(F_p\) is a polynomial of degree " + str(L.degree) + ". "
    ans += "If " + pbadset + ", then $F_p$ is a polynomial of degree at most "
    ans += str(L.degree - 1) + ". "
    bad_primes = []
    for lf in L.bad_lfactors:
        bad_primes.append(lf[0])
    eulerlim = 25
    good_primes = []
    for j in range(0, eulerlim):
        this_prime = Primes().unrank(j)
        if this_prime not in bad_primes:
            good_primes.append(this_prime)
    eptable = "<table id='eptable' class='ntdata euler'>\n"
    eptable += "<thead>"
    eptable += "<tr class='space'><th class='weight'></th><th class='weight'>$p$</th><th class='weight'>$F_p$</th>"
    if L.degree > 2:
        eptable += "<th class='weight galois'>$\Gal(F_p)$</th>"
    eptable += "</tr>\n"
    eptable += "</thead>"
    goodorbad = "bad"
    for lf in L.bad_lfactors:
        try:
            thispolygal = list_to_factored_poly_otherorder(lf[1], galois=True)
            eptable += ("<tr><td>" + goodorbad + "</td><td>" + str(lf[0]) +
                        "</td><td>" + "$" + thispolygal[0] + "$" + "</td>")
            if L.degree > 2:
                eptable += "<td class='galois'>"
                this_gal_group = thispolygal[1]
                if this_gal_group[0] == [0, 0]:
                    pass  # do nothing, because the local faco is 1
                elif this_gal_group[0] == [1, 1]:
                    eptable += group_display_knowl(this_gal_group[0][0],
                                                   this_gal_group[0][1],
                                                   '$C_1$')
                else:
                    eptable += group_display_knowl(this_gal_group[0][0],
                                                   this_gal_group[0][1])
                for j in range(1, len(thispolygal[1])):
                    eptable += "$\\times$"
                    eptable += group_display_knowl(this_gal_group[j][0],
                                                   this_gal_group[j][1])
                eptable += "</td>"
            eptable += "</tr>\n"

        except IndexError:
            eptable += "<tr><td></td><td>" + str(
                j) + "</td><td>" + "not available" + "</td></tr>\n"
        goodorbad = ""
    goodorbad = "good"
    firsttime = " class='first'"
    good_primes1 = good_primes[:9]
    good_primes2 = good_primes[9:]
    for j in good_primes1:
        this_prime_index = prime_pi(j) - 1
        thispolygal = list_to_factored_poly_otherorder(
            L.localfactors[this_prime_index], galois=True)
        eptable += ("<tr" + firsttime + "><td>" + goodorbad + "</td><td>" +
                    str(j) + "</td><td>" + "$" + thispolygal[0] + "$" +
                    "</td>")
        if L.degree > 2:
            eptable += "<td class='galois'>"
            this_gal_group = thispolygal[1]
            eptable += group_display_knowl(this_gal_group[0][0],
                                           this_gal_group[0][1])
            for j in range(1, len(thispolygal[1])):
                eptable += "$\\times$"
                eptable += group_display_knowl(this_gal_group[j][0],
                                               this_gal_group[j][1])
            eptable += "</td>"
        eptable += "</tr>\n"

        #        eptable += "<td>" + group_display_knowl(4,1) + "</td>"
        #        eptable += "</tr>\n"
        goodorbad = ""
        firsttime = ""
    firsttime = " id='moreep'"
    for j in good_primes2:
        this_prime_index = prime_pi(j) - 1
        thispolygal = list_to_factored_poly_otherorder(
            L.localfactors[this_prime_index], galois=True)
        eptable += ("<tr" + firsttime + " class='more nodisplay'" + "><td>" +
                    goodorbad + "</td><td>" + str(j) + "</td><td>" + "$" +
                    list_to_factored_poly_otherorder(
                        L.localfactors[this_prime_index], galois=True)[0] +
                    "$" + "</td>")
        if L.degree > 2:
            this_gal_group = thispolygal[1]
            eptable += "<td class='galois'>"
            eptable += group_display_knowl(this_gal_group[0][0],
                                           this_gal_group[0][1])
            for j in range(1, len(thispolygal[1])):
                eptable += "$\\times$"
                eptable += group_display_knowl(this_gal_group[j][0],
                                               this_gal_group[j][1])
            eptable += "</td>"

        eptable += "</tr>\n"
        firsttime = ""

    eptable += "<tr class='less toggle'><td></td><td></td><td> <a onclick='"
    eptable += 'show_moreless("more"); return true' + "'"
    eptable += ' href="#moreep" '
    eptable += ">show more</a></td></tr>\n"
    eptable += "<tr class='more toggle nodisplay'><td></td><td></td><td> <a onclick='"
    eptable += 'show_moreless("less"); return true' + "'"
    eptable += ' href="#eptable" '
    eptable += ">show less</a></td></tr>\n"
    eptable += "</table>\n"
    ans += "\n" + eptable
    return (ans)
Example #31
0
def render_field_webpage(args):
    data = None
    info = {}
    if 'label' in args:
        label = clean_input(args['label'])
        data = db.lf_fields.lookup(label)
        if data is None:
            bread = get_bread([("Search Error", ' ')])
            info['err'] = "Field " + label + " was not found in the database."
            info['label'] = label
            return search_input_error(info, bread)
        title = 'Local Number Field ' + prettyname(data)
        polynomial = coeff_to_poly(data['coeffs'])
        p = data['p']
        Qp = r'\Q_{%d}' % p
        e = data['e']
        f = data['f']
        cc = data['c']
        gt = data['gal']
        gn = data['n']
        the_gal = WebGaloisGroup.from_nt(gn,gt)
        isgal = ' Galois' if the_gal.order() == gn else ' not Galois'
        abelian = ' and abelian' if the_gal.is_abelian() else ''
        galphrase = 'This field is'+isgal+abelian+' over $\Q_{%d}$.'%p
        autstring = r'\Gal' if the_gal.order() == gn else r'\Aut'
        prop2 = [
            ('Label', label),
            ('Base', '\(%s\)' % Qp),
            ('Degree', '\(%s\)' % data['n']),
            ('e', '\(%s\)' % e),
            ('f', '\(%s\)' % f),
            ('c', '\(%s\)' % cc),
            ('Galois group', group_display_short(gn, gt)),
        ]
        # Look up the unram poly so we can link to it
        unramlabel = db.lf_fields.lucky({'p': p, 'n': f, 'c': 0}, projection=0)
        if unramlabel is None:
            logger.fatal("Cannot find unramified field!")
            unramfriend = ''
        else:
            unramfriend = "/LocalNumberField/%s" % unramlabel
            unramdata = db.lf_fields.lookup(unramlabel)

        Px = PolynomialRing(QQ, 'x')
        Pxt=PolynomialRing(Px,'t')
        Pt = PolynomialRing(QQ, 't')
        Ptx = PolynomialRing(Pt, 'x')
        if data['f'] == 1:
            unramp = r'$%s$' % Qp
            # Eliminate t from the eisenstein polynomial
            eisenp = Pxt(str(data['eisen']).replace('y','x'))
            eisenp = Pt(str(data['unram'])).resultant(eisenp)
            eisenp = web_latex(eisenp)

        else:
            unramp = data['unram'].replace('t','x')
            unramp = web_latex(Px(str(unramp)))
            unramp = prettyname(unramdata)+' $\\cong '+Qp+'(t)$ where $t$ is a root of '+unramp
            eisenp = Ptx(str(data['eisen']).replace('y','x'))
            eisenp = '$'+web_latex(eisenp, False)+'\\in'+Qp+'(t)[x]$'


        rflabel = db.lf_fields.lucky({'p': p, 'n': {'$in': [1, 2]}, 'rf': data['rf']}, projection=0)
        if rflabel is None:
            logger.fatal("Cannot find discriminant root field!")
            rffriend = ''
        else:
            rffriend = "/LocalNumberField/%s" % rflabel
        gsm = data['gsm']
        if gsm == [0]:
            gsm = 'Not computed'
        elif gsm == [-1]:
            gsm = 'Does not exist'
        else:
            gsm = web_latex(coeff_to_poly(gsm))


        info.update({
                    'polynomial': web_latex(polynomial),
                    'n': data['n'],
                    'p': p,
                    'c': data['c'],
                    'e': data['e'],
                    'f': data['f'],
                    't': data['t'],
                    'u': data['u'],
                    'rf': lf_display_knowl( rflabel, name=printquad(data['rf'], p)),
                    'base': lf_display_knowl(str(p)+'.1.0.1', name='$%s$'%Qp),
                    'hw': data['hw'],
                    'slopes': show_slopes(data['slopes']),
                    'gal': group_display_knowl(gn, gt),
                    'gt': gt,
                    'inertia': group_display_inertia(data['inertia']),
                    'unram': unramp,
                    'eisen': eisenp,
                    'gms': data['gms'],
                    'gsm': gsm,
                    'galphrase': galphrase,
                    'autstring': autstring,
                    'subfields': format_subfields(data['subfields'],p),
                    'aut': data['aut'],
                    })
        friends = [('Galois group', "/GaloisGroup/%dT%d" % (gn, gt))]
        if unramfriend != '':
            friends.append(('Unramified subfield', unramfriend))
        if rffriend != '':
            friends.append(('Discriminant root field', rffriend))

        bread = get_bread([(label, ' ')])
        learnmore = [('Completeness of the data', url_for(".completeness_page")),
                ('Source of the data', url_for(".how_computed_page")),
                ('Local field labels', url_for(".labels_page"))]
        return render_template("lf-show-field.html", credit=LF_credit, title=title, bread=bread, info=info, properties2=prop2, friends=friends, learnmore=learnmore)
Example #32
0
 def pretty_galois_knowl(self):
     return group_display_knowl(self._data['Galn'],self._data['Galt'])
Example #33
0
    def make_object(self, curve, endo, tama, ratpts, is_curve):
        from lmfdb.genus2_curves.main import url_for_curve_label

        # all information about the curve, its Jacobian, isogeny class, and endomorphisms goes in the data dictionary
        # most of the data from the database gets polished/formatted before we put it in the data dictionary
        data = self.data = {}

        data['label'] = curve['label'] if is_curve else curve['class']
        data['slabel'] = data['label'].split('.')

        # set attributes common to curves and isogeny classes here
        data['Lhash'] = str(curve['Lhash'])
        data['cond'] = ZZ(curve['cond'])
        data['cond_factor_latex'] = web_latex(factor(int(data['cond'])))
        data['analytic_rank'] = ZZ(curve['analytic_rank'])
        data['st_group'] = curve['st_group']
        data['st_group_link'] = st_link_by_name(1, 4, data['st_group'])
        data['st0_group_name'] = st0_group_name(curve['real_geom_end_alg'])
        data['is_gl2_type'] = curve['is_gl2_type']
        data['root_number'] = ZZ(curve['root_number'])
        data['lfunc_url'] = url_for("l_functions.l_function_genus2_page",
                                    cond=data['slabel'][0],
                                    x=data['slabel'][1])
        data['bad_lfactors'] = literal_eval(curve['bad_lfactors'])
        data['bad_lfactors_pretty'] = [(c[0],
                                        list_to_factored_poly_otherorder(c[1]))
                                       for c in data['bad_lfactors']]

        if is_curve:
            # invariants specific to curve
            data['class'] = curve['class']
            data['abs_disc'] = ZZ(curve['abs_disc'])
            data['disc'] = curve['disc_sign'] * data['abs_disc']
            data['min_eqn'] = literal_eval(curve['eqn'])
            data['min_eqn_display'] = list_to_min_eqn(data['min_eqn'])
            data['disc_factor_latex'] = web_latex(factor(data['disc']))
            data['igusa_clebsch'] = [
                ZZ(a) for a in literal_eval(curve['igusa_clebsch_inv'])
            ]
            data['igusa'] = [ZZ(a) for a in literal_eval(curve['igusa_inv'])]
            data['g2'] = [QQ(a) for a in literal_eval(curve['g2_inv'])]
            data['igusa_clebsch_factor_latex'] = [
                web_latex(zfactor(i)) for i in data['igusa_clebsch']
            ]
            data['igusa_factor_latex'] = [
                web_latex(zfactor(j)) for j in data['igusa']
            ]
            data['aut_grp_id'] = curve['aut_grp_id']
            data['geom_aut_grp_id'] = curve['geom_aut_grp_id']
            data['num_rat_wpts'] = ZZ(curve['num_rat_wpts'])
            data['two_selmer_rank'] = ZZ(curve['two_selmer_rank'])
            data['has_square_sha'] = "square" if curve[
                'has_square_sha'] else "twice a square"
            P = curve['non_solvable_places']
            if len(P):
                sz = "except over "
                sz += ", ".join([QpName(p) for p in P])
                last = " and"
                if len(P) > 2:
                    last = ", and"
                sz = last.join(sz.rsplit(",", 1))
            else:
                sz = "everywhere"
            data['non_solvable_places'] = sz
            data['torsion_order'] = curve['torsion_order']
            data['torsion_factors'] = [
                ZZ(a) for a in literal_eval(curve['torsion_subgroup'])
            ]
            if len(data['torsion_factors']) == 0:
                data['torsion_subgroup'] = '\mathrm{trivial}'
            else:
                data['torsion_subgroup'] = ' \\times '.join(
                    ['\Z/{%s}\Z' % n for n in data['torsion_factors']])
            data['end_ring_base'] = endo['ring_base']
            data['end_ring_geom'] = endo['ring_geom']
            data['tama'] = ''
            for item in tama:
                if item['tamagawa_number'] > 0:
                    tamgwnr = str(item['tamagawa_number'])
                else:
                    tamgwnr = 'N/A'
                data['tama'] += tamgwnr + ' (p = ' + str(item['p']) + '), '
            data['tama'] = data['tama'][:-2]  # trim last ", "
            if ratpts:
                if len(ratpts['rat_pts']):
                    data['rat_pts'] = ',  '.join(
                        web_latex('(' + ' : '.join(map(str, P)) + ')')
                        for P in ratpts['rat_pts'])
                data['rat_pts_v'] = 2 if ratpts['rat_pts_v'] else 1
                # data['mw_rank'] = ratpts['mw_rank']
                # data['mw_rank_v'] = ratpts['mw_rank_v']
            else:
                data['rat_pts_v'] = 0
            if curve['two_torsion_field'][0]:
                data['two_torsion_field_knowl'] = nf_display_knowl(
                    curve['two_torsion_field'][0],
                    field_pretty(curve['two_torsion_field'][0]))
            else:
                t = curve['two_torsion_field']
                data[
                    'two_torsion_field_knowl'] = """splitting field of \(%s\) with Galois group %s""" % (
                        intlist_to_poly(
                            t[1]), group_display_knowl(t[2][0], t[2][1]))
        else:
            # invariants specific to isogeny class
            curves_data = list(
                db.g2c_curves.search({"class": curve['class']},
                                     ['label', 'eqn']))
            if not curves_data:
                raise KeyError(
                    "No curves found in database for isogeny class %s of genus 2 curve %s."
                    % (curve['class'], curve['label']))
            data['curves'] = [{
                "label":
                c['label'],
                "equation_formatted":
                list_to_min_eqn(literal_eval(c['eqn'])),
                "url":
                url_for_curve_label(c['label'])
            } for c in curves_data]
            lfunc_data = db.lfunc_lfunctions.lucky(
                {'Lhash': str(curve['Lhash'])})
            if not lfunc_data:
                raise KeyError(
                    "No Lfunction found in database for isogeny class of genus 2 curve %s."
                    % curve['label'])
            if lfunc_data and lfunc_data.get('euler_factors'):
                data['good_lfactors'] = [
                    [nth_prime(n + 1), lfunc_data['euler_factors'][n]]
                    for n in range(len(lfunc_data['euler_factors']))
                    if nth_prime(n + 1) < 30 and (data['cond'] %
                                                  nth_prime(n + 1))
                ]
                data['good_lfactors_pretty'] = [
                    (c[0], list_to_factored_poly_otherorder(c[1]))
                    for c in data['good_lfactors']
                ]
        # Endomorphism data over QQ:
        data['gl2_statement_base'] = gl2_statement_base(
            endo['factorsRR_base'], r'\(\Q\)')
        data['factorsQQ_base'] = endo['factorsQQ_base']
        data['factorsRR_base'] = endo['factorsRR_base']
        data['end_statement_base'] = """Endomorphism %s over \(\Q\):<br>""" %("ring" if is_curve else "algebra") + \
            end_statement(data['factorsQQ_base'], endo['factorsRR_base'], ring=data['end_ring_base'] if is_curve else None)

        # Field over which all endomorphisms are defined
        data['end_field_label'] = endo['fod_label']
        data['end_field_poly'] = intlist_to_poly(endo['fod_coeffs'])
        data['end_field_statement'] = end_field_statement(
            data['end_field_label'], data['end_field_poly'])

        # Endomorphism data over QQbar:
        data['factorsQQ_geom'] = endo['factorsQQ_geom']
        data['factorsRR_geom'] = endo['factorsRR_geom']
        if data['end_field_label'] != '1.1.1.1':
            data['gl2_statement_geom'] = gl2_statement_base(
                data['factorsRR_geom'], r'\(\overline{\Q}\)')
            data['end_statement_geom'] = """Endomorphism %s over \(\overline{\Q}\):""" %("ring" if is_curve else "algebra") + \
                end_statement(data['factorsQQ_geom'], data['factorsRR_geom'], field=r'\overline{\Q}', ring=data['end_ring_geom'] if is_curve else None)
        data['real_geom_end_alg_name'] = end_alg_name(
            curve['real_geom_end_alg'])

        # Endomorphism data over intermediate fields not already treated (only for curves, not necessarily isogeny invariant):
        if is_curve:
            data['end_lattice'] = (endo['lattice'])[1:-1]
            if data['end_lattice']:
                data['end_lattice_statement'] = end_lattice_statement(
                    data['end_lattice'])

        # Field over which the Jacobian decomposes (base field if Jacobian is geometrically simple)
        data['is_simple_geom'] = endo['is_simple_geom']
        data['split_field_label'] = endo['spl_fod_label']
        data['split_field_poly'] = intlist_to_poly(endo['spl_fod_coeffs'])
        data['split_field_statement'] = split_field_statement(
            data['is_simple_geom'], data['split_field_label'],
            data['split_field_poly'])

        # Elliptic curve factors for non-simple Jacobians
        if not data['is_simple_geom']:
            data['split_coeffs'] = endo['spl_facs_coeffs']
            if 'spl_facs_labels' in endo and len(
                    endo['spl_facs_labels']) == len(endo['spl_facs_coeffs']):
                data['split_labels'] = endo['spl_facs_labels']
            data['split_condnorms'] = endo['spl_facs_condnorms']
            data['split_statement'] = split_statement(data['split_coeffs'],
                                                      data.get('split_labels'),
                                                      data['split_condnorms'])

        # Properties
        self.properties = properties = [('Label', data['label'])]
        if is_curve:
            self.plot = encode_plot(
                eqn_list_to_curve_plot(
                    data['min_eqn'],
                    data['rat_pts'].split(',') if 'rat_pts' in data else []))
            plot_link = '<a href="{0}"><img src="{0}" width="200" height="150"/></a>'.format(
                self.plot)

            properties += [
                (None, plot_link),
                ('Conductor', str(data['cond'])),
                ('Discriminant', str(data['disc'])),
            ]
        properties += [
            ('Sato-Tate group', data['st_group_link']),
            ('\(\\End(J_{\\overline{\\Q}}) \\otimes \\R\)',
             '\(%s\)' % data['real_geom_end_alg_name']),
            ('\(\\overline{\\Q}\)-simple',
             bool_pretty(data['is_simple_geom'])),
            ('\(\mathrm{GL}_2\)-type', bool_pretty(data['is_gl2_type'])),
        ]

        # Friends
        self.friends = friends = [('L-function', data['lfunc_url'])]
        if is_curve:
            friends.append(('Isogeny class %s.%s' %
                            (data['slabel'][0], data['slabel'][1]),
                            url_for(".by_url_isogeny_class_label",
                                    cond=data['slabel'][0],
                                    alpha=data['slabel'][1])))
        for friend_url in db.lfunc_instances.search({'Lhash': data['Lhash']},
                                                    'url'):
            if '|' in friend_url:
                for url in friend_url.split('|'):
                    add_friend(friends, lfunction_friend_from_url(url))
            else:
                add_friend(friends, lfunction_friend_from_url(friend_url))
        if 'split_labels' in data:
            for friend_label in data['split_labels']:
                if is_curve:
                    add_friend(friends, ("Elliptic curve " + friend_label,
                                         url_for_ec(friend_label)))
                else:
                    add_friend(
                        friends,
                        ("EC isogeny class " + ec_label_class(friend_label),
                         url_for_ec_class(friend_label)))
        if is_curve:
            friends.append(('Twists',
                            url_for(".index_Q",
                                    g20=str(data['g2'][0]),
                                    g21=str(data['g2'][1]),
                                    g22=str(data['g2'][2]))))

        # Breadcrumbs
        self.bread = bread = [('Genus 2 Curves', url_for(".index")),
                              ('$\Q$', url_for(".index_Q")),
                              ('%s' % data['slabel'][0],
                               url_for(".by_conductor",
                                       cond=data['slabel'][0])),
                              ('%s' % data['slabel'][1],
                               url_for(".by_url_isogeny_class_label",
                                       cond=data['slabel'][0],
                                       alpha=data['slabel'][1]))]
        if is_curve:
            bread += [('%s' % data['slabel'][2],
                       url_for(".by_url_isogeny_class_discriminant",
                               cond=data['slabel'][0],
                               alpha=data['slabel'][1],
                               disc=data['slabel'][2])),
                      ('%s' % data['slabel'][3],
                       url_for(".by_url_curve_label",
                               cond=data['slabel'][0],
                               alpha=data['slabel'][1],
                               disc=data['slabel'][2],
                               num=data['slabel'][3]))]

        # Title
        self.title = "Genus 2 " + ("Curve " if is_curve else
                                   "Isogeny Class ") + data['label']

        # Code snippets (only for curves)
        if not is_curve:
            return
        self.code = code = {}
        code['show'] = {'sage': '', 'magma': ''}  # use default show names
        code['curve'] = {
            'sage':
            'R.<x> = PolynomialRing(QQ); C = HyperellipticCurve(R(%s), R(%s))'
            % (data['min_eqn'][0], data['min_eqn'][1]),
            'magma':
            'R<x> := PolynomialRing(Rationals()); C := HyperellipticCurve(R!%s, R!%s);'
            % (data['min_eqn'][0], data['min_eqn'][1])
        }
        if data['abs_disc'] % 4096 == 0:
            ind2 = [a[0] for a in data['bad_lfactors']].index(2)
            bad2 = data['bad_lfactors'][ind2][1]
            magma_cond_option = ': ExcFactors:=[*<2,Valuation(' + str(
                data['cond']) + ',2),R!' + str(bad2) + '>*]'
        else:
            magma_cond_option = ''
        code['cond'] = {
            'magma':
            'Conductor(LSeries(C%s)); Factorization($1);' % magma_cond_option
        }
        code['disc'] = {
            'magma': 'Discriminant(C); Factorization(Integers()!$1);'
        }
        code['igusa_clebsch'] = {
            'sage':
            'C.igusa_clebsch_invariants(); [factor(a) for a in _]',
            'magma':
            'IgusaClebschInvariants(C); [Factorization(Integers()!a): a in $1];'
        }
        code['igusa'] = {
            'magma':
            'IgusaInvariants(C); [Factorization(Integers()!a): a in $1];'
        }
        code['g2'] = {'magma': 'G2Invariants(C);'}
        code['aut'] = {'magma': 'AutomorphismGroup(C); IdentifyGroup($1);'}
        code['autQbar'] = {
            'magma':
            'AutomorphismGroup(ChangeRing(C,AlgebraicClosure(Rationals()))); IdentifyGroup($1);'
        }
        code['num_rat_wpts'] = {
            'magma': '#Roots(HyperellipticPolynomials(SimplifiedModel(C)));'
        }
        if ratpts:
            code['rat_pts'] = {
                'magma':
                '[' + ','.join([
                    "C![%s,%s,%s]" % (p[0], p[1], p[2])
                    for p in ratpts['rat_pts']
                ]) + '];'
            }
        code['two_selmer'] = {
            'magma': 'TwoSelmerGroup(Jacobian(C)); NumberOfGenerators($1);'
        }
        code['has_square_sha'] = {'magma': 'HasSquareSha(Jacobian(C));'}
        code['locally_solvable'] = {
            'magma':
            'f,h:=HyperellipticPolynomials(C); g:=4*f+h^2; HasPointsEverywhereLocally(g,2) and (#Roots(ChangeRing(g,RealField())) gt 0 or LeadingCoefficient(g) gt 0);'
        }
        code['torsion_subgroup'] = {
            'magma':
            'TorsionSubgroup(Jacobian(SimplifiedModel(C))); AbelianInvariants($1);'
        }
Example #34
0
def render_field_webpage(args):
    data = None
    C = base.getDBConnection()
    info = {}
    bread = [('Global Number Fields', url_for(".number_field_render_webpage"))]

    # This function should not be called unless label is set.
    label = clean_input(args['label'])
    nf = WebNumberField(label)
    data = {}
    if nf.is_null():
        bread.append(('Search results', ' '))
        info['err'] = 'There is no field with label %s in the database' % label
        info['label'] = args['label_orig'] if 'label_orig' in args else args['label']
        return search_input_error(info, bread)

    info['wnf'] = nf
    data['degree'] = nf.degree()
    data['class_number'] = nf.class_number()
    t = nf.galois_t()
    n = nf.degree()
    data['is_galois'] = nf.is_galois()
    data['is_abelian'] = nf.is_abelian()
    if nf.is_abelian():
        conductor = nf.conductor()
        data['conductor'] = conductor
        dirichlet_chars = nf.dirichlet_group()
        if len(dirichlet_chars)>0:
            data['dirichlet_group'] = ['<a href = "%s">$\chi_{%s}(%s,&middot;)$</a>' % (url_for('characters.render_Dirichletwebpage',modulus=data['conductor'], number=j), data['conductor'], j) for j in dirichlet_chars]
            data['dirichlet_group'] = r'$\lbrace$' + ', '.join(data['dirichlet_group']) + r'$\rbrace$'
        if data['conductor'].is_prime() or data['conductor'] == 1:
            data['conductor'] = "\(%s\)" % str(data['conductor'])
        else:
            data['conductor'] = "\(%s=%s\)" % (str(data['conductor']), latex(data['conductor'].factor()))
    data['galois_group'] = group_display_knowl(n, t, C)
    data['cclasses'] = cclasses_display_knowl(n, t, C)
    data['character_table'] = character_table_display_knowl(n, t, C)
    data['class_group'] = nf.class_group()
    data['class_group_invs'] = nf.class_group_invariants()
    data['signature'] = nf.signature()
    data['coefficients'] = nf.coeffs()
    nf.make_code_snippets()
    D = nf.disc()
    ram_primes = D.prime_factors()
    data['disc_factor'] = nf.disc_factored_latex()
    if D.abs().is_prime() or D == 1:
        data['discriminant'] = "\(%s\)" % str(D)
    else:
        data['discriminant'] = "\(%s=%s\)" % (str(D), data['disc_factor'])
    npr = len(ram_primes)
    ram_primes = str(ram_primes)[1:-1]
    if ram_primes == '':
        ram_primes = r'\textrm{None}'
    data['frob_data'], data['seeram'] = frobs(nf)
    data['phrase'] = group_phrase(n, t, C)
    zk = nf.zk()
    Ra = PolynomialRing(QQ, 'a')
    zk = [latex(Ra(x)) for x in zk]
    zk = ['$%s$' % x for x in zk]
    zk = ', '.join(zk)
    grh_label = '<small>(<a title="assuming GRH" knowl="nf.assuming_grh">assuming GRH</a>)</small>' if nf.used_grh() else ''
    # Short version for properties
    grh_lab = nf.short_grh_string()
    if 'Not' in str(data['class_number']):
        grh_lab=''
        grh_label=''
    pretty_label = field_pretty(label)
    if label != pretty_label:
        pretty_label = "%s: %s" % (label, pretty_label)

    info.update(data)
    if nf.degree() > 1:
        gpK = nf.gpK()
        rootof1coeff = gpK.nfrootsof1()[2]
        rootofunity = Ra(str(pari("lift(%s)" % gpK.nfbasistoalg(rootof1coeff))).replace('x','a'))
    else:
        rootofunity = Ra('-1')

    info.update({
        'label': pretty_label,
        'label_raw': label,
        'polynomial': web_latex_split_on_pm(nf.poly()),
        'ram_primes': ram_primes,
        'integral_basis': zk,
        'regulator': web_latex(nf.regulator()),
        'unit_rank': nf.unit_rank(),
        'root_of_unity': web_latex(rootofunity),
        'fund_units': nf.units(),
        'grh_label': grh_label
    })

    bread.append(('%s' % info['label_raw'], ' '))
    info['downloads_visible'] = True
    info['downloads'] = [('worksheet', '/')]
    info['friends'] = []
    if nf.can_class_number():
        # hide ones that take a lond time to compute on the fly
        # note that the first degree 4 number field missed the zero of the zeta function
        if abs(D**n) < 50000000:
            info['friends'].append(('L-function', "/L/NumberField/%s" % label))
    info['friends'].append(('Galois group', "/GaloisGroup/%dT%d" % (n, t)))
    if 'dirichlet_group' in info:
        info['friends'].append(('Dirichlet group', url_for("characters.dirichlet_group_table",
                                                           modulus=int(conductor),
                                                           char_number_list=','.join(
                                                               [str(a) for a in dirichlet_chars]),
                                                           poly=info['polynomial'])))
    info['learnmore'] = [('Global number field labels', url_for(
        ".render_labels_page")), 
        (Completename, url_for(".render_discriminants_page")),
        ('How data was computed', url_for(".how_computed_page"))]
    if info['signature'] == [0,1]:
        info['learnmore'].append(('Quadratic imaginary class groups', url_for(".render_class_group_data")))
    # With Galois group labels, probably not needed here
    # info['learnmore'] = [('Global number field labels',
    # url_for(".render_labels_page")), ('Galois group
    # labels',url_for(".render_groups_page")),
    # (Completename,url_for(".render_discriminants_page"))]
    title = "Global Number Field %s" % info['label']

    if npr == 1:
        primes = 'prime'
    else:
        primes = 'primes'

    properties2 = [('Label', label),
                   ('Degree', '%s' % data['degree']),
                   ('Signature', '$%s$' % data['signature']),
                   ('Discriminant', '$%s$' % data['disc_factor']),
                   ('Ramified ' + primes + '', '$%s$' % ram_primes),
                   ('Class number', '%s %s' % (data['class_number'], grh_lab)),
                   ('Class group', '%s %s' % (data['class_group_invs'], grh_lab)),
                   ('Galois Group', group_display_short(data['degree'], t, C))
                   ]
    from lmfdb.math_classes import NumberFieldGaloisGroup
    try:
        info["tim_number_field"] = NumberFieldGaloisGroup(nf._data['coeffs'])
        v = nf.factor_perm_repn(info["tim_number_field"])
        def dopow(m):
            if m==0: return ''
            if m==1: return '*'
            return '*<sup>%d</sup>'% m

        info["mydecomp"] = [dopow(x) for x in v]
    except AttributeError:
        pass
#    del info['_id']
    return render_template("number_field.html", properties2=properties2, credit=NF_credit, title=title, bread=bread, code=nf.code, friends=info.pop('friends'), learnmore=info.pop('learnmore'), info=info)
Example #35
0
 def pretty_galois_knowl(self):
     return group_display_knowl(self._data['Galn'], self._data['Galt'])
Example #36
0
def render_field_webpage(args):
    data = None
    info = {}
    if 'label' in args:
        label = clean_input(args['label'])
        data = lfdb().find_one({'label': label})
        if data is None:
            bread = get_bread([("Search error", ' ')])
            info['err'] = "Field " + label + " was not found in the database."
            info['label'] = label
            return search_input_error(info, bread)
        title = 'Local Number Field ' + label
        polynomial = coeff_to_poly(string2list(data['coeffs']))
        p = data['p']
        e = data['e']
        f = data['f']
        cc = data['c']
        GG = data['gal']
        gn = GG[0]
        gt = GG[1]
        the_gal = WebGaloisGroup.from_nt(gn,gt)
        isgal = ' Galois' if the_gal.order() == gn else ' not Galois'
        abelian = ' and abelian' if the_gal.is_abelian() else ''
        galphrase = 'This field is'+isgal+abelian+' over $\Q_{%d}$.'%p
        autstring = r'\Gal' if the_gal.order() == gn else r'\Aut'
        prop2 = [
            ('Label', label),
            ('Base', '\(\Q_{%s}\)' % p),
            ('Degree', '\(%s\)' % data['n']),
            ('e', '\(%s\)' % e),
            ('f', '\(%s\)' % f),
            ('c', '\(%s\)' % cc),
            ('Galois group', group_display_short(gn, gt, db())),
        ]
        Pt = PolynomialRing(QQ, 't')
        Pyt = PolynomialRing(Pt, 'y')
        eisenp = Pyt(str(data['eisen']))
        unramp = Pyt(str(data['unram']))
        # Look up the unram poly so we can link to it
        unramdata = lfdb().find_one({'p': p, 'n': f, 'c': 0})
        if unramdata is not None:
            unramfriend = "/LocalNumberField/%s" % unramdata['label']
        else:
            logger.fatal("Cannot find unramified field!")
            unramfriend = ''
        rfdata = lfdb().find_one({'p': p, 'n': {'$in': [1, 2]}, 'rf': data['rf']})
        if rfdata is None:
            logger.fatal("Cannot find discriminant root field!")
            rffriend = ''
        else:
            rffriend = "/LocalNumberField/%s" % rfdata['label']
        gsm = data['gsm']
        if gsm == '0':
            gsm = 'Not computed'
        elif gsm == '-1':
            gsm = 'Does not exist'
        else:
            gsm = web_latex(coeff_to_poly(string2list(gsm)))


        info.update({
                    'polynomial': web_latex(polynomial),
                    'n': data['n'],
                    'p': p,
                    'c': data['c'],
                    'e': data['e'],
                    'f': data['f'],
                    't': data['t'],
                    'u': data['u'],
                    'rf': printquad(data['rf'], p),
                    'hw': data['hw'],
                    'slopes': show_slopes(data['slopes']),
                    'gal': group_display_knowl(gn, gt, db()),
                    'gt': gt,
                    'inertia': group_display_inertia(data['inertia'], db()),
                    'unram': web_latex(unramp),
                    'eisen': web_latex(eisenp),
                    'gms': data['gms'],
                    'gsm': gsm,
                    'galphrase': galphrase,
                    'autstring': autstring,
                    'subfields': format_subfields(data['subfields'],p),
                    'aut': data['aut'],
                    })
        friends = [('Galois group', "/GaloisGroup/%dT%d" % (gn, gt))]
        if unramfriend != '':
            friends.append(('Unramified subfield', unramfriend))
        if rffriend != '':
            friends.append(('Discriminant root field', rffriend))

        bread = get_bread([(label, ' ')])
        learnmore = [('Completeness of the data', url_for(".completeness_page")),
                ('Source of the data', url_for(".how_computed_page")),
                ('Local field labels', url_for(".labels_page"))]
        return render_template("lf-show-field.html", credit=LF_credit, title=title, bread=bread, info=info, properties2=prop2, friends=friends, learnmore=learnmore)
Example #37
0
 def display_galois_group(self):
     if self.galois_t == "": #the number field was not found in the database
         return "The Galois group of this isogeny class is not in the database."
     else:
         C = getDBConnection()
         return group_display_knowl(self.galois_n,self.galois_t,C)
Example #38
0
    def make_galmap_object(self, galmap):
        from lmfdb.belyi.main import url_for_belyi_passport_label

        # all information about the map goes in the data dictionary
        # most of the data from the database gets polished/formatted before we put it in the data dictionary
        data = self.data = {}
        # the stuff that does not need to be polished
        for elt in ('label', 'plabel', 'triples_cyc', 'orbit_size', 'g', 'abc',
                    'deg'):
            data[elt] = galmap[elt]
        nt = galmap['group'].split('T')
        data['group'] = group_display_knowl(int(nt[0]), int(nt[1]),
                                            getDBConnection())

        data['geomtype'] = geomtypelet_to_geomtypename_dict[galmap['geomtype']]
        data['lambdas'] = [str(c)[1:-1] for c in galmap['lambdas']]

        data['isQQ'] = False
        data['in_LMFDB'] = False
        F = belyi_base_field(galmap)
        if F._data == None:
            fld_coeffs = galmap['base_field']
            pol = PolynomialRing(QQ, 'x')(fld_coeffs)
            data['base_field'] = latex(pol)
        else:
            data['in_LMFDB'] = True
            if F.poly().degree() == 1:
                data['isQQ'] = True
            F.latex_poly = web_latex(F.poly())
            data['base_field'] = F
        crv_str = galmap['curve']
        if crv_str == 'PP1':
            data['curve'] = '\mathbb{P}^1'
        else:
            data['curve'] = make_curve_latex(crv_str)

        # change pairs of floats to complex numbers
        embeds = galmap['embeddings']
        embed_strs = []
        for el in embeds:
            if el[1] < 0:
                el_str = str(el[0]) + str(el[1]) + "\sqrt{-1}"
            else:
                el_str = str(el[0]) + "+" + str(el[1]) + "\sqrt{-1}"
            embed_strs.append(el_str)

        data['map'] = make_map_latex(galmap['map'])
        data['embeddings_and_triples'] = []
        if data['isQQ']:
            for i in range(0, len(data['triples_cyc'])):
                triple_cyc = data['triples_cyc'][i]
                data['embeddings_and_triples'].append([
                    "\\text{not applicable (over $\mathbb{Q}$)}",
                    triple_cyc[0], triple_cyc[1], triple_cyc[2]
                ])
        else:
            for i in range(0, len(data['triples_cyc'])):
                triple_cyc = data['triples_cyc'][i]
                data['embeddings_and_triples'].append([
                    embed_strs[i], triple_cyc[0], triple_cyc[1], triple_cyc[2]
                ])

        data['lambdas'] = [str(c)[1:-1] for c in galmap['lambdas']]

        # Properties
        properties = [
            ('Label', galmap['label']),
            ('Group', str(galmap['group'])),
            ('Orders', str(galmap['abc'])),
            ('Genus', str(galmap['g'])),
            ('Size', str(galmap['orbit_size'])),
        ]
        self.properties = properties

        # Friends
        self.friends = [('Passport',
                         url_for_belyi_passport_label(galmap['plabel']))]

        # Breadcrumbs
        groupstr, abcstr, sigma0, sigma1, sigmaoo, gstr, letnum = data[
            'label'].split("-")
        lambdasstr = '%s-%s-%s' % (sigma0, sigma1, sigmaoo)
        lambdasgstr = lambdasstr + "-" + gstr
        self.bread = [
            ('Belyi Maps', url_for(".index")),
            (groupstr, url_for(".by_url_belyi_search_group", group=groupstr)),
            (abcstr,
             url_for(".by_url_belyi_search_group_triple",
                     group=groupstr,
                     abc=abcstr)),
            (lambdasgstr,
             url_for(".by_url_belyi_passport_label",
                     group=groupstr,
                     abc=abcstr,
                     sigma0=sigma0,
                     sigma1=sigma1,
                     sigmaoo=sigmaoo,
                     g=gstr)),
            (letnum,
             url_for(".by_url_belyi_galmap_label",
                     group=groupstr,
                     abc=abcstr,
                     sigma0=sigma0,
                     sigma1=sigma1,
                     sigmaoo=sigmaoo,
                     g=gstr,
                     letnum=letnum)),
        ]

        # Title
        self.title = "Belyi map " + data['label']

        # Code snippets (only for curves)
        self.code = {}
        return
Example #39
0
 def display_galois_group(self):
     if not hasattr(self, 'galois_t') or not self.galois_t: #the number field was not found in the database
         return "The Galois group of this isogeny class is not in the database."
     else:
         return group_display_knowl(self.galois_n, self.galois_t)
Example #40
0
 def pretty_galois_knowl(self):
     C = getDBConnection()
     return group_display_knowl(self._data['Galois_nt'][0],
                                self._data['Galois_nt'][1], C)
Example #41
0
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)
Example #42
0
def lfuncEPhtml(L,fmt):
    """ Euler product as a formula and a table of local factors.
    """
    texform_gen = "\[L(s) = "  # "\[L(A,s) = "
    texform_gen += "\prod_{p \\text{ prime}} F_p(p^{-s})^{-1} \]\n"

    pfactors = prime_divisors(L.level)
    if len(pfactors) == 1:  #i.e., the conductor is prime
        pgoodset = "$p \\neq " + str(pfactors[0]) + "$"
        pbadset = "$p = " + str(pfactors[0]) + "$"
    else:
        badset = "\\{" + str(pfactors[0])
        for j in range(1,len(pfactors)):
            badset += ",\\;"
            badset += str(pfactors[j])
        badset += "\\}"
        pgoodset = "$p \\notin " + badset + "$"
        pbadset = "$p \\in " + badset + "$"


    ans = ""
    ans += texform_gen + "where, for " + pgoodset + ",\n"
    if L.degree == 4 and L.motivic_weight == 1:
        ans += "\[F_p(T) = 1 - a_p T + b_p T^2 -  a_p p T^3 + p^2 T^4 \]"
        ans += "with $b_p = a_p^2 - a_{p^2}$. "
    elif L.degree == 2 and L.motivic_weight == 1:
        ans += "\[F_p(T) = 1 - a_p T + p T^2 .\]"
    else:
        ans += "\(F_p\) is a polynomial of degree " + str(L.degree) + ". "
    ans += "If " + pbadset + ", then $F_p$ is a polynomial of degree at most "
    ans += str(L.degree - 1) + ". "
    bad_primes = []
    for lf in L.bad_lfactors:
        bad_primes.append(lf[0])
    eulerlim = 25
    good_primes = []
    for j in range(0, eulerlim):
        this_prime = Primes().unrank(j)
        if this_prime not in bad_primes:
            good_primes.append(this_prime)
    eptable = "<table id='eptable' class='ntdata euler'>\n"
    eptable += "<thead>"
    eptable += "<tr class='space'><th class='weight'></th><th class='weight'>$p$</th><th class='weight'>$F_p$</th>"
    if L.degree > 2:
        eptable += "<th class='weight galois'>$\Gal(F_p)$</th>"
    eptable += "</tr>\n"
    eptable += "</thead>"
    goodorbad = "bad"
    for lf in L.bad_lfactors:
        try:
            thispolygal = list_to_factored_poly_otherorder(lf[1], galois=True)
            eptable += ("<tr><td>" + goodorbad + "</td><td>" + str(lf[0]) + "</td><td>" +
                        "$" + thispolygal[0] + "$" +
                        "</td>")
            if L.degree > 2:
                eptable += "<td class='galois'>"
                this_gal_group = thispolygal[1]
                if this_gal_group[0]==[0,0]:
                    pass   # do nothing, because the local faco is 1
                elif this_gal_group[0]==[1,1]:
                    eptable += group_display_knowl(this_gal_group[0][0],this_gal_group[0][1],'$C_1$')
                else:
                    eptable += group_display_knowl(this_gal_group[0][0],this_gal_group[0][1])
                for j in range(1,len(thispolygal[1])):
                    eptable += "$\\times$"
                    eptable += group_display_knowl(this_gal_group[j][0],this_gal_group[j][1])
                eptable += "</td>"
            eptable += "</tr>\n"

        except IndexError:
            eptable += "<tr><td></td><td>" + str(j) + "</td><td>" + "not available" + "</td></tr>\n"
        goodorbad = ""
    goodorbad = "good"
    firsttime = " class='first'"
    good_primes1 = good_primes[:9]
    good_primes2 = good_primes[9:]
    for j in good_primes1:
        this_prime_index = prime_pi(j) - 1
        thispolygal = list_to_factored_poly_otherorder(L.localfactors[this_prime_index],galois=True)
        eptable += ("<tr" + firsttime + "><td>" + goodorbad + "</td><td>" + str(j) + "</td><td>" +
                    "$" + thispolygal[0] + "$" +
                    "</td>")
        if L.degree > 2:
            eptable += "<td class='galois'>"
            this_gal_group = thispolygal[1]
            eptable += group_display_knowl(this_gal_group[0][0],this_gal_group[0][1])
            for j in range(1,len(thispolygal[1])):
                eptable += "$\\times$"
                eptable += group_display_knowl(this_gal_group[j][0],this_gal_group[j][1])
            eptable += "</td>"
        eptable += "</tr>\n"


#        eptable += "<td>" + group_display_knowl(4,1) + "</td>"
#        eptable += "</tr>\n"
        goodorbad = ""
        firsttime = ""
    firsttime = " id='moreep'"
    for j in good_primes2:
        this_prime_index = prime_pi(j) - 1
        thispolygal = list_to_factored_poly_otherorder(L.localfactors[this_prime_index],galois=True)
        eptable += ("<tr" + firsttime +  " class='more nodisplay'" + "><td>" + goodorbad + "</td><td>" + str(j) + "</td><td>" +
                    "$" + list_to_factored_poly_otherorder(L.localfactors[this_prime_index], galois=True)[0] + "$" +
                    "</td>")
        if L.degree > 2:
            this_gal_group = thispolygal[1]
            eptable += "<td class='galois'>"
            eptable += group_display_knowl(this_gal_group[0][0],this_gal_group[0][1])
            for j in range(1,len(thispolygal[1])):
                eptable += "$\\times$"
                eptable += group_display_knowl(this_gal_group[j][0],this_gal_group[j][1])
            eptable += "</td>"

        eptable += "</tr>\n"
        firsttime = ""

    eptable += "<tr class='less toggle'><td></td><td></td><td> <a onclick='"
    eptable += 'show_moreless("more"); return true' + "'"
    eptable += ' href="#moreep" '
    eptable += ">show more</a></td></tr>\n"
    eptable += "<tr class='more toggle nodisplay'><td></td><td></td><td> <a onclick='"
    eptable += 'show_moreless("less"); return true' + "'"
    eptable += ' href="#eptable" '
    eptable += ">show less</a></td></tr>\n"
    eptable += "</table>\n"
    ans += "\n" + eptable
    return(ans)
Example #43
0
def render_field_webpage(args):
    data = None
    info = {}
    if "label" in args:
        label = clean_input(args["label"])
        C = base.getDBConnection()
        data = C.localfields.fields.find_one({"label": label})
        if data is None:
            bread = get_bread([("Search error", " ")])
            info["err"] = "Field " + label + " was not found in the database."
            info["label"] = label
            return search_input_error(info, bread)
        title = "Local Number Field " + label
        polynomial = coeff_to_poly(data["coeffs"])
        p = data["p"]
        e = data["e"]
        f = data["f"]
        cc = data["c"]
        GG = data["gal"]
        gn = GG[0]
        gt = GG[1]
        prop2 = [
            ("Label", label),
            ("Base", "\(\Q_{%s}\)" % p),
            ("Degree", "\(%s\)" % data["n"]),
            ("e", "\(%s\)" % e),
            ("f", "\(%s\)" % f),
            ("c", "\(%s\)" % cc),
            ("Galois group", group_display_short(gn, gt, C)),
        ]
        Pt = PolynomialRing(QQ, "t")
        Pyt = PolynomialRing(Pt, "y")
        eisenp = Pyt(str(data["eisen"]))
        unramp = Pyt(str(data["unram"]))
        # Look up the unram poly so we can link to it
        unramdata = C.localfields.fields.find_one({"p": p, "n": f, "c": 0})
        if len(unramdata) > 0:
            unramfriend = "/LocalNumberField/%s" % unramdata["label"]
        else:
            logger.fatal("Cannot find unramified field!")
            unramfriend = ""
        rfdata = C.localfields.fields.find_one({"p": p, "n": {"$in": [1, 2]}, "rf": data["rf"]})
        if rfdata is None:
            logger.fatal("Cannot find discriminant root field!")
            rffriend = ""
        else:
            rffriend = "/LocalNumberField/%s" % rfdata["label"]

        info.update(
            {
                "polynomial": web_latex(polynomial),
                "n": data["n"],
                "p": data["p"],
                "c": data["c"],
                "e": data["e"],
                "f": data["f"],
                "t": data["t"],
                "u": data["u"],
                "rf": printquad(data["rf"], p),
                "hw": data["hw"],
                "slopes": show_slopes(data["slopes"]),
                "gal": group_display_knowl(gn, gt, C),
                "gt": gt,
                "inertia": group_display_inertia(data["inertia"], C),
                "unram": web_latex(unramp),
                "eisen": web_latex(eisenp),
                "gms": data["gms"],
                "aut": data["aut"],
            }
        )
        friends = [("Galois group", "/GaloisGroup/%dT%d" % (gn, gt))]
        if unramfriend != "":
            friends.append(("Unramified subfield", unramfriend))
        if rffriend != "":
            friends.append(("Discriminant root field", rffriend))

        bread = get_bread([(label, " ")])
        learnmore = [
            ("Completeness of the data", url_for(".completeness_page")),
            ("Source of the data", url_for(".how_computed_page")),
            ("Local field labels", url_for(".labels_page")),
        ]
        return render_template(
            "lf-show-field.html",
            credit=LF_credit,
            title=title,
            bread=bread,
            info=info,
            properties2=prop2,
            friends=friends,
            learnmore=learnmore,
        )