def friends(self): f = [] cglink = url_character(type=self.type,number_field=self.nflabel,modulus=self.modlabel) f.append( ("Character group", cglink) ) if self.nflabel: f.append( ('Number Field', '/NumberField/' + self.nflabel) ) if self.type == 'Dirichlet': f.append( ('L function', '/L'+ url_character(type=self.type, number_field=self.nflabel, modulus=self.modlabel, number=self.numlabel) ) ) f.append( ("Value Field", '/NumberField/' + self.vflabel) ) return f
def character_search(**args): info = to_dict(args) for field in ['modulus', 'conductor', 'order']: info[field] = info.get(field, '') query = {} if 'natural' in args: label = info.get('natural', '') try: modulus = int(str(label).partition('.')[0]) number = int(str(label).partition('.')[2]) except ValueError: return "<span style='color:red;'>ERROR: bad query</span>" return redirect(url_character(type='Dirichlet',modulus=modulus, number=number)) else: for field in ['modulus', 'conductor', 'order']: if info.get(field): query[field] = parse_range(info[field]) info['bread'] = [('Characters','/Character'), ('search results', ' ') ] info['credit'] = 'Sage' if (len(query) != 0): from sage.modular.dirichlet import DirichletGroup info['contents'] = charactertable(query) info['title'] = 'Dirichlet Characters' return render_template("character_search.html", **info) else: return "<span style='color:red;'>ERROR: bad query</span>"
def friends(self): f = [] cglink = url_character(type=self.type, number_field=self.nflabel, modulus=self.modlabel) f.append(("Character group", cglink)) if self.nflabel: f.append(('Number Field', '/NumberField/' + self.nflabel)) if self.type == 'Dirichlet': f.append( ('L function', '/L' + url_character(type=self.type, number_field=self.nflabel, modulus=self.modlabel, number=self.numlabel))) f.append(("Value Field", '/NumberField/' + self.vflabel)) return f
def character_search(**args): info = to_dict(args) for field in ["modulus", "conductor", "order"]: info[field] = info.get(field, "") query = {} if "natural" in args: label = info.get("natural", "") try: modulus = int(str(label).partition(".")[0]) number = int(str(label).partition(".")[2]) except ValueError: return "<span style='color:red;'>ERROR: bad query</span>" return redirect(url_character(type="Dirichlet", modulus=modulus, number=number)) else: for field in ["modulus", "conductor", "order"]: if info.get(field): query[field] = parse_range(info[field]) info["bread"] = [("Characters", "/Character"), ("search results", " ")] info["credit"] = "Sage" if len(query) != 0: from sage.modular.dirichlet import DirichletGroup info["contents"] = charactertable(query) info["title"] = "Dirichlet Characters" return render_template("character_search.html", **info) else: return "<span style='color:red;'>ERROR: bad query</span>"
def character_search(**args): info = to_dict(args) for field in ['modulus', 'conductor', 'order']: info[field] = info.get(field, '') query = {} if 'natural' in args: label = info.get('natural', '') try: modulus = int(str(label).partition('.')[0]) number = int(str(label).partition('.')[2]) except ValueError: return "<span style='color:red;'>ERROR: bad query</span>" return redirect( url_character(type='Dirichlet', modulus=modulus, number=number)) else: for field in ['modulus', 'conductor', 'order']: if info.get(field): query[field] = parse_range(info[field]) info['bread'] = [('Characters', '/Character'), ('search results', ' ')] info['credit'] = 'Sage' if (len(query) != 0): from sage.modular.dirichlet import DirichletGroup info['contents'] = charactertable(query) info['title'] = 'Dirichlet Characters' return render_template("character_search.html", **info) else: return "<span style='color:red;'>ERROR: bad query</span>"
def set_info_for_modular_form_space(level=None, weight=None, character=None, label=None, **kwds): r""" Set information about a space of modular forms. """ info = dict() info['level'] = level info['weight'] = weight info['character'] = character emf_logger.debug("info={0}".format(info)) if(level > N_max_db or weight > k_max_db): info['error'] = "Currently not available" WMFS = None if level <= 0: info['error'] = "Got wrong level: %s " % level return info try: if use_db: WMFS = WebModFormSpace(weight, level, character, use_db=True) else: WMFS = WebModFormSpace(weight, level, character) if 'download' in info and 'tempfile' in info: WNF._save_to_file(info['tempfile']) info['filename'] = str(weight) + '-' + str(level) + '-' + str(character) + '-' + label + '.sobj' return info except RuntimeError: info['error'] = "Sage error: Could not construct the desired space!" if WMFS.level() == 1: info['group'] = "\( \mathrm{SL}_{2}(\mathbb{Z})\)" else: info['group'] = "\( \Gamma_{{0}}( {0} ) \)".format(WMFS.level()) if character == 0: info['name_new'] = "\(S_{ %s }^{new}(%s) \)" % (WMFS.weight(), WMFS.level()) info['name_old'] = "\(S_{ %s }^{old}(%s) \)" % (WMFS.weight(), WMFS.level()) else: conrey_char = WMFS.conrey_character() conrey_char_name = WMFS.conrey_character_name() info['conrey_character_name'] = '\( ' + conrey_char_name + '\)' info['character_url'] = url_character(type='Dirichlet', modulus=WMFS.level(), number=conrey_char.number()) info['name_new'] = "\(S_{ %s }^{new}(%s,%s) \)" % (WMFS.weight(), WMFS.level(), conrey_char_name) info['name_old'] = "\(S_{ %s }^{old}(%s,%s) \)" % (WMFS.weight(), WMFS.level(), conrey_char_name) info['dimension_cusp_forms'] = WMFS.dimension_cusp_forms() info['dimension_mod_forms'] = WMFS.dimension_modular_forms() info['dimension_new_cusp_forms'] = WMFS.dimension_new_cusp_forms() info['dimension_newspace'] = WMFS.dimension_newspace() info['dimension_oldspace'] = WMFS.dimension_oldspace() info['dimension'] = WMFS.dimension() info['galois_orbits'] = WMFS.get_all_galois_orbit_info() lifts = list() if WMFS.dimension() == 0: # we don't need to work with an empty space info['sturm_bound'] = 0 info['new_decomposition'] = '' info['is_empty'] = 1 lifts.append(('Half-Integral Weight Forms', '/ModularForm/Mp2/Q')) lifts.append(('Siegel Modular Forms', '/ModularForm/GSp4/Q')) info['lifts'] = lifts return info info['sturm_bound'] = WMFS.sturm_bound() info['new_decomposition'] = WMFS.print_galois_orbits() emf_logger.debug("new_decomp={0}".format(info['new_decomposition'])) info['nontrivial_new'] = len(info['new_decomposition']) ## we try to catch well-known bugs... info['old_decomposition'] = "n/a" if level < N_max_comp: try: O = WMFS.print_oldspace_decomposition() info['old_decomposition'] = O except: emf_logger.critical("Error in computing oldspace decomposition") O = [] info['old_decomposition'] = "n/a" (A, B, C) = sys.exc_info() # build an error message... errtype = A.__name__ errmsg = B s = "%s: %s at:" % (errtype, errmsg) next = C.tb_next while(next): ln = next.tb_lineno filen = next.tb_frame.f_code.co_filename s += "\n line no. %s in file %s" % (ln, filen) next = next.tb_next info['error_note'] = "Could not construct oldspace!\n" + s # properties for the sidebar prop = [] if WMFS._cuspidal == 1: prop = [('Dimension newforms', [info['dimension_newspace']])] prop.append(('Dimension oldforms', [info['dimension_oldspace']])) else: prop = [('Dimension modular forms', [info['dimension_mod_forms']])] prop.append(('Dimension cusp forms', [info['dimension_cusp_forms']])) prop.append(('Sturm bound', [WMFS.sturm_bound()])) info['properties2'] = prop ## Make parent spaces of S_k(N,chi) for the sidebar par_lbl = '\( S_{*} (\Gamma_0(' + str(level) + '),\cdot )\)' par_url = '?level=' + str(level) parents = [[par_lbl, par_url]] par_lbl = '\( S_{k} (\Gamma_0(' + str(level) + '),\cdot )\)' par_url = '?level=' + str(level) + '&weight=' + str(weight) parents.append((par_lbl, par_url)) info['parents'] = parents if 'character' in info: info['character_order'] = WMFS.character_order() info['character_conductor'] = WMFS.character_conductor() friends = list() lifts = list() if(('label' not in info) and info['old_decomposition'] != 'n/a'): O = WMFS.oldspace_decomposition() try: for (old_level, chi, mult, d) in O: if chi != 0: s = "\(S_{%s}(\Gamma_0(%s),\chi_{%s}) \) " % (weight, old_level, chi) friends.append(( s, '?weight=' + str(weight) + '&level=' + str(old_level) + '&character=' + str(chi))) else: s = "\(S_{%s}(\Gamma_0(%s)) \) " % (weight, old_level) friends.append( (s, '?weight=' + str(weight) + '&level=' + str(old_level) + '&character=' + str(0))) except: pass info['friends'] = friends lifts.append(('Half-Integral Weight Forms', '/ModularForm/Mp2/Q')) lifts.append(('Siegel Modular Forms', '/ModularForm/GSp4/Q')) info['lifts'] = lifts return info
def evs_table2(search, twodarray=False): DB = connect_db() table = [] nrows = 0 fs = DB.get_Maass_forms(search) mwf_logger.debug("numrec:{0}".format(len(fs))) for f in fs: # indices: row = {} R = f.get('Eigenvalue', None) N = f.get('Level', None) k = f.get('Weight', None) if R is None or N is None or k is None: continue row['R'] = R row['N'] = N if k == 0 or k == 1: row['k'] = int(k) else: row['k'] = k ## chi = f.get('Character', 0) conrey = f.get('Conrey', 0) if conrey == 0: # we need to change to conrey's notation chi = DB.getDircharConrey(N, chi) ## Now get the COnrey number. ## First the character if k == 0: url = url_character(type='Dirichlet', modulus=N, number=chi) s = "<a href={0}>{1}</a>".format(url, chi) row['ch'] = s else: row['ch'] = "eta" st = f.get('Symmetry', -1) if st == 1: st = "odd" elif st == 0: st = "even" else: st = "n/a" row['symmetry'] = st er = f.get('Error', 0) if er > 0: er = "{0:1.0e}".format(er) else: er = "unknown" row['err'] = er dim = f.get('Dim', 0) if dim is None: dim = 1 # "undefined" row['dim'] = dim numc = f.get('Numc', 0) row['numc'] = numc cev = f.get('Cusp_evs', []) row['fricke'] = 'n/a' row['cuspevs'] = 'n/a' if row['k'] == 0 and isinstance(cev, list): if len(cev) > 1: fricke = cev[1] row['fricke'] = fricke s = '{0}'.format(cev[0]) for j in range(1, len(cev)): s += ",{0}".format(cev[j]) elif len(cev) == 1: s = str(cev[0]) elif len(cev) == 0: s = 'n/a' row['cuspevs'] = s url = url_for('mwf.render_one_maass_waveform', maass_id=f.get('_id')) row['url'] = url nrows += 1 if twodarray: s = '<a href="{0}">{1}</a>'.format(row['url'], row['R']) rowr = [row['N'], row['k'], row['ch'], s, row['symmetry'], row['err'], row['dim'], row['numc'], row['fricke'], row['cuspevs']] table.append(rowr) else: # row=row.values() table.append(row) mwf_logger.debug("nrows:".format(nrows)) evs = {'table': {}} evs['table']['data'] = table evs['table']['nrows'] = nrows evs['table']['ncols'] = 10 evs['table']['colheads'] = [] knowls = ['mf.maass.mwf.level', 'mf.maass.mwf.weight', 'mf.maass.mwf.character', 'mf.maass.mwf.eigenvalue', 'mf.maass.mwf.symmetry', 'mf.maass.mwf.precision', 'mf.maass.mwf.dimension', 'mf.maass.mwf.ncoefficients', 'mf.maass.mwf.fricke', 'mf.maass.mwf.atkinlehner'] titles = ['Level', 'Weight', 'Char', 'Eigenvalue', 'Symmetry', 'Precision', 'Mult.', 'Coeff.', 'Fricke', 'Atkin-Lehner'] for i in range(10): evs['table']['colheads'].append((knowls[i], titles[i])) if 'limit' in search: search.pop('limit') if 'skip' in search: search.pop('skip') evs['totalrecords'] = DB.count(search, filtered=False) evs['totalrecords_filtered'] = DB.count(search, filtered=True) return evs
def dirichlet_table(): args = to_dict(request.args) mod = args.get("modulus", 1) return redirect(url_character(type="Dirichlet", modulus=mod))
def navi(L): r = [(l, url_character(**args)) for l, args in L if l] return r
def render_field_webpage(args): data = None C = base.getDBConnection() info = {} bread = [('Global Number Fields', url_for(".number_field_render_webpage"))] if 'label' in args: label = clean_input(args['label']) nf = WebNumberField(label) data = {} if nf.is_null(): bread.append(('Search results', ' ')) label2 = re.sub(r'[<>]', '', args['label']) if 'You need to enter a field' in label2: info['err'] = label2 else: info['err'] = 'No such field: %s in the database' % label2 info['label'] = args['label_orig'] if 'label_orig' in args else args['label'] return search_input_error(info, bread) info['wnf'] = nf from lmfdb.WebNumberField import nf_display_knowl 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,·)$</a>' % (url_character(type='Dirichlet',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() 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.K()) data['phrase'] = group_phrase(n, t, C) zk = pari(nf.K()).nf_subst('a') zk = list(zk.nf_get_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() pretty_label = field_pretty(label) if label != pretty_label: pretty_label = "%s: %s" % (label, pretty_label) info.update(data) info.update({ 'label': pretty_label, 'label_raw': label, 'polynomial': web_latex_split_on_pm(nf.K().defining_polynomial()), 'ram_primes': ram_primes, 'integral_basis': zk, 'regulator': web_latex(nf.regulator()), 'unit_rank': nf.unit_rank(), 'root_of_unity': web_latex(nf.K().primitive_root_of_unity()), '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(): 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"))] # 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 = [('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.find_one({"label": label}) v = nf.factor_perm_repn(info["tim_number_field"]) info["mydecomp"] = ['*' if x>0 else '' 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, friends=info.pop('friends'), learnmore=info.pop('learnmore'), info=info)
def render_field_webpage(args): data = None C = base.getDBConnection() info = {} bread = [('Global Number Fields', url_for(".number_field_render_webpage"))] if 'label' in args: label = clean_input(args['label']) nf = WebNumberField(label) data = {} if nf.is_null(): bread.append(('Search results', ' ')) label2 = re.sub(r'[<>]', '', args['label']) if 'You need to enter a field' in label2: info['err'] = label2 else: info['err'] = 'No such field: %s in the database' % label2 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,·)$</a>' % (url_character(type='Dirichlet',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() 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.K()) data['phrase'] = group_phrase(n, t, C) zk = pari(nf.K()).nf_subst('a') zk = list(zk.nf_get_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() pretty_label = field_pretty(label) if label != pretty_label: pretty_label = "%s: %s" % (label, pretty_label) info.update(data) info.update({ 'label': pretty_label, 'label_raw': label, 'polynomial': web_latex_split_on_pm(nf.K().defining_polynomial()), 'ram_primes': ram_primes, 'integral_basis': zk, 'regulator': web_latex(nf.regulator()), 'unit_rank': nf.unit_rank(), 'root_of_unity': web_latex(nf.K().primitive_root_of_unity()), '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(): 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"))] # 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 = [('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.find_one({"label": label}) v = nf.factor_perm_repn(info["tim_number_field"]) info["mydecomp"] = ['*' if x>0 else '' 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, friends=info.pop('friends'), learnmore=info.pop('learnmore'), info=info)
def initLfunction(L, args, request): ''' Sets the properties to show on the homepage of an L-function page. ''' info = {'title': L.title} try: info['citation'] = L.citation except AttributeError: info['citation'] = "" try: info['support'] = L.support except AttributeError: info['support'] = "" info['Ltype'] = L.Ltype() # Here we should decide which values are indeed special values # According to Brian, odd degree has special value at 1, and even # degree has special value at 1/2. # (however, I'm not sure this is true if L is not primitive -- GT) # Now we usually display both if L.Ltype() != "artin" or (L.Ltype() == "artin" and L.sign != 0): # if is_even(L.degree) : # info['sv12'] = specialValueString(L, 0.5, '1/2') # if is_odd(L.degree): # info['sv1'] = specialValueString(L, 1, '1') info['sv1'] = specialValueString(L, 1, '1') info['sv12'] = specialValueString(L, 0.5, '1/2') info['args'] = args info['credit'] = L.credit # info['citation'] = L.citation try: info['factorization'] = L.factorization except: pass try: info['url'] = L.url except: info['url'] = '' info['degree'] = int(L.degree) info['zeroeslink'] = (request.url.replace('/L/', '/L/Zeros/').replace( '/Lfunction/', '/L/Zeros/').replace('/L-function/', '/L/Zeros/') ) # url_for('zeroesLfunction', **args) info['plotlink'] = ( request.url.replace('/L/', '/L/Plot/').replace( '/Lfunction/', '/L/Plot/').replace('/L-function/', '/L/Plot/') ) # info['plotlink'] = url_for('plotLfunction', **args) info['bread'] = [] info['properties2'] = set_gaga_properties(L) # Create friendlink by removing 'L/' and ending '/' friendlink = request.url.replace('/L/', '/').replace('/L-function/', '/').replace( '/Lfunction/', '/') splitlink = friendlink.rpartition('/') friendlink = splitlink[0] + splitlink[2] logger.debug(L.Ltype()) if L.Ltype() == 'maass': if L.group == 'GL2': minNumberOfCoefficients = 100 # TODO: Fix this to take level into account if len(L.dirichlet_coefficients) < minNumberOfCoefficients: info['zeroeslink'] = '' info['plotlink'] = '' info['bread'] = get_bread( 2, [('Maass Form', url_for('.l_function_maass_browse_page')), ('\(' + L.texname + '\)', request.url)]) info['friends'] = [('Maass Form ', friendlink)] else: info['bread'] = get_bread( L.degree, [('Maass Form', url_for('.l_function_maass_gln_browse_page', degree='degree' + str(L.degree))), (L.dbid, request.url)]) elif L.Ltype() == 'riemann': info['bread'] = get_bread(1, [('Riemann Zeta', request.url)]) info['friends'] = [('\(\mathbb Q\)', url_for('number_fields.by_label', label='1.1.1.1')), ('Dirichlet Character \(\\chi_{1}(1,\\cdot)\)', url_character(type='Dirichlet', modulus=1, number=1))] elif L.Ltype() == 'dirichlet': mod, num = L.charactermodulus, L.characternumber Lpattern = r"\(L(s,\chi_{%s}(%s,·))\)" if mod > 1: pmod, pnum = WebDirichlet.prevprimchar(mod, num) Lprev = (Lpattern % (pmod, pnum), url_for('.l_function_dirichlet_page', modulus=pmod, number=pnum)) else: Lprev = ('', '') nmod, nnum = WebDirichlet.nextprimchar(mod, num) Lnext = (Lpattern % (nmod, nnum), url_for('.l_function_dirichlet_page', modulus=nmod, number=nnum)) info['navi'] = (Lprev, Lnext) snum = str(L.characternumber) smod = str(L.charactermodulus) charname = WebDirichlet.char2tex(smod, snum) info['bread'] = get_bread(1, [(charname, request.url)]) info['friends'] = [('Dirichlet Character ' + str(charname), friendlink) ] elif L.Ltype() == 'ellipticcurveQ': label = L.label while friendlink[len(friendlink) - 1].isdigit( ): # Remove any number at the end to get isogeny class url friendlink = friendlink[0:len(friendlink) - 1] info['friends'] = [('Isogeny class ' + label, friendlink)] for i in range(1, L.nr_of_curves_in_class + 1): info['friends'].append( ('Elliptic curve ' + label + str(i), friendlink + str(i))) if L.modform: info['friends'].append( ('Modular form ' + label.replace('.', '.2'), url_for("emf.render_elliptic_modular_forms", level=L.modform['level'], weight=2, character=0, label=L.modform['iso']))) info['friends'].append(('L-function ' + label.replace('.', '.2'), url_for('.l_function_emf_page', level=L.modform['level'], weight=2, character=0, label=L.modform['iso'], number=0))) info['friends'].append(('Symmetric square L-function', url_for(".l_function_ec_sym_page", power='2', label=label))) info['friends'].append(('Symmetric cube L-function', url_for(".l_function_ec_sym_page", power='3', label=label))) info['bread'] = get_bread( 2, [('Elliptic curve', url_for('.l_function_ec_browse_page')), (label, url_for('.l_function_ec_page', label=label))]) elif L.Ltype() == 'ellipticmodularform': friendlink = friendlink + L.addToLink # Strips off the embedding friendlink = friendlink.rpartition('/')[0] # number for the L-function if L.character: info['friends'] = [ ('Modular form ' + str(L.level) + '.' + str(L.weight) + '.' + str(L.character) + str(L.label), friendlink) ] else: info['friends'] = [('Modular form ' + str(L.level) + '.' + str(L.weight) + str(L.label), friendlink)] if L.ellipticcurve: info['friends'].append(('EC isogeny class ' + L.ellipticcurve, url_for("by_ec_label", label=L.ellipticcurve))) info['friends'].append( ('L-function ' + str(L.level) + '.' + str(L.label), url_for('.l_function_ec_page', label=L.ellipticcurve))) for i in range(1, L.nr_of_curves_in_class + 1): info['friends'].append( ('Elliptic curve ' + L.ellipticcurve + str(i), url_for("by_ec_label", label=L.ellipticcurve + str(i)))) info['friends'].append(('Symmetric square L-function', url_for(".l_function_ec_sym_page", power='2', label=label))) info['friends'].append(('Symmetric cube L-function', url_for(".l_function_ec_sym_page", power='3', label=label))) elif L.Ltype() == 'hilbertmodularform': friendlink = '/'.join(friendlink.split('/')[:-1]) info['friends'] = [('Hilbert Modular Form', friendlink.rpartition('/')[0])] elif L.Ltype() == 'dedekindzeta': info['friends'] = [('Number Field', friendlink)] elif L.Ltype() in ['lcalcurl', 'lcalcfile']: info['bread'] = [('L-functions', url_for('.l_function_top_page'))] elif L.Ltype() == 'SymmetricPower': def ordinal(n): if n == 2: return "Square" elif n == 3: return "Cube" elif 10 <= n % 100 < 20: return str(n) + "th Power" else: return str(n) + { 1: 'st', 2: 'nd', 3: 'rd' }.get(n % 10, "th") + " Power" if L.m == 2: info['bread'] = get_bread(3, [ ("Symmetric square of Elliptic curve", url_for('.l_function_ec_sym2_browse_page')), (L.label, url_for('.l_function_ec_sym_page', label=L.label, power=L.m)) ]) elif L.m == 3: info['bread'] = get_bread(4, [ ("Symmetric cube of Elliptic curve", url_for('.l_function_ec_sym3_browse_page')), (L.label, url_for('.l_function_ec_sym_page', label=L.label, power=L.m)) ]) else: info['bread'] = [ ('L-functions', url_for('.l_function_top_page')), ('Symmetric %s of Elliptic curve ' % ordinal(L.m) + str(L.label), url_for('.l_function_ec_sym_page', label=L.label, power=L.m)) ] friendlink = request.url.replace('/L/SymmetricPower/%d/' % L.m, '/') splitlink = friendlink.rpartition('/') friendlink = splitlink[0] + splitlink[2] friendlink2 = request.url.replace('/L/SymmetricPower/%d/' % L.m, '/L/') splitlink = friendlink2.rpartition('/') friendlink2 = splitlink[0] + splitlink[2] info['friends'] = [('Isogeny class ' + L.label, friendlink), ('Symmetric 1st Power', friendlink2)] for j in range(2, L.m + 2): if j != L.m: friendlink3 = request.url.replace( '/L/SymmetricPower/%d/' % L.m, '/L/SymmetricPower/%d/' % j) info['friends'].append( ('Symmetric %s' % ordinal(j), friendlink3)) elif L.Ltype() == 'siegelnonlift' or L.Ltype( ) == 'siegeleisenstein' or L.Ltype( ) == 'siegelklingeneisenstein' or L.Ltype() == 'siegelmaasslift': weight = str(L.weight) number = str(L.number) info['friends'] = [('Siegel Modular Form', friendlink)] elif L.Ltype() == "artin": # info['zeroeslink'] = '' # info['plotlink'] = '' info['friends'] = [('Artin representation', L.artin.url_for())] if L.sign == 0: # The root number is now unknown info['zeroeslink'] = '' info['plotlink'] = '' info['dirichlet'] = lfuncDStex(L, "analytic") info['eulerproduct'] = lfuncEPtex(L, "abstract") info['functionalequation'] = lfuncFEtex(L, "analytic") info['functionalequationSelberg'] = lfuncFEtex(L, "selberg") if len(request.args) == 0: lcalcUrl = request.url + '?download=lcalcfile' else: lcalcUrl = request.url + '&download=lcalcfile' info['downloads'] = [('Lcalcfile', lcalcUrl)] return info
def dirichlet_table(): args = to_dict(request.args) mod = args.get('modulus', 1) return redirect(url_character(type='Dirichlet', modulus=mod))
def evs_table2(search, twodarray=False): DB = connect_db() table = [] nrows = 0 fs = DB.get_Maass_forms(search) mwf_logger.debug("numrec:{0}".format(len(fs))) for f in fs: # indices: row = {} R = f.get('Eigenvalue', None) N = f.get('Level', None) k = f.get('Weight', None) if R is None or N is None or k is None: continue row['R'] = R row['N'] = N if k == 0 or k == 1: row['k'] = int(k) else: row['k'] = k ## chi = f.get('Character', 0) conrey = f.get('Conrey', 0) if conrey == 0: # we need to change to conrey's notation chi = DB.getDircharConrey(N, chi) ## Now get the COnrey number. ## First the character if k == 0: url = url_character(type='Dirichlet', modulus=N, number=chi) s = "<a href={0}>{1}</a>".format(url, chi) row['ch'] = s else: row['ch'] = "eta" st = f.get('Symmetry', -1) if st == 1: st = "odd" elif st == 0: st = "even" else: st = "n/a" row['symmetry'] = st er = f.get('Error', 0) if er > 0: er = "{0:1.0e}".format(er) else: er = "unknown" row['err'] = er dim = f.get('Dim', 0) if dim is None: dim = 1 # "undefined" row['dim'] = dim numc = f.get('Numc', 0) row['numc'] = numc cev = f.get('Cusp_evs', []) row['fricke'] = 'n/a' row['cuspevs'] = 'n/a' if row['k'] == 0 and isinstance(cev, list): if len(cev) > 1: fricke = cev[1] row['fricke'] = fricke s = '{0}'.format(cev[0]) for j in range(1, len(cev)): s += ",{0}".format(cev[j]) elif len(cev) == 1: s = str(cev[0]) elif len(cev) == 0: s = 'n/a' row['cuspevs'] = s url = url_for('mwf.render_one_maass_waveform', maass_id=f.get('_id')) row['url'] = url nrows += 1 if twodarray: s = '<a href="{0}">{1}</a>'.format(row['url'], row['R']) rowr = [ row['N'], row['k'], row['ch'], s, row['symmetry'], row['err'], row['dim'], row['numc'], row['fricke'], row['cuspevs'] ] table.append(rowr) else: # row=row.values() table.append(row) mwf_logger.debug("nrows:".format(nrows)) evs = {'table': {}} evs['table']['data'] = table evs['table']['nrows'] = nrows evs['table']['ncols'] = 10 evs['table']['colheads'] = [] knowls = [ 'mf.maass.mwf.level', 'mf.maass.mwf.weight', 'mf.maass.mwf.character', 'mf.maass.mwf.eigenvalue', 'mf.maass.mwf.symmetry', 'mf.maass.mwf.precision', 'mf.maass.mwf.dimension', 'mf.maass.mwf.ncoefficients', 'mf.maass.mwf.fricke', 'mf.maass.mwf.atkinlehner' ] titles = [ 'Level', 'Weight', 'Char', 'Eigenvalue', 'Symmetry', 'Precision', 'Mult.', 'Coeff.', 'Fricke', 'Atkin-Lehner' ] for i in range(10): evs['table']['colheads'].append((knowls[i], titles[i])) if 'limit' in search: search.pop('limit') if 'skip' in search: search.pop('skip') evs['totalrecords'] = DB.count(search, filtered=False) evs['totalrecords_filtered'] = DB.count(search, filtered=True) return evs
def add_row(self, nflabel): nf = WebNumberField(nflabel) #nflink = (nflabel, url_for('number_fields.by_label',label=nflabel)) nflink = (nflabel, url_character(type='Hecke',number_field=nflabel)) F = WebHeckeFamily(number_field=nflabel) self._contents.append( (nflink, nf.signature(), nf.web_poly() ) )
def initLfunction(L, args, request): ''' Sets the properties to show on the homepage of an L-function page. ''' info = {'title': L.title} try: info['citation'] = L.citation except AttributeError: info['citation'] = "" try: info['support'] = L.support except AttributeError: info['support'] = "" info['Ltype'] = L.Ltype() # Here we should decide which values are indeed special values # According to Brian, odd degree has special value at 1, and even # degree has special value at 1/2. # (however, I'm not sure this is true if L is not primitive -- GT) # Now we usually display both if L.Ltype() != "artin" or (L.Ltype() == "artin" and L.sign != 0): # if is_even(L.degree) : # info['sv12'] = specialValueString(L, 0.5, '1/2') # if is_odd(L.degree): # info['sv1'] = specialValueString(L, 1, '1') info['sv1'] = specialValueString(L, 1, '1') info['sv12'] = specialValueString(L, 0.5, '1/2') info['args'] = args info['credit'] = L.credit # info['citation'] = L.citation try: info['factorization'] = L.factorization except: pass try: info['url'] = L.url except: info['url'] = '' info['degree'] = int(L.degree) info['zeroeslink'] = (request.url.replace('/L/', '/L/Zeros/'). replace('/Lfunction/', '/L/Zeros/'). replace('/L-function/', '/L/Zeros/')) # url_for('zeroesLfunction', **args) info['plotlink'] = (request.url.replace('/L/', '/L/Plot/'). replace('/Lfunction/', '/L/Plot/'). replace('/L-function/', '/L/Plot/')) # info['plotlink'] = url_for('plotLfunction', **args) info['bread'] = [] info['properties2'] = set_gaga_properties(L) # Create friendlink by removing 'L/' and ending '/' friendlink = request.url.replace('/L/', '/').replace('/L-function/', '/').replace('/Lfunction/', '/') splitlink = friendlink.rpartition('/') friendlink = splitlink[0] + splitlink[2] logger.debug(L.Ltype()) if L.Ltype() == 'maass': if L.group == 'GL2': minNumberOfCoefficients = 100 # TODO: Fix this to take level into account if len(L.dirichlet_coefficients) < minNumberOfCoefficients: info['zeroeslink'] = '' info['plotlink'] = '' info['bread'] = get_bread(2, [('Maass Form', url_for('.l_function_maass_browse_page')), ('\(' + L.texname + '\)', request.url)]) info['friends'] = [('Maass Form ', friendlink)] else: info['bread'] = get_bread(L.degree, [('Maass Form', url_for('.l_function_maass_gln_browse_page', degree='degree' + str(L.degree))), (L.dbid, request.url)]) elif L.Ltype() == 'riemann': info['bread'] = get_bread(1, [('Riemann Zeta', request.url)]) info['friends'] = [('\(\mathbb Q\)', url_for('number_fields.by_label', label='1.1.1.1')), ('Dirichlet Character \(\\chi_{1}(1,\\cdot)\)', url_character(type='Dirichlet', modulus=1, number=1))] elif L.Ltype() == 'dirichlet': mod, num = L.charactermodulus, L.characternumber Lpattern = r"\(L(s,\chi_{%s}(%s,·))\)" if mod > 1: pmod,pnum = WebDirichlet.prevprimchar(mod, num) Lprev = (Lpattern%(pmod,pnum),url_for('.l_function_dirichlet_page',modulus=pmod,number=pnum)) else: Lprev = ('','') nmod,nnum = WebDirichlet.nextprimchar(mod, num) Lnext = (Lpattern%(nmod,nnum),url_for('.l_function_dirichlet_page',modulus=nmod,number=nnum)) info['navi'] = (Lprev,Lnext) snum = str(L.characternumber) smod = str(L.charactermodulus) charname = WebDirichlet.char2tex(smod, snum) info['bread'] = get_bread(1, [(charname, request.url)]) info['friends'] = [('Dirichlet Character ' + str(charname), friendlink)] elif L.Ltype() == 'ellipticcurveQ': label = L.label while friendlink[len(friendlink) - 1].isdigit(): # Remove any number at the end to get isogeny class url friendlink = friendlink[0:len(friendlink) - 1] info['friends'] = [('Isogeny class ' + label, friendlink)] for i in range(1, L.nr_of_curves_in_class + 1): info['friends'].append(('Elliptic curve ' + label + str(i), friendlink + str(i))) if L.modform: info['friends'].append(('Modular form ' + label.replace('.', '.2'), url_for("emf.render_elliptic_modular_forms", level=L.modform['level'], weight=2, character=0, label=L.modform['iso']))) info['friends'].append(('L-function ' + label.replace('.', '.2'), url_for('.l_function_emf_page', level=L.modform['level'], weight=2, character=0, label=L.modform['iso'], number=0))) info['friends'].append( ('Symmetric square L-function', url_for(".l_function_ec_sym_page", power='2', label=label))) info['friends'].append( ('Symmetric cube L-function', url_for(".l_function_ec_sym_page", power='3', label=label))) info['bread'] = get_bread(2, [('Elliptic curve', url_for('.l_function_ec_browse_page')), (label, url_for('.l_function_ec_page', label=label))]) elif L.Ltype() == 'ellipticmodularform': friendlink = friendlink + L.addToLink # Strips off the embedding friendlink = friendlink.rpartition('/')[0] # number for the L-function if L.character: info['friends'] = [('Modular form ' + str( L.level) + '.' + str(L.weight) + '.' + str(L.character) + str(L.label), friendlink)] else: info['friends'] = [('Modular form ' + str(L.level) + '.' + str(L.weight) + str( L.label), friendlink)] if L.ellipticcurve: info['friends'].append( ('EC isogeny class ' + L.ellipticcurve, url_for("by_ec_label", label=L.ellipticcurve))) info['friends'].append(('L-function ' + str(L.level) + '.' + str(L.label), url_for('.l_function_ec_page', label=L.ellipticcurve))) for i in range(1, L.nr_of_curves_in_class + 1): info['friends'].append(('Elliptic curve ' + L.ellipticcurve + str(i), url_for("by_ec_label", label=L.ellipticcurve + str(i)))) info['friends'].append( ('Symmetric square L-function', url_for(".l_function_ec_sym_page", power='2', label=label))) info['friends'].append( ('Symmetric cube L-function', url_for(".l_function_ec_sym_page", power='3', label=label))) elif L.Ltype() == 'hilbertmodularform': friendlink = '/'.join(friendlink.split('/')[:-1]) info['friends'] = [('Hilbert Modular Form', friendlink.rpartition('/')[0])] elif L.Ltype() == 'dedekindzeta': info['friends'] = [('Number Field', friendlink)] elif L.Ltype() in ['lcalcurl', 'lcalcfile']: info['bread'] = [('L-functions', url_for('.l_function_top_page'))] elif L.Ltype() == 'SymmetricPower': def ordinal(n): if n == 2: return "Square" elif n == 3: return "Cube" elif 10 <= n % 100 < 20: return str(n) + "th Power" else: return str(n) + {1: 'st', 2: 'nd', 3: 'rd'}.get(n % 10, "th") + " Power" if L.m == 2: info['bread'] = get_bread(3, [("Symmetric square of Elliptic curve", url_for('.l_function_ec_sym2_browse_page')), (L.label, url_for('.l_function_ec_sym_page', label=L.label,power=L.m))]) elif L.m == 3: info['bread'] = get_bread(4, [("Symmetric cube of Elliptic curve", url_for('.l_function_ec_sym3_browse_page')), (L.label, url_for('.l_function_ec_sym_page', label=L.label,power=L.m))]) else: info['bread'] = [('L-functions', url_for('.l_function_top_page')), ('Symmetric %s of Elliptic curve ' % ordinal(L.m) + str(L.label), url_for('.l_function_ec_sym_page', label=L.label,power=L.m))] friendlink = request.url.replace('/L/SymmetricPower/%d/' % L.m, '/') splitlink = friendlink.rpartition('/') friendlink = splitlink[0] + splitlink[2] friendlink2 = request.url.replace('/L/SymmetricPower/%d/' % L.m, '/L/') splitlink = friendlink2.rpartition('/') friendlink2 = splitlink[0] + splitlink[2] info['friends'] = [('Isogeny class ' + L.label, friendlink), ('Symmetric 1st Power', friendlink2)] for j in range(2, L.m + 2): if j != L.m: friendlink3 = request.url.replace('/L/SymmetricPower/%d/' % L.m, '/L/SymmetricPower/%d/' % j) info['friends'].append(('Symmetric %s' % ordinal(j), friendlink3)) elif L.Ltype() == 'siegelnonlift' or L.Ltype() == 'siegeleisenstein' or L.Ltype() == 'siegelklingeneisenstein' or L.Ltype() == 'siegelmaasslift': weight = str(L.weight) number = str(L.number) info['friends'] = [('Siegel Modular Form', friendlink)] elif L.Ltype() == "artin": # info['zeroeslink'] = '' # info['plotlink'] = '' info['friends'] = [('Artin representation', L.artin.url_for())] if L.sign == 0: # The root number is now unknown info['zeroeslink'] = '' info['plotlink'] = '' info['dirichlet'] = lfuncDStex(L, "analytic") info['eulerproduct'] = lfuncEPtex(L, "abstract") info['functionalequation'] = lfuncFEtex(L, "analytic") info['functionalequationSelberg'] = lfuncFEtex(L, "selberg") if len(request.args) == 0: lcalcUrl = request.url + '?download=lcalcfile' else: lcalcUrl = request.url + '&download=lcalcfile' info['downloads'] = [('Lcalcfile', lcalcUrl)] return info
def set_info_for_modular_form_space(level=None, weight=None, character=None, label=None, **kwds): r""" Set information about a space of modular forms. """ info = dict() info['level'] = level info['weight'] = weight info['character'] = character emf_logger.debug("info={0}".format(info)) if (level > N_max_db or weight > k_max_db): info['error'] = "Currently not available" WMFS = None if level <= 0: info['error'] = "Got wrong level: %s " % level return info try: if use_db: WMFS = WebModFormSpace(weight, level, character, use_db=True) else: WMFS = WebModFormSpace(weight, level, character) if 'download' in info and 'tempfile' in info: WNF._save_to_file(info['tempfile']) info['filename'] = str(weight) + '-' + str(level) + '-' + str( character) + '-' + label + '.sobj' return info except RuntimeError: info['error'] = "Sage error: Could not construct the desired space!" if WMFS.level() == 1: info['group'] = "\( \mathrm{SL}_{2}(\mathbb{Z})\)" else: info['group'] = "\( \Gamma_{{0}}( {0} ) \)".format(WMFS.level()) if character == 0: info['name_new'] = "\(S_{ %s }^{new}(%s) \)" % (WMFS.weight(), WMFS.level()) info['name_old'] = "\(S_{ %s }^{old}(%s) \)" % (WMFS.weight(), WMFS.level()) else: conrey_char = WMFS.conrey_character() conrey_char_name = WMFS.conrey_character_name() info['conrey_character_name'] = '\( ' + conrey_char_name + '\)' info['character_url'] = url_character(type='Dirichlet', modulus=WMFS.level(), number=conrey_char.number()) info['name_new'] = "\(S_{ %s }^{new}(%s,%s) \)" % ( WMFS.weight(), WMFS.level(), conrey_char_name) info['name_old'] = "\(S_{ %s }^{old}(%s,%s) \)" % ( WMFS.weight(), WMFS.level(), conrey_char_name) info['dimension_cusp_forms'] = WMFS.dimension_cusp_forms() info['dimension_mod_forms'] = WMFS.dimension_modular_forms() info['dimension_new_cusp_forms'] = WMFS.dimension_new_cusp_forms() info['dimension_newspace'] = WMFS.dimension_newspace() info['dimension_oldspace'] = WMFS.dimension_oldspace() info['dimension'] = WMFS.dimension() info['galois_orbits'] = WMFS.get_all_galois_orbit_info() lifts = list() if WMFS.dimension() == 0: # we don't need to work with an empty space info['sturm_bound'] = 0 info['new_decomposition'] = '' info['is_empty'] = 1 lifts.append(('Half-Integral Weight Forms', '/ModularForm/Mp2/Q')) lifts.append(('Siegel Modular Forms', '/ModularForm/GSp4/Q')) info['lifts'] = lifts return info info['sturm_bound'] = WMFS.sturm_bound() info['new_decomposition'] = WMFS.print_galois_orbits() emf_logger.debug("new_decomp={0}".format(info['new_decomposition'])) info['nontrivial_new'] = len(info['new_decomposition']) ## we try to catch well-known bugs... info['old_decomposition'] = "n/a" if level < N_max_comp: try: O = WMFS.print_oldspace_decomposition() info['old_decomposition'] = O except: emf_logger.critical("Error in computing oldspace decomposition") O = [] info['old_decomposition'] = "n/a" (A, B, C) = sys.exc_info() # build an error message... errtype = A.__name__ errmsg = B s = "%s: %s at:" % (errtype, errmsg) next = C.tb_next while (next): ln = next.tb_lineno filen = next.tb_frame.f_code.co_filename s += "\n line no. %s in file %s" % (ln, filen) next = next.tb_next info['error_note'] = "Could not construct oldspace!\n" + s # properties for the sidebar prop = [] if WMFS._cuspidal == 1: prop = [('Dimension newforms', [info['dimension_newspace']])] prop.append(('Dimension oldforms', [info['dimension_oldspace']])) else: prop = [('Dimension modular forms', [info['dimension_mod_forms']])] prop.append(('Dimension cusp forms', [info['dimension_cusp_forms']])) prop.append(('Sturm bound', [WMFS.sturm_bound()])) info['properties2'] = prop ## Make parent spaces of S_k(N,chi) for the sidebar par_lbl = '\( S_{*} (\Gamma_0(' + str(level) + '),\cdot )\)' par_url = '?level=' + str(level) parents = [[par_lbl, par_url]] par_lbl = '\( S_{k} (\Gamma_0(' + str(level) + '),\cdot )\)' par_url = '?level=' + str(level) + '&weight=' + str(weight) parents.append((par_lbl, par_url)) info['parents'] = parents if 'character' in info: info['character_order'] = WMFS.character_order() info['character_conductor'] = WMFS.character_conductor() friends = list() lifts = list() if (('label' not in info) and info['old_decomposition'] != 'n/a'): O = WMFS.oldspace_decomposition() try: for (old_level, chi, mult, d) in O: if chi != 0: s = "\(S_{%s}(\Gamma_0(%s),\chi_{%s}) \) " % ( weight, old_level, chi) friends.append((s, '?weight=' + str(weight) + '&level=' + str(old_level) + '&character=' + str(chi))) else: s = "\(S_{%s}(\Gamma_0(%s)) \) " % (weight, old_level) friends.append((s, '?weight=' + str(weight) + '&level=' + str(old_level) + '&character=' + str(0))) except: pass info['friends'] = friends lifts.append(('Half-Integral Weight Forms', '/ModularForm/Mp2/Q')) lifts.append(('Siegel Modular Forms', '/ModularForm/GSp4/Q')) info['lifts'] = lifts return info
def render_field_webpage(args): data = None C = base.getDBConnection() info = {} bread = [("Global Number Fields", url_for(".number_field_render_webpage"))] if "label" in args: label = clean_input(args["label"]) nf = WebNumberField(label) data = {} if nf.is_null(): bread.append(("Search results", " ")) label2 = re.sub(r"[<>]", "", args["label"]) if "You need to enter a field" in label2: info["err"] = label2 else: info["err"] = "No such field: %s in the database" % label2 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,·)$</a>' % (url_character(type="Dirichlet", 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() 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.K()) data["phrase"] = group_phrase(n, t, C) zk = pari(nf.K()).nf_subst("a") zk = list(zk.nf_get_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() pretty_label = field_pretty(label) if label != pretty_label: pretty_label = "%s: %s" % (label, pretty_label) info.update(data) info.update( { "label": pretty_label, "label_raw": label, "polynomial": web_latex_split_on_pm(nf.K().defining_polynomial()), "ram_primes": ram_primes, "integral_basis": zk, "regulator": web_latex(nf.regulator()), "unit_rank": nf.unit_rank(), "root_of_unity": web_latex(nf.K().primitive_root_of_unity()), "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(): 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")), ] # 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 = [ ("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.find_one({"label": label}) v = nf.factor_perm_repn(info["tim_number_field"]) info["mydecomp"] = ["*" if x > 0 else "" 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, friends=info.pop("friends"), learnmore=info.pop("learnmore"), info=info, )