def test2(B=500): from sage.all import polygen, primes, QQ, GF, HyperellipticCurve import psage.libs.smalljac.wrapper x = polygen(QQ, "x") J = psage.libs.smalljac.wrapper.SmallJac(x ** 5 + 17 * x + 3) N = 97 * 3749861 for p in primes(45, B): # 45 comes from "(2g+1)(2N-1) = 45" if N % p: x = polygen(GF(p), "x") C = HyperellipticCurve(x ** 5 + 17 * x + 3) assert C.frobenius_polynomial() == J.frob(p).charpoly()
def V4_extensions(K,S, verbose=False): r"""Return all V4 extensions of K unramified outside S. The polynomials returned are irreducible. """ from C2C3S3 import C2_extensions C2s = C2_extensions(K,S) ds = [f.discriminant() for f in C2s] if K==QQ: ds = [d.squarefree_part() for d in ds] #print("ds = {}".format(ds)) ab_pairs = [] all_pairs = [] for i,a in enumerate(ds): for b in ds[:i]: if Set([a,b]) in all_pairs: continue c = a*b if K==QQ: c = c.squarefree_part() ab_pairs.append([a,b]) all_pairs.append(Set([a,b])) all_pairs.append(Set([a,c])) all_pairs.append(Set([c,b])) #print("ab pairs = {}".format(ab_pairs)) x = polygen(K) #print( [(x**4 - 2*(a+b)*x**2 + (a-b)**2) for a,b in ab_pairs]) return [polredabs(x**4 - 2*(a+b)*x**2 + (a-b)**2) for a,b in ab_pairs]
def C2_extensions(K,S): r"""Return all quadratic extensions of K unramified outside S. INPUT: - ``K`` (number field) -- a number field, or ``QQ``. - ``S`` (list) -- a list of prime ideals in ``K``, or primes. OUTPUT: (list) A list of monic polynomials of the form `x^2-a` with `a\in K` defining all quadratic extensions of `K` unramified outside `S`. .. note:: These all have the form `K(\sqrt{a})` for `a\in K(S,2)', but if `S` does not contain all primes dividing 2 then some of these may be ramified at primes dividing 2 not in `S`, so we need to do an additional check. """ x = polygen(K) # if some primes above 2 are not in S then a further check is required if is_S_unit(K(2),S): test = lambda a: True else: test = lambda a: unramified_outside_S(K.extension(x**2-a,'t2'), S, 2) return [x**2-a for a in K.selmer_group_iterator(S,2) if not a.is_square() and test(a)]
def field_from_label(lab): r""" Returns a number field from its LMFDB label. INPUT: - ``s`` (string)-- an LMFDB field label OUTPUT: A number field. """ dummy, deg, sig, abs_disc = field_data(lab) x = polygen(QQ) if deg==2: d = ZZ(abs_disc) if sig[0]==0: d=-d t = d%4 assert t in [0,1] pol = x**2 - t*x + (t-d)/4 elif lab=='3.1.23.1': pol = x**3 - x**2 +1 else: raise NotImplementedError("cannot yet handle field %s" % lab) K = NumberField(pol, 'a') print "Created field from label %s: %s" % (lab,K) return K
def C4_extensions_with_quadratic(K,S,M, verbose=False): r"""Return all C4 extensions of K containing the quadratic extension M of K, unramified outside S. """ if verbose: print("finding C4 extensions of {} over {} unramified outside {}".format(K,M,S)) SM = sum([M.primes_above(P) for P in S],[]) DM = M.defining_polynomial().discriminant() x = polygen(K) # if some primes above 2 are not in S then a further check is required from C2C3S3 import is_S_unit, unramified_outside_S if is_S_unit(M(2),SM): test = lambda a: True else: test = lambda a: unramified_outside_S(M.extension(polygen(M)**2-a,'t4'),SM) alphas = [a for a in M.selmer_group_iterator(SM,2) if not a.is_square() and (DM*a.relative_norm()).is_square() and test(a)] return [polredabs(x**4-a.trace(K)*x**2+a.norm(K)) for a in alphas]
def render_hmf_webpage(**args): C = getDBConnection() data = None if 'label' in args: label = str(args['label']) data = C.hmfs.forms.find_one({'label': label}) if data is None: return "No such field" info = {} try: info['count'] = args['count'] except KeyError: info['count'] = 10 hmf_field = C.hmfs.fields.find_one({'label': data['field_label']}) field_info = C.numberfields.fields.find_one({'label': data['field_label']}) field_info['galois_group'] = str(field_info['galois_group'][3]) info['field_info'] = field_info info['field_poly'] = pol_to_html(str(coeff_to_poly(field_info['coefficients']))) data['field_label'] = field_pretty(data['field_label']) info.update(data) info['downloads_visible'] = True info['downloads'] = [('worksheet (not yet)', '/')] info['friends'] = [('L-function (not yet)', '/')] # info['learnmore'] = [('Number Field labels', url_for("render_labels_page")), ('Galois group labels',url_for("render_groups_page")), ('Discriminant ranges',url_for("render_discriminants_page"))] bread = [('Hilbert Modular Forms', url_for("hilbert_modular_form_render_webpage")),('%s'%data['label'],' ')] t = "Hilbert Cusp Form %s" % info['label'] credit = 'L. Dembele, S. Donnelly and J. Voight' eigs = eval(data['hecke_eigenvalues']) primes = hmf_field['primes'] w = polygen(QQ,'w') n = min(len(eigs),len(primes)) info['eigs'] = [{'eigenvalue': eigs[i], 'prime_ideal': primes[i], 'prime_norm': primes[i][0]} for i in range(n)] properties = [] properties = ['<br>'] properties.extend('<table>') properties.extend('<tr><td align=left>Field:<td align=left>%s</td>'%data["field_label"]) properties.extend('<tr><td align=left>Degree:<td align=left> %s</td>'%field_info['degree']) properties.extend('<tr><td align=left>Discriminant:<td align=left>%s</td>'%field_info['discriminant']) properties.extend('<tr><td align=left>Polynomial:<td align=left>%s</td>'%field_info['discriminant']) properties.extend('<tr><td align=left>Class number:<td align=left>%s</td>'%field_info['class_number']) properties.extend('<tr><td align=left>Galois group:<td align=left>%s</td>'%field_info['galois_group']) properties.extend('</table>') properties.extend('<hr>') properties.extend('<table>') properties.extend('<tr><td align=left>Weight:<td align=left>%s</td>'%data["weight"]) properties.extend('<tr><td align=left>Level:<td align=left> %s</td>'%data['level_ideal']) properties.extend('<tr><td align=left>Level Norm:<td align=left>%s</td>'%data['level_norm']) properties.extend('<tr><td align=left>Label:<td align=left>%s</td>'%data['label_suffix']) properties.extend('</table>') return render_template("hilbert_modular_form/hilbert_modular_form.html", info = info, properties=properties, credit=credit, title = t, bread=bread)
def make_quartic(a): # a is in the cubic extension M/K and has square norm, so has # char poly of the form x^3-p*x^2+q*x-r^2. r2, q, p, one = list(a.charpoly()) p = -p assert (-r2).is_square() r = (-r2).sqrt() x = polygen(K) return polredabs((x**2-p)**2-8*r*x-4*q)
def test1(B=10 ** 4): from sage.all import polygen, primes, QQ, EllipticCurve import psage.libs.smalljac.wrapper x = polygen(QQ, "x") J = psage.libs.smalljac.wrapper.SmallJac(x ** 3 + 17 * x + 3) E = EllipticCurve([17, 3]) N = E.conductor() for p in primes(B): if N % p: assert E.ap(p) == J.ap(p)
def vec123(K,basis): xK = polygen(K) quadratics = [xK**2-d for d in basis] r = len(basis) def vecP(P): ones = [lam(pol,P) for pol in quadratics] #print("ones: {}".format(ones)) twos = [ones[i]*ones[j] for i in range(r) for j in range(i+1,r)] #print("twos: {}".format(twos)) threes = [ones[i]*ones[j]*ones[k] for i in range(r) for j in range(i+1,r) for k in range(j+1,r)] #print("threes: {}".format(threes)) vec = ones+twos+threes return vec return vecP
def _test_an_dict_over_Q(ainvs, B=100): """ Test that the an_dict function works and gives the correct answer for an elliptic curve defined over QQ, by computing using the generic code in this file, and comparing with the output of Sage's anlist function for rational elliptic curves. """ from sage.all import polygen, QQ, NumberField, EllipticCurve x = polygen(QQ,'x') F = NumberField(x - 1,'a'); a = F.gen() E = EllipticCurve(F, ainvs) EQ = EllipticCurve(QQ, ainvs) v = EQ.anlist(B) an = an_dict(E, B) for i, j in an.iteritems(): assert j == v[i[0]]
def test1(B=50): """ Tests that the functions all run without crashing over a specific number field. Does not test that the output is correct. That should be in another test. """ from sage.all import polygen, QQ, NumberField, EllipticCurve x = polygen(QQ,'x') F = NumberField(x**2 - x - 1,'a'); a = F.gen() E = EllipticCurve([1,a+1,a,a,0]) ap(E,F.ideal(3)) primes_of_bounded_norm(F,B) ap_list(E,B) assert len(ap_list(E,B,primes=True)) == 2 apd = ap_dict(E,B) reduced_rep(F.ideal(3)) assert an_dict(E,B) == an_dict_from_ap(apd, E.conductor(), B)
def V4_extensions_with_quadratic(K,S,M, verbose=False): r"""Return all V4 extensions of K unramified outside S which contain the quadratic extension M (also unramified outside S). The polynomials returned are irreducible. """ from C2C3S3 import C2_extensions C2s = C2_extensions(K,S) D = M.discriminant().squarefree_part() ds = [f.discriminant() for f in C2s] if K==QQ: ds = [d.squarefree_part() for d in ds] dMs = [d*D for d in ds] if K==QQ: dMs = [d.squarefree_part() for d in dMs] indices = [i for i in range(len(ds)) if ds[i]!=D and dMs.index(ds[i])<i] ds = [ds[i] for i in indices] x = polygen(K) return [polredabs(x**4 - 2*(D+d)*x**2 + (D-d)**2) for d in ds]
def get_T0_mod3(K,S, flist=None, verbose=False): # Compute all absolutely irreducible quartics unramified outside S # if not supplied: if flist == None: from S4 import abs_irred_extensions flist = abs_irred_extensions(K,S) if verbose: print("quartics: {}".format(flist)) # Append a poly with lam3=0 x = polygen(K) flist0 = flist + [x**3] n = len(flist) # Starting with no primes, compute the lambda matrix plist = [] vlist = [lamvec(f,plist,lam3) for f in flist0] ij = equal_vecs(vlist) if verbose: print("With plist={}, vlist={}, ij={}".format(plist,vlist,ij)); N = prod(S,1) * prod([f.discriminant() for f in flist]) # As long as the vectors in vlist are not all distinct, find two # indices i,j for which they are the same and find a new prime which # distinguishes these two, add it to the list and update. The primes # must not be in S or divide the discriminant of any of the quartics. while ij: i,j = ij if j==n: p = get_p_1(K,flist[i],N, lam3) else: p = get_p_2(K,flist[i],flist[j],N, lam3) plist = plist + [p] if verbose: print("plist = {}".format(plist)) vlist = [lamvec(f,plist,lam3) for f in flist0] ij = equal_vecs(vlist) if verbose: print("With plist={}, vlist={}, ij={}".format(plist,vlist,ij)); vlist = vlist[:-1] # Sort the primes into order and recompute the vectors: plist.sort() vlist = [lamvec(f,plist,lam3) for f in flist] return flist, plist, vlist
def alpha(p,D): """ Return 1 if p is inert in K(sqrt(D)), 0 if p splits """ # Over Q we just compute the kronecker symbol, returning 0 if it # equals 1 and 1 if it equals -1: if p in ZZ: return ((1-ZZ(D).kronecker(p))//2) % 2 # Otherwise we retrieve the field K (here p may be a prime ideal or a prime element) try: K = p.ring() except AttributeError: K = p.parent() # and count how many primes in K lie above p: x = polygen(K) L = K.extension(x**2-D,'b') return 2-len(L.primes_above(p))
def field_from_label(lab): r""" Returns a number field from its LMFDB label. Only for 5 IQFs at present. """ global the_fields if lab in the_fields: return the_fields[lab] x = polygen(QQ) deg, s, abs_disc, _ = lab.split(".") assert deg == '2' assert s == '0' d = -ZZ(abs_disc) t = d%4 assert t in [0,1] pol = x**2 - t*x + (t-d)//4 K = NumberField(pol, 'a') print "Created field from label %s: %s" % (lab,K) the_fields[lab] = K return K
def get_T0(K,S, flist=None, verbose=False): # Compute all cubics unramified outside S if not supplied: if flist == None: from C2C3S3 import C3S3_extensions flist = C3S3_extensions(K,S) if verbose: print("cubics: {}".format(flist)) # Append the reducible cubic x = polygen(K) flist0 = flist + [x**3] n = len(flist) # Starting with no primes, compute the lambda matrix plist = [] vlist = [lamvec(f,plist) for f in flist0] ij = equal_vecs(vlist) if verbose: print("With plist={}, vlist={}, ij={}".format(plist,vlist,ij)); N = prod(S,1) # As long as the vectors in vlist are not all distinct, find two # indices i,j for which they are the same and find a new prime which # distinguishes these two, add it to the list and update: while ij: i,j = ij if j==n: p = get_p_1(K,flist[i],N) else: p = get_p_2(K,flist[i],flist[j],N) plist = plist + [p] if verbose: print("plist = {}".format(plist)) vlist = [lamvec(f,plist) for f in flist0] ij = equal_vecs(vlist) if verbose: print("With plist={}, vlist={}, ij={}".format(plist,vlist,ij)); vlist = vlist[:-1] # Sort the primes into order and recompute the vectors: plist.sort() vlist = [lamvec(f,plist) for f in flist] return flist, plist, vlist
def D4_extensions_with_quadratic(K,S,M, verbose=False): r"""Return all D4 extensions of K unramified outside S which are cyclic extensions of the quadratic field M, where M is also unramified outside S. """ if verbose: print("finding D4 extensions of {} over {} unramified outside {}".format(K,M,S)) SM = sum([M.primes_above(P) for P in S],[]) sigma = M.automorphisms()[1] from KSp import pSelmerGroup MS2, MS2_gens, from_MS2, to_MS2 = pSelmerGroup(M,SM,ZZ(2)) betas2 = [from_MS2(v) for v in MS2 if v] # remove conjugates (mod squares): conj_ind = lambda b: betas2.index(from_MS2(to_MS2(sigma(b)))) betas = [b for i,b in enumerate(betas2) if not conj_ind(b)<i] # remove those whose norm is a square in M: norms = [b.norm() for b in betas] betas = [b for b,n in zip(betas,norms) if not M(n).is_square()] norms = [b.norm() for b in betas] traces = [b.trace() for b in betas] x = polygen(K) return [polredabs(x**4-t*x**2+n) for t,n in zip(traces,norms)]
def C3_extensions(K,S, verbose=False, debug=False): r"""Return all `C_3` extensions of ``K`` unramified outside ``S``. INPUT: - ``K`` (number field) -- a number field, or ``QQ``. - ``S`` (list) -- a list of prime ideals in ``K``, or primes. - ``verbose`` (boolean, default ``False``) -- verbosity flag. OUTPUT: - ``debug`` (boolean, default ``False``) -- debugging flag. OUTPUT: (list) A list of polynomials of degree 3 in `K[x]` defining all Galois cubic extensions of `K` unramified outside `S`. .. note:: If `K` contains the cube roots of unity, these all have the form `K(\root[3]{a})` for `a\in (K(S,3)`, but if `S` does not contain all primes dividing 3 some of these may be ramified at primes dividing 3 not in `S` so we need to do an additional check. In the general case we need to work harder: we work over `K(\zeta_3)` and then descend. """ from KSp import pSelmerGroup x = polygen(K) if verbose: print("finding C3 extensions over {} unramified outside {}".format(K,S)) if K(-3).is_square(): ## K contains cube roots of unity if is_S_unit(K(3),S): # primes dividing 3 are in S -- easy case test = lambda a: True else: test = lambda a: unramified_outside_S(K.extension(x**3-a,'t3'), S, 3) # use K(S,3), omitting trivial element and only including one of a, a^-1: from KSp import selmer_group_projective return [x**3-a for a in selmer_group_projective(K,S,3) if test(a)] # now K does not contain the cube roots of unity. We adjoin them. # See Angelos Koutsianas's thesis Algorithm 3 (page 45) if verbose: print("finding alphas") # Find downstairs Selmer group and maps: KS3, KS3_gens, from_KS3, to_KS3 = pSelmerGroup(K,S,ZZ(3)) if verbose: print("Downstairs 3-Selmer group has dimension {}".format(KS3.dimension())) # Find upstairs Selmer group and maps: K3 = K.extension(x**2+x+1,'z3') nm = lambda p: p if p in ZZ else p.absolute_norm() S3 = sum([K3.primes_above(P) for P in S if nm(P)%3!=2],[]) K3S3, K3S3_gens, from_K3S3, to_K3S3 = pSelmerGroup(K3,S3,ZZ(3)) if verbose: print("Upstairs 3-Selmer group has dimension {}".format(K3S3.dimension())) # construct norm map from K3S3 to KS3 and find its kernel: N = K3S3.hom([to_KS3(from_K3S3(v).norm(K)) for v in K3S3.basis()], KS3) ker = N.kernel() Pker = ProjectiveSpace(ker.dimension()-1,ker.base()) alphas = [from_K3S3(ker.linear_combination_of_basis(list(v))) for v in Pker] # The alphas are the elements of this kernel if verbose: print("found {} alphas".format(len(alphas))) #print(alphas) # Compute the trace of each alpha: try: traces = [a.trace(K) for a in alphas] except TypeError: traces = [a.trace() for a in alphas] if verbose: print("computed {} traces".format(len(traces))) # Compute the betas, cube roots of each alpha's norm: betas = [a.norm(K).nth_root(3) for a in alphas] if verbose: print("computed {} betas".format(len(betas))) # Form the polynomials polys = [x**3-3*b*x-t for b,t in zip(betas, traces)] if verbose: print("computed {} polys".format(len(polys))) # NB because of the additional extension, these may be ramified at # primes above 3, not all of which are necessarily in S, so we # must check. If S already contained all primes dividing 3 this # would already be the desired list. check_3 = not is_S_unit(K(3),S) if debug or check_3: fields = [K.extension(f,'t3') for f in polys] if verbose: print("computed fields, checking ramification") if K == QQ: if not (debug or check_3): fields = [K.extension(f,'t3') for f in polys] fields = [L.optimized_representation()[0] for L in fields] polys = [L.defining_polynomial() for L in fields] # (debug) check the fields are not isomorphic (relative to K): if debug: if K==QQ: assert all([not any([fields[i].is_isomorphic(fields[j]) for j in range(i)]) for i in range(len(fields))]) else: assert all([not any([fields[i].is_isomorphic_relative(fields[j]) for j in range(i)]) for i in range(len(fields))]) # the polys we have are already guaranteed to be unramified # outside S, by construction, except possibly at primes dividing 3 # not in S. if check_3: polys_and_fields = zip(polys,fields) if verbose: print("Final check of primes dividing 3 not in S") polys_and_fields = [fL for fL in polys_and_fields if unramified_outside_S(fL[1],S,3)] if verbose: print("After final check, {} polys remain".format(len(polys_and_fields))) polys = [f for f,L in polys_and_fields] fields = [L for f,L in polys_and_fields] if debug: if not polys == [f for f,L in zip(polys,fields) if unramified_outside_S(L,S)]: print("Problem: relative discriminants are {}".format([L.relative_discriminant().factor() for L in fields])) else: if verbose: print("computed unramified polys OK") return polys
# 2020-04-15: first version by JEC from sage.all import EllipticCurve, polygen, QQ, NumberField from lmfdb import db from lmfdb.nfutils.psort import primes_iter from lmfdb.ecnf.WebEllipticCurve import parse_ainvs print("setting nfcurves") nfcurves = db.ec_nfcurves print("setting bmf forms") forms = db.bmf_forms fields = ['2.0.{}.1'.format(d) for d in [4, 8, 3, 7, 11]] x = polygen(QQ) polys = { '2.0.4.1': x**2 + 1, '2.0.8.1': x**2 + 2, '2.0.3.1': x**2 - x + 1, '2.0.7.1': x**2 - x + 2, '2.0.11.1': x**2 - x + 3, } gen_names = { '2.0.4.1': 'i', '2.0.8.1': 't', '2.0.3.1': 'w', '2.0.7.1': 'a', '2.0.11.1': 'a',
def render_hmf_webpage(**args): C = getDBConnection() data = None if 'label' in args: label = str(args['label']) data = C.hmfs.forms.find_one({'label': label}) if data is None: return "No such field" info = {} try: info['count'] = args['count'] except KeyError: info['count'] = 10 try: numeigs = request.args['numeigs'] numeigs = int(numeigs) except: numeigs = 20 hmf_field = C.hmfs.fields.find_one({'label': data['field_label']}) gen_name = findvar(hmf_field['ideals']) nf = WebNumberField(data['field_label'], gen_name=gen_name) info['field'] = nf info['base_galois_group'] = nf.galois_string() info['field_degree'] = nf.degree() info['field_disc'] = str(nf.disc()) info['field_poly'] = teXify_pol(str(nf.poly())) info.update(data) info['downloads'] = [('Download to Magma', url_for(".render_hmf_webpage_download", field_label=info['field_label'], label=info['label'], download_type='magma')), ('Download to Sage', url_for(".render_hmf_webpage_download", field_label=info['field_label'], label=info['label'], download_type='sage'))] info['friends'] = [('L-function', url_for("l_functions.l_function_hmf_page", field=info['field_label'], label=info['label'], character='0', number='0'))] if data['dimension'] == 1: # Try to attach associated elliptic curve lab = split_class_label(info['label']) ec_from_hmf = db_ecnf().find_one({"label": label + '1'}) if ec_from_hmf != None: info['friends'] += [('Isogeny class ' + info['label'], url_for("ecnf.show_ecnf_isoclass", nf=lab[0], conductor_label=lab[1], class_label=lab[2]))] bread = [('Hilbert Modular Forms', url_for(".hilbert_modular_form_render_webpage")), ('%s' % data['label'], ' ')] t = "Hilbert Cusp Form %s" % info['label'] forms_space = C.hmfs.forms.find({ 'field_label': data['field_label'], 'level_ideal': data['level_ideal'] }) dim_space = 0 for v in forms_space: dim_space += v['dimension'] info['newspace_dimension'] = dim_space w = polygen(QQ, 'w') e = polygen(QQ, 'e') eigs = data['hecke_eigenvalues'] eigs = eigs[:min(len(eigs), numeigs)] primes = hmf_field['primes'] n = min(len(eigs), len(primes)) info['eigs'] = [{ 'eigenvalue': teXify_pol(eigs[i]), 'prime_ideal': teXify_pol(primes[i]), 'prime_norm': primes[i][1:primes[i].index(',')] } for i in range(n)] try: display_eigs = request.args['display_eigs'] if display_eigs in ['True', 'true', '1', 'yes']: display_eigs = True else: display_eigs = False except KeyError: display_eigs = False if 'numeigs' in request.args: display_eigs = True info['hecke_polynomial'] = teXify_pol(info['hecke_polynomial']) if 'AL_eigenvalues_fixed' in data: if data['AL_eigenvalues_fixed'] == 'done': info['AL_eigs'] = [{ 'eigenvalue': teXify_pol(al[1]), 'prime_ideal': teXify_pol(al[0]), 'prime_norm': al[0][1:al[0].index(',')] } for al in data['AL_eigenvalues']] else: info['AL_eigs'] = [{'eigenvalue': '?', 'prime_ideal': '?'}] else: info['AL_eigs'] = [{'eigenvalue': '?', 'prime_ideal': '?'}] info['AL_eigs_count'] = len(info['AL_eigs']) != 0 if not display_eigs: for eig in info['eigs']: if len(eig['eigenvalue']) > 300: eig['eigenvalue'] = '...' for eig in info['AL_eigs']: if len(eig['eigenvalue']) > 300: eig['eigenvalue'] = '...' info['level_ideal'] = teXify_pol(info['level_ideal']) if 'is_CM' in data: is_CM = data['is_CM'] else: is_CM = '?' info['is_CM'] = is_CM if 'is_base_change' in data: is_base_change = data['is_base_change'] else: is_base_change = '?' info['is_base_change'] = is_base_change if 'q_expansions' in data: info['q_expansions'] = data['q_expansions'] properties2 = [('Base Field', '%s' % info['field'].field_pretty()), ('Weight', '%s' % data['weight']), ('Level Norm', '%s' % data['level_norm']), ('Level', '$' + teXify_pol(data['level_ideal']) + '$'), ('Label', '%s' % data['label_suffix']), ('Dimension', '%s' % data['dimension']), ('CM', is_CM), ('Base Change', is_base_change)] return render_template("hilbert_modular_form.html", downloads=info["downloads"], info=info, properties2=properties2, credit=hmf_credit, title=t, bread=bread, friends=info['friends'])
def S3primes(K, S, f, verbose=False): """f(x) defines the S3-extension of K """ # First: primes P such that f mod P is irreducible and P is inert # in K(sqrt(a)), for each a in K(S,2)/<D> where D=disc(f): if verbose: print("finding first set of primes") KS2, KS2_gens, from_KS2, to_KS2 = pSelmerGroup(K,S,ZZ(2)) D = f.discriminant() quo = KS2 / KS2.subspace([to_KS2(D)]) alphas = [from_KS2(quo.lift(w)) for w in quo if w] if verbose: print("alphas = {}".format(alphas)) alpha_flags = [False for _ in alphas] xK = polygen(K) quads = [xK**2-alpha for alpha in alphas] primes = primes_iter(K,None) Ta = Set() N = prod(S,1) while sum(alpha_flags)<len(alphas): p = primes.next() while p.divides(N): p = primes.next() # Now p is a candidate test prime if verbose: print("testing P={} (have covered {} alphas so far)".format(p,sum(alpha_flags))) Fp = residue_field(p) while not f.change_ring(Fp).is_irreducible(): if verbose: print("no good, f not irreducible mod p={}".format(p)) p = primes.next() while p.divides(N): p = primes.next() Fp = residue_field(p) if verbose: print("P={} passes first test".format(p)) # p has passed the first criterion: f mod p irreducible # p is useful if x^2-alpha irreducible mod p for some alpha for i,h in enumerate(quads): if not alpha_flags[i]: alpha_flags[i] = len(h.roots(Fp))==0 if alpha_flags[i]: if verbose: print("This p is good for alpha = {}".format(alphas[i])) Ta = Ta.union(Set([p])) # Now we try the next prime p, until all alphas are satisfied if verbose: print("Primes for first test: {}".format(Ta)) # Second: primes P such that g mod P is irreducible, for each quartic g with cubic resolvent f: L = K.extension(f,'b') quartics = A4_extensions_with_resolvent(K,S,L) Tb = Set() primes = primes_iter(K,None) quartic_flags = [False for _ in quartics] while sum(quartic_flags)<len(quartics): p = primes.next() while p.divides(N): p = primes.next() # Now p is a candidate test prime Fp = residue_field(p) for i,h in enumerate(quartics): if not quartic_flags[i]: quartic_flags[i] = h.change_ring(Fp).is_irreducible() if quartic_flags[i]: Tb = Tb.union(Set([p])) if verbose: print("Primes for second test: {}".format(Tb)) T = list(Ta.union(Tb)) if verbose: print("complete set of primes: {}".format(T)) return T
def create_from_data_string(self, label_or_field, L): """Takes an input line L from a raw data file and constructs the associated HMF object with given base field. String sample: <[31, 31, w + 12], "a", [-3, -2, 2, 4, -4, ...]>, """ data = self.dbdata = {} if isinstance(label_or_field, str): label = label_or_field data['field_label'] = label F = HilbertNumberField(label) if not F: raise ValueError("No Hilbert number field with label %s is in the database" % label) elif label_or_field == None: raise ValueError("Must specify a valid field label") else: # we were passed a HilbertNumberField already F = label_or_field data['field_label'] = F.label #print("data['field_label'] = %s" % data['field_label']) # The level i = L.find('[') j = L.find(']') data['level_ideal'] = L[i:j+1] #print("data['level_ideal'] = %s" % data['level_ideal']) N, n, alpha = data['level_ideal'][1:-1].split(',') data['level_norm'] = int(N) #print("data['level_norm'] = %s" % data['level_norm']) level = F.ideal_from_str(data['level_ideal'])[2] #print("level = %s" % level) data['level_label'] = F.ideal_label(level) #print("data['level_label'] = %s" % data['level_label']) # The weight data['parallel_weight'] = int(2) data['weight'] = str([data['parallel_weight']] * F.degree()) weight = [2] * F.degree() # The label i = L.find('"') j = L.find('"', i+1) data['label_suffix'] = L[i+1:j].replace(" ","") data['label'] = construct_full_label(data['field_label'], weight, data['level_label'], data['label_suffix']) data['short_label'] = '-'.join([data['level_label'], data['label_suffix']]) #print("data['label'] = %s" % data['label'] ) #print("data['short_label'] = %s" % data['short_label'] ) # The hecke polynomial and degree if 'x' in L: # non-rational i = L.find("x") j = L.find(i+1,",") data['hecke_polynomial'] = pol = L[i:j] data['dimension'] = int(1) x = polygen(QQ) hpol = x.parent()(str(pol)) data['dimension'] = int(hpol.degree()) else: # rational data['hecke_polynomial'] = 'x' data['dimension'] = int(1) i = L.rfind("[") j = L.rfind("]") data['hecke_eigenvalues'] = L[i+1:j].replace(" ","").split(",") data['hecke_eigenvalues'] = [unicode(s) for s in data['hecke_eigenvalues']] #print("hecke_eigenvalues = %s..." % data['hecke_eigenvalues'][:20]) # Find (some of the) AL-eigenvalues BP = level.prime_factors() BP_indices = [F.prime_index(P) for P in BP] print("BP_indices = %s" % BP_indices) BP_exponents = [level.valuation(P) for P in BP] #print("BP_exponents = %s" % BP_exponents) AL_eigs = [int(data['hecke_eigenvalues'][k]) for k in BP_indices] #print("AL_eigs = %s" % AL_eigs) if not all([(e==1 and eig in [-1,1]) or (eig==0) for e,eig in zip(BP_exponents,AL_eigs)]): print("Some bad AL-eigenvalues found") # NB the following will put 0 for the eigenvalue for primes # whose quare divides the level; this will need fixing later. data['AL_eigenvalues'] = [[F.primes[k],data['hecke_eigenvalues'][k]] for k in BP_indices] data['is_CM'] = '?' data['is_base_change'] = '?'
def render_hmf_webpage(**args): C = getDBConnection() data = None if 'label' in args: label = str(args['label']) data = C.hmfs.forms.find_one({'label': label}) if data is None: return "No such field" info = {} try: info['count'] = args['count'] except KeyError: info['count'] = 10 try: numeigs = request.args['numeigs'] numeigs = int(numeigs) except: numeigs = 20 hmf_field = C.hmfs.fields.find_one({'label': data['field_label']}) nf = WebNumberField(data['field_label']) info['base_galois_group'] = nf.galois_string() info['field_degree'] = nf.degree() info['field_disc'] = str(nf.disc()) info['field_poly'] = teXify_pol(str(nf.poly())) info.update(data) info['downloads'] = [('Download to Magma', url_for(".render_hmf_webpage_download", field_label=info['field_label'], label=info['label'], download_type='magma')), ('Download to Sage', url_for(".render_hmf_webpage_download", field_label=info['field_label'], label=info['label'], download_type='sage'))] info['friends'] = [] info['friends'] = [('L-function', url_for("l_functions.l_function_hmf_page", field=info['field_label'], label=info['label'], character='0', number='0'))] # info['learnmore'] = [('Number Field labels', # url_for("render_labels_page")), ('Galois group # labels',url_for("render_groups_page")), ('Discriminant # ranges',url_for("render_discriminants_page"))] bread = [('Hilbert Modular Forms', url_for(".hilbert_modular_form_render_webpage")), ('%s' % data['label'], ' ')] t = "Hilbert Cusp Form %s" % info['label'] credit = 'Lassina Dembele, Steve Donnelly and <A HREF="http://www.cems.uvm.edu/~voight/">John Voight</A>' forms_space = C.hmfs.forms.find({ 'field_label': data['field_label'], 'level_ideal': data['level_ideal'] }) dim_space = 0 for v in forms_space: dim_space += v['dimension'] info['newspace_dimension'] = dim_space w = polygen(QQ, 'w') e = polygen(QQ, 'e') eigs = data['hecke_eigenvalues'] eigs = eigs[:min(len(eigs), numeigs)] primes = hmf_field['primes'] n = min(len(eigs), len(primes)) info['eigs'] = [{ 'eigenvalue': teXify_pol(eigs[i]), 'prime_ideal': teXify_pol(primes[i]), 'prime_norm': primes[i][1:primes[i].index(',')] } for i in range(n)] try: display_eigs = request.args['display_eigs'] if display_eigs in ['True', 'true', '1', 'yes']: display_eigs = True else: display_eigs = False except KeyError: display_eigs = False if 'numeigs' in request.args: display_eigs = True info['hecke_polynomial'] = teXify_pol(info['hecke_polynomial']) if 'AL_eigenvalues_fixed' in data: if data['AL_eigenvalues_fixed'] == 'done': info['AL_eigs'] = [{ 'eigenvalue': teXify_pol(al[1]), 'prime_ideal': teXify_pol(al[0]), 'prime_norm': al[0][1:al[0].index(',')] } for al in data['AL_eigenvalues']] else: info['AL_eigs'] = [{'eigenvalue': '?', 'prime_ideal': '?'}] else: info['AL_eigs'] = [{'eigenvalue': '?', 'prime_ideal': '?'}] info['AL_eigs_count'] = len(info['AL_eigs']) != 0 if not display_eigs: for eig in info['eigs']: if len(eig['eigenvalue']) > 300: eig['eigenvalue'] = '...' for eig in info['AL_eigs']: if len(eig['eigenvalue']) > 300: eig['eigenvalue'] = '...' info['level_ideal'] = teXify_pol(info['level_ideal']) if 'is_CM' in data: is_CM = data['is_CM'] else: is_CM = '?' info['is_CM'] = is_CM if 'is_base_change' in data: is_base_change = data['is_base_change'] else: is_base_change = '?' info['is_base_change'] = is_base_change if 'q_expansions' in data: info['q_expansions'] = data['q_expansions'] properties2 = [('Field', '%s' % data['field_label']), ('Weight', '%s' % data['weight']), ('Level Norm', '%s' % data['level_norm']), ('Level', '$' + teXify_pol(data['level_ideal']) + '$'), ('Label', '%s' % data['label_suffix']), ('Dimension', '%s' % data['dimension']), ('CM?', is_CM), ('Base Change?', is_base_change)] return render_template("hilbert_modular_form.html", downloads=info["downloads"], info=info, properties2=properties2, credit=credit, title=t, bread=bread, friends=info['friends'])
def render_hmf_webpage(**args): C = getDBConnection() if 'data' in args: data = args['data'] label = data['label'] else: label = str(args['label']) data = C.hmfs.forms.find_one({'label': label}) if data is None: return "No such form" info = {} try: info['count'] = args['count'] except KeyError: info['count'] = 10 try: numeigs = request.args['numeigs'] numeigs = int(numeigs) except: numeigs = 20 hmf_field = C.hmfs.fields.find_one({'label': data['field_label']}) gen_name = findvar(hmf_field['ideals']) nf = WebNumberField(data['field_label'], gen_name=gen_name) info['field'] = nf info['base_galois_group'] = nf.galois_string() info['field_degree'] = nf.degree() info['field_disc'] = str(nf.disc()) info['field_poly'] = teXify_pol(str(nf.poly())) info.update(data) info['downloads'] = [ ('Download to Magma', url_for(".render_hmf_webpage_download", field_label=info['field_label'], label=info['label'], download_type='magma')), ('Download to Sage', url_for(".render_hmf_webpage_download", field_label=info['field_label'], label=info['label'], download_type='sage')) ] if hmf_field['narrow_class_no'] == 1: info['friends'] = [('L-function', url_for("l_functions.l_function_hmf_page", field=info['field_label'], label=info['label'], character='0', number='0'))] else: info['friends'] = [('L-function not available', "")] if data['dimension'] == 1: # Try to attach associated elliptic curve lab = split_class_label(info['label']) ec_from_hmf = db_ecnf().find_one({"label": label + '1'}) if ec_from_hmf == None: info['friends'] += [('Elliptic curve not available', "")] else: info['friends'] += [('Isogeny class ' + info['label'], url_for("ecnf.show_ecnf_isoclass", nf=lab[0], conductor_label=lab[1], class_label=lab[2]))] bread = [('Hilbert Modular Forms', url_for(".hilbert_modular_form_render_webpage")), ('%s' % data[ 'label'], ' ')] t = "Hilbert Cusp Form %s" % info['label'] forms_space = C.hmfs.forms.find( {'field_label': data['field_label'], 'level_ideal': data['level_ideal']}) dim_space = 0 for v in forms_space: dim_space += v['dimension'] info['newspace_dimension'] = dim_space w = polygen(QQ, 'w') e = polygen(QQ, 'e') eigs = data['hecke_eigenvalues'] eigs = eigs[:min(len(eigs), numeigs)] primes = hmf_field['primes'] n = min(len(eigs), len(primes)) info['eigs'] = [{'eigenvalue': teXify_pol(eigs[i]), 'prime_ideal': teXify_pol(primes[i]), 'prime_norm': primes[i][1:primes[i].index(',')]} for i in range(n)] try: display_eigs = request.args['display_eigs'] if display_eigs in ['True', 'true', '1', 'yes']: display_eigs = True else: display_eigs = False except KeyError: display_eigs = False if 'numeigs' in request.args: display_eigs = True info['hecke_polynomial'] = teXify_pol(info['hecke_polynomial']) if 'AL_eigenvalues_fixed' in data: if data['AL_eigenvalues_fixed'] == 'done': info['AL_eigs'] = [{'eigenvalue': teXify_pol(al[1]), 'prime_ideal': teXify_pol(al[0]), 'prime_norm': al[0][1:al[0].index(',')]} for al in data['AL_eigenvalues']] else: info['AL_eigs'] = [{'eigenvalue': '?', 'prime_ideal': '?'}] else: info['AL_eigs'] = [{'eigenvalue': '?', 'prime_ideal': '?'}] info['AL_eigs_count'] = len(info['AL_eigs']) != 0 max_eig_len = max([len(eig['eigenvalue']) for eig in info['eigs']]) display_eigs = display_eigs or (max_eig_len<=300) if not display_eigs: for eig in info['eigs']: if len(eig['eigenvalue']) > 300: eig['eigenvalue'] = '...' for eig in info['AL_eigs']: if len(eig['eigenvalue']) > 300: eig['eigenvalue'] = '...' info['level_ideal'] = teXify_pol(info['level_ideal']) if 'is_CM' in data: is_CM = data['is_CM'] else: is_CM = '?' info['is_CM'] = is_CM if 'is_base_change' in data: is_base_change = data['is_base_change'] else: is_base_change = '?' info['is_base_change'] = is_base_change if 'q_expansions' in data: info['q_expansions'] = data['q_expansions'] properties2 = [('Base field', '%s' % info['field'].field_pretty()), ('Weight', '%s' % data['weight']), ('Level norm', '%s' % data['level_norm']), ('Level', '$' + teXify_pol(data['level_ideal']) + '$'), ('Label', '%s' % data['label_suffix']), ('Dimension', '%s' % data['dimension']), ('CM', is_CM), ('Base change', is_base_change) ] return render_template("hilbert_modular_form.html", downloads=info["downloads"], info=info, properties2=properties2, credit=hmf_credit, title=t, bread=bread, friends=info['friends'], learnmore=learnmore_list())
def create_from_data_string(self, label_or_field, L): """Takes an input line L from a raw data file and constructs the associated HMF object with given base field. String sample: <[31, 31, w + 12], "a", [-3, -2, 2, 4, -4, ...]>, """ data = self.dbdata = {} if isinstance(label_or_field, str): label = label_or_field data['field_label'] = label F = HilbertNumberField(label) if not F: raise ValueError( "No Hilbert number field with label %s is in the database" % label) elif label_or_field is None: raise ValueError("Must specify a valid field label") else: # we were passed a HilbertNumberField already F = label_or_field data['field_label'] = F.label #print("data['field_label'] = %s" % data['field_label']) # The level i = L.find('[') j = L.find(']') data['level_ideal'] = L[i:j + 1] #print("data['level_ideal'] = %s" % data['level_ideal']) N, n, alpha = data['level_ideal'][1:-1].split(',') data['level_norm'] = int(N) #print("data['level_norm'] = %s" % data['level_norm']) level = F.ideal_from_str(data['level_ideal'])[2] #print("level = %s" % level) data['level_label'] = F.ideal_label(level) #print("data['level_label'] = %s" % data['level_label']) # The weight data['parallel_weight'] = int(2) data['weight'] = str([data['parallel_weight']] * F.degree()) weight = [2] * F.degree() # The label i = L.find('"') j = L.find('"', i + 1) data['label_suffix'] = L[i + 1:j].replace(" ", "") data['label'] = construct_full_label(data['field_label'], weight, data['level_label'], data['label_suffix']) data['short_label'] = '-'.join( [data['level_label'], data['label_suffix']]) #print("data['label'] = %s" % data['label'] ) #print("data['short_label'] = %s" % data['short_label'] ) # The hecke polynomial and degree if 'x' in L: # non-rational i = L.find("x") j = L.find(i + 1, ",") data['hecke_polynomial'] = pol = L[i:j] data['dimension'] = int(1) x = polygen(QQ) hpol = x.parent()(str(pol)) data['dimension'] = int(hpol.degree()) else: # rational data['hecke_polynomial'] = 'x' data['dimension'] = int(1) i = L.rfind("[") j = L.rfind("]") data['hecke_eigenvalues'] = L[i + 1:j].replace(" ", "").split(",") data['hecke_eigenvalues'] = [ text_type(s) for s in data['hecke_eigenvalues'] ] #print("hecke_eigenvalues = %s..." % data['hecke_eigenvalues'][:20]) # Find (some of the) AL-eigenvalues BP = level.prime_factors() BP_indices = [F.prime_index(P) for P in BP] print("BP_indices = %s" % BP_indices) BP_exponents = [level.valuation(P) for P in BP] #print("BP_exponents = %s" % BP_exponents) AL_eigs = [int(data['hecke_eigenvalues'][k]) for k in BP_indices] #print("AL_eigs = %s" % AL_eigs) if not all([(e == 1 and eig in [-1, 1]) or (eig == 0) for e, eig in zip(BP_exponents, AL_eigs)]): print("Some bad AL-eigenvalues found") # NB the following will put 0 for the eigenvalue for primes # whose quare divides the level; this will need fixing later. data['AL_eigenvalues'] = [[F.primes[k], data['hecke_eigenvalues'][k]] for k in BP_indices] data['is_CM'] = '?' data['is_base_change'] = '?'
def render_hmf_webpage(**args): C = getDBConnection() data = None if "label" in args: label = str(args["label"]) data = C.hmfs.forms.find_one({"label": label}) if data is None: return "No such field" info = {} try: info["count"] = args["count"] except KeyError: info["count"] = 10 try: numeigs = request.args["numeigs"] numeigs = int(numeigs) except: numeigs = 20 hmf_field = C.hmfs.fields.find_one({"label": data["field_label"]}) nf = WebNumberField(data["field_label"]) info["base_galois_group"] = nf.galois_string() info["field_degree"] = nf.degree() info["field_disc"] = str(nf.disc()) info["field_poly"] = teXify_pol(str(nf.poly())) info.update(data) info["downloads"] = [ ( "Download to Magma", url_for( ".render_hmf_webpage_download", field_label=info["field_label"], label=info["label"], download_type="magma", ), ), ( "Download to Sage", url_for( ".render_hmf_webpage_download", field_label=info["field_label"], label=info["label"], download_type="sage", ), ), ] info["friends"] = [] info["friends"] = [ ( "L-function", url_for( "l_functions.l_function_hmf_page", field=info["field_label"], label=info["label"], character="0", number="0", ), ) ] # info['learnmore'] = [('Number Field labels', # url_for("render_labels_page")), ('Galois group # labels',url_for("render_groups_page")), ('Discriminant # ranges',url_for("render_discriminants_page"))] bread = [("Hilbert Modular Forms", url_for(".hilbert_modular_form_render_webpage")), ("%s" % data["label"], " ")] t = "Hilbert Cusp Form %s" % info["label"] credit = 'Lassina Dembele, Steve Donnelly and <A HREF="http://www.cems.uvm.edu/~voight/">John Voight</A>' forms_space = C.hmfs.forms.find({"field_label": data["field_label"], "level_ideal": data["level_ideal"]}) dim_space = 0 for v in forms_space: dim_space += v["dimension"] info["newspace_dimension"] = dim_space w = polygen(QQ, "w") e = polygen(QQ, "e") eigs = data["hecke_eigenvalues"] eigs = eigs[: min(len(eigs), numeigs)] primes = hmf_field["primes"] n = min(len(eigs), len(primes)) info["eigs"] = [ { "eigenvalue": teXify_pol(eigs[i]), "prime_ideal": teXify_pol(primes[i]), "prime_norm": primes[i][1 : primes[i].index(",")], } for i in range(n) ] try: display_eigs = request.args["display_eigs"] if display_eigs in ["True", "true", "1", "yes"]: display_eigs = True else: display_eigs = False except KeyError: display_eigs = False if "numeigs" in request.args: display_eigs = True info["hecke_polynomial"] = teXify_pol(info["hecke_polynomial"]) if "AL_eigenvalues_fixed" in data: if data["AL_eigenvalues_fixed"] == "done": info["AL_eigs"] = [ { "eigenvalue": teXify_pol(al[1]), "prime_ideal": teXify_pol(al[0]), "prime_norm": al[0][1 : al[0].index(",")], } for al in data["AL_eigenvalues"] ] else: info["AL_eigs"] = [{"eigenvalue": "?", "prime_ideal": "?"}] else: info["AL_eigs"] = [{"eigenvalue": "?", "prime_ideal": "?"}] info["AL_eigs_count"] = len(info["AL_eigs"]) != 0 if not display_eigs: for eig in info["eigs"]: if len(eig["eigenvalue"]) > 300: eig["eigenvalue"] = "..." for eig in info["AL_eigs"]: if len(eig["eigenvalue"]) > 300: eig["eigenvalue"] = "..." info["level_ideal"] = teXify_pol(info["level_ideal"]) if "is_CM" in data: is_CM = data["is_CM"] else: is_CM = "?" info["is_CM"] = is_CM if "is_base_change" in data: is_base_change = data["is_base_change"] else: is_base_change = "?" info["is_base_change"] = is_base_change if "q_expansions" in data: info["q_expansions"] = data["q_expansions"] properties2 = [ ("Field", "%s" % data["field_label"]), ("Weight", "%s" % data["weight"]), ("Level Norm", "%s" % data["level_norm"]), ("Level", "$" + teXify_pol(data["level_ideal"]) + "$"), ("Label", "%s" % data["label_suffix"]), ("Dimension", "%s" % data["dimension"]), ("CM", is_CM), ("Base Change", is_base_change), ] return render_template( "hilbert_modular_form.html", downloads=info["downloads"], info=info, properties2=properties2, credit=credit, title=t, bread=bread, friends=info["friends"], )
def session(): from sqlalchemy.orm import sessionmaker Session = sessionmaker(bind=engine) return Session() ######################################################## # Convenience functions to use the database ######################################################## from sage.all import (QQ, ZZ, NumberField, polygen, dumps, gcd, parallel, divisors, cartesian_product_iterator) from sage.rings.all import is_Ideal from psage.modform.hilbert.sqrt5.hmf import primes_of_bounded_norm from psage.number_fields.sqrt5.prime import Prime x = polygen(QQ, 'x') F = NumberField(x**2 - x - 1, 'a') a = F.gen() def ideal_to_tuple(N): v = N.free_module().echelonized_basis_matrix().list() return int(v[0]), int(v[1]), int(v[3]) def tuple_to_ideal(t): return F.ideal([t[0] + a*t[1], t[2] + a*t[2]]) def fast_ideal(P): return Prime(P) if is_Ideal(P) else P def store_space(s, H): """
def render_hmf_webpage(**args): C = getDBConnection() data = None if 'label' in args: label = str(args['label']) data = C.hmfs.forms.find_one({'label': label}) if data is None: return "No such field" info = {} try: info['count'] = args['count'] except KeyError: info['count'] = 10 try: numeigs = request.args['numeigs'] numeigs = int(numeigs) except: numeigs = 20 hmf_field = C.hmfs.fields.find_one({'label': data['field_label']}) nf = WebNumberField(data['field_label']) info['base_galois_group'] = nf.galois_string() info['field_degree'] = nf.degree() info['field_disc'] = str(nf.disc()) info['field_poly'] = teXify_pol(str(nf.poly())) info.update(data) downloadslabel = '/ModularForm/GL2/' + info['field_label'] + '/holomorphic/' + info['label'] info['downloads'] = [('Download to Magma', downloadslabel + '/download/magma'), ( 'Download to Sage', downloadslabel + '/download/sage')] info['friends'] = [] info['friends'] = [('L-function', '/L/ModularForm/GL2/' + data['field_label'] + '/holomorphic/' + info['label'] + '/0/0')] # info['learnmore'] = [('Number Field labels', # url_for("render_labels_page")), ('Galois group # labels',url_for("render_groups_page")), ('Discriminant # ranges',url_for("render_discriminants_page"))] bread = [('Hilbert Modular Forms', url_for("hilbert_modular_form_render_webpage")), ('%s' % data[ 'label'], ' ')] t = "Hilbert Cusp Form %s" % info['label'] credit = 'Lassina Dembele, Steve Donnelly and <A HREF="http://www.cems.uvm.edu/~voight/">John Voight</A>' forms_space = C.hmfs.forms.find( {'field_label': data['field_label'], 'level_ideal': data['level_ideal']}) dim_space = 0 for v in forms_space: dim_space += v['dimension'] info['newspace_dimension'] = dim_space w = polygen(QQ, 'w') e = polygen(QQ, 'e') eigs = data['hecke_eigenvalues'] eigs = eigs[:min(len(eigs), numeigs)] primes = hmf_field['primes'] n = min(len(eigs), len(primes)) info['eigs'] = [{'eigenvalue': teXify_pol(eigs[i]), 'prime_ideal': teXify_pol(primes[i]), 'prime_norm': primes[i][1:primes[i].index(',')]} for i in range(n)] try: display_eigs = request.args['display_eigs'] if display_eigs in ['True', 'true', '1', 'yes']: display_eigs = True else: display_eigs = False except KeyError: display_eigs = False if 'numeigs' in request.args: display_eigs = True info['hecke_polynomial'] = teXify_pol(info['hecke_polynomial']) if 'AL_eigenvalues_fixed' in data: if data['AL_eigenvalues_fixed'] == 'done': info['AL_eigs'] = [{'eigenvalue': teXify_pol(al[1]), 'prime_ideal': teXify_pol(al[0]), 'prime_norm': al[0][1:al[0].index(',')]} for al in data['AL_eigenvalues']] else: info['AL_eigs'] = [{'eigenvalue': '?', 'prime_ideal': '?'}] else: info['AL_eigs'] = [{'eigenvalue': '?', 'prime_ideal': '?'}] info['AL_eigs_count'] = len(info['AL_eigs']) != 0 if not display_eigs: for eig in info['eigs']: if len(eig['eigenvalue']) > 300: eig['eigenvalue'] = '...' for eig in info['AL_eigs']: if len(eig['eigenvalue']) > 300: eig['eigenvalue'] = '...' info['level_ideal'] = teXify_pol(info['level_ideal']) if 'is_CM' in data: is_CM = data['is_CM'] else: is_CM = '?' info['is_CM'] = is_CM if 'is_base_change' in data: is_base_change = data['is_base_change'] else: is_base_change = '?' info['is_base_change'] = is_base_change if 'q_expansions' in data: info['q_expansions'] = data['q_expansions'] properties2 = [('Field', '%s' % data['field_label']), ('Weight', '%s' % data['weight']), ('Level Norm', '%s' % data['level_norm']), ('Level', '$' + teXify_pol(data['level_ideal']) + '$'), ('Label', '%s' % data['label_suffix']), ('Dimension', '%s' % data['dimension']), ('CM?', is_CM), ('Base Change?', is_base_change) ] return render_template("hilbert_modular_form/hilbert_modular_form.html", downloads=info["downloads"], info=info, properties2=properties2, credit=credit, title=t, bread=bread, friends=info['friends'])