def display_number_field(self): if self.number_field == "": return "The number field of this isogeny class is not in the database." else: C = getDBConnection() return nf_display_knowl(self.number_field, C, field_pretty(self.number_field))
def bianchi_modular_form_postprocess(res, info, query): if info['number'] > 0: info['field_pretty_name'] = field_pretty(res[0]['field_label']) else: info['field_pretty_name'] = '' res.sort(key=lambda x: [x['level_norm'], int(x['level_number']), x['label_suffix']]) return res
def cm_format(D): if D == 1: return 'Not CM' elif D == 0: return 'Unknown' else: cm_label = "2.0.%s.1" % (-D) return nf_display_knowl(cm_label, field_pretty(cm_label))
def extend_from_db(self): setattr(self._value, "lmfdb_label", self._db_value) if not self._db_value is None and self._db_value != '': try: url = url_for("number_fields.by_label", label=self._db_value) except RuntimeError: emf_logger.critical("could not set url for the label") url = '' setattr(self._value, "lmfdb_url",url) setattr(self._value, "lmfdb_pretty", field_pretty(self._db_value)) else: if hasattr(self._value,'absolute_polynomial'): setattr(self._value, "lmfdb_pretty", web_latex_split_on_pm(self._value.absolute_polynomial())) elif self._value.absolute_degree()==1: setattr(self._value, "lmfdb_pretty", field_pretty('1.1.1.1')) setattr(self._value, "lmfdb_label", '1.1.1.1') else: emf_logger.critical("could not set lmfdb_pretty for the label")
def extend_from_db(self): setattr(self._value, "lmfdb_label", self._db_value) if not self._db_value is None and self._db_value != '': label = self._db_value setattr(self._value, "lmfdb_pretty", field_pretty(label)) else: if self._value.absolute_degree() == 1: label = '1.1.1.1' setattr(self._value, "lmfdb_pretty", field_pretty(label)) setattr(self._value, "lmfdb_label", label) else: emf_logger.critical("could not set lmfdb_pretty for the label") label = '' if label != '': try: url = url_for("number_fields.by_label", label=label) setattr(self._value, "lmfdb_url", url) except RuntimeError: emf_logger.critical("could not set url for the label")
def extend_from_db(self): setattr(self._value, "lmfdb_label", self._db_value) if not self._db_value is None and self._db_value != '': label = self._db_value setattr(self._value, "lmfdb_pretty", field_pretty(label)) else: if self._value == QQ: label = '1.1.1.1' setattr(self._value, "lmfdb_pretty", field_pretty(label)) setattr(self._value, "lmfdb_label", label) else: emf_logger.critical("could not set lmfdb_pretty for the label") label = '' if label != '': try: url = url_for("number_fields.by_label", label=label) setattr(self._value, "lmfdb_url", url) except RuntimeError: emf_logger.critical("could not set url for the label")
def endo_statement_isog(factorsQQ, factorsRR, fieldstring): statement = """<table class="g2">""" factorsQQ_number = len(factorsQQ) factorsQQ_pretty = [ field_pretty(fac[0]) for fac in factorsQQ if fac[0] ] # First row: description of endomorphism algebra factors statement += """<tr><td>\(\End (J_{%s}) \otimes \Q \)</td><td>\(\simeq\)</td><td>"""\ % fieldstring # In the case of only one factor we either get a number field or a # quaternion algebra: if factorsQQ_number == 1: # First we deal with the number field case, # in which we have set the discriminant to be -1 if factorsQQ[0][2] == -1: # Prettify if labels available, otherwise return defining polynomial: if factorsQQ_pretty: statement += """<a href=%s>%s</a>"""\ % (url_for("number_fields.by_label", label=factorsQQ[0][0]), factorsQQ_pretty[0]) else: statement += """number field with defining polynomial \(%s\)"""\ % intlist_to_poly(factorsQQ[0][1]) # Detect CM by presence of a quartic polynomial: # TODO: Add knowl link if len(factorsQQ[0][1]) == 5: statement += """(CM)""" # Up next is the case of a matrix ring (trivial disciminant), with # labels and full prettification always available: elif factorsQQ[0][2] == 1: statement += """\(\mathrm{M}_2(\)<a href=%s>%s</a>\()\)"""\ % (url_for("number_fields.by_label", label=factorsQQ[0][0]), factorsQQ_pretty[0]) # And finally we deal with quaternion algebras over the rationals: else: statement += """quaternion algebra over <a href=%s>%s</a> of discriminant %s"""\ % (url_for("number_fields.by_label", label=factorsQQ[0][0]), factorsQQ_pretty[0], factorsQQ[0][2]) # If there are two factors, then we get two at most quadratic fields: else: statement += """<a href=%s>%s</a> \(\\times\) <a href=%s>%s</a>"""\ % (url_for("number_fields.by_label", label=factorsQQ[0][0]), factorsQQ_pretty[0], url_for("number_fields.by_label", label=factorsQQ[1][0]), factorsQQ_pretty[1]) # End of first row: statement += """</td></tr>""" # Second row: description of algebra tensored with RR statement += """<tr><td>\(\End (J_{%s}) \otimes \R\)</td><td>\(\simeq\)</td> <td>\(%s\)</td></tr>"""\ % (fieldstring, factorsRR_raw_to_pretty(factorsRR)) # End of statement: statement += """</table>""" return statement
def render_bmf_webpage(field_label, level_label, label_suffix): label = "-".join([field_label, level_label, label_suffix]) credit = "John Cremona" bread = [] info = {} title = "Bianchi cusp forms" data = None properties2 = [] friends = [] bread = [('Modular Forms', url_for('mf.modular_form_main_page')), ('Bianchi Modular Forms', url_for(".index"))] try: data = WebBMF.by_label(label) title = "Bianchi cusp form {} over {}".format( data.short_label, field_pretty(data.field_label)) bread = [('Modular Forms', url_for('mf.modular_form_main_page')), ('Bianchi Modular Forms', url_for(".index")), (field_pretty(data.field_label), url_for(".render_bmf_field_dim_table_gl2", field_label=data.field_label)), (data.level_label, url_for('.render_bmf_space_webpage', field_label=data.field_label, level_label=data.level_label)), (data.short_label, '')] properties2 = data.properties2 friends = data.friends except ValueError: raise info[ 'err'] = "No Bianchi modular form in the database has label {}".format( label) return render_template("bmf-newform.html", title=title, credit=credit, bread=bread, data=data, properties2=properties2, friends=friends, info=info)
def render_bmf_webpage(field_label, level_label, label_suffix): label = "-".join([field_label, level_label, label_suffix]) credit = "John Cremona" bread = [] info = {} title = "Bianchi cusp forms" data = None properties2 = [] friends = [] bread = [('Bianchi modular forms', url_for(".index"))] try: data = WebBMF.by_label(label) title = "Bianchi cusp form {} over {}".format(data.short_label,field_pretty(data.field_label)) bread = [('Bianchi modular forms', url_for(".index")), (field_pretty(data.field_label), url_for(".render_bmf_field_dim_table_gl2", field_label=data.field_label)), (data.level_label, url_for('.render_bmf_space_webpage', field_label=data.field_label, level_label=data.level_label)), (data.short_label, '')] properties2 = data.properties2 friends = data.friends except ValueError: info['err'] = "No Bianchi modular form in the database has label {}".format(label) return render_template("bmf-newform.html", title=title, credit=credit, bread=bread, data=data, properties2=properties2, friends=friends, info=info)
def nf_link(mf): nf_label = mf.get('nf_label') if nf_label: name = field_pretty(nf_label) if name == nf_label and len(name) > 16: # truncate if too long parts = nf_label.split('.') parts[2] = r'\(\cdots\)' name = '.'.join(parts) return nf_display_knowl(nf_label, name) elif mf['dim'] == mf['char_degree'] and mf.get( 'field_poly_root_of_unity'): return r'\(\Q(\zeta_{%s})\)' % mf['field_poly_root_of_unity'] else: poly = mf.get('field_poly') if poly: return polyquo_knowl(poly) return ""
def make_class(self): # Create a list of the curves in the class from the database self.db_curves = list(db.ec_nfcurves.search( {'field_label': self.field_label, 'conductor_norm': self.conductor_norm, 'conductor_label': self.conductor_label, 'iso_nlabel': self.iso_nlabel})) # Rank or bounds try: self.rk = web_latex(self.db_curves[0]['rank']) except KeyError: self.rk = "?" try: self.rk_bnds = "%s...%s" % tuple(self.db_curves[0]['rank_bounds']) except KeyError: self.rank_bounds = [0, Infinity] self.rk_bnds = "not recorded" # Extract the isogeny degree matrix from the database if not hasattr(self, 'isogeny_matrix'): # this would happen if the class is initiated with a curve # which is not #1 in its class: self.isogeny_matrix = self.db_curves[0].isogeny_matrix self.isogeny_matrix = Matrix(self.isogeny_matrix) self.one_deg = ZZ(self.class_deg).is_prime() # Create isogeny graph: self.graph = make_graph(self.isogeny_matrix) P = self.graph.plot(edge_labels=True) self.graph_img = encode_plot(P) self.graph_link = '<img src="%s" width="200" height="150"/>' % self.graph_img self.isogeny_matrix_str = latex(Matrix(self.isogeny_matrix)) self.field = FIELD(self.field_label) self.field_name = field_pretty(self.field_label) self.field_knowl = nf_display_knowl(self.field_label, self.field_name) def curve_url(c): return url_for(".show_ecnf", nf=c['field_label'], conductor_label=c['conductor_label'], class_label=c['iso_label'], number=c['number']) self.curves = [[c['short_label'], curve_url(c), web_ainvs(self.field_label,c['ainvs'])] for c in self.db_curves] self.urls = {} self.urls['class'] = url_for(".show_ecnf_isoclass", nf=self.field_label, conductor_label=self.conductor_label, class_label=self.iso_label) self.urls['conductor'] = url_for(".show_ecnf_conductor", nf=self.field_label, conductor_label=self.conductor_label) self.urls['field'] = url_for('.show_ecnf1', nf=self.field_label) sig = self.signature totally_real = sig[1] == 0 imag_quadratic = sig == [0,1] if totally_real: self.hmf_label = "-".join([self.field_label, self.conductor_label, self.iso_label]) self.urls['hmf'] = url_for('hmf.render_hmf_webpage', field_label=self.field_label, label=self.hmf_label) if sig[0] <= 2: self.urls['Lfunction'] = url_for("l_functions.l_function_ecnf_page", field_label=self.field_label, conductor_label=self.conductor_label, isogeny_class_label=self.iso_label) elif self.abs_disc ** 2 * self.conductor_norm < 40000: # we shouldn't trust the Lfun computed on the fly for large conductor self.urls['Lfunction'] = url_for("l_functions.l_function_hmf_page", field=self.field_label, label=self.hmf_label, character='0', number='0') if imag_quadratic: self.bmf_label = "-".join([self.field_label, self.conductor_label, self.iso_label]) self.bmf_url = url_for('bmf.render_bmf_webpage', field_label=self.field_label, level_label=self.conductor_label, label_suffix=self.iso_label) self.urls['Lfunction'] = url_for("l_functions.l_function_ecnf_page", field_label=self.field_label, conductor_label=self.conductor_label, isogeny_class_label=self.iso_label) self.friends = [] if totally_real: self.friends += [('Hilbert Modular Form ' + self.hmf_label, self.urls['hmf'])] if imag_quadratic: #self.friends += [('Bianchi Modular Form %s not available' % self.bmf_label, '')] self.friends += [('Bianchi Modular Form %s' % self.bmf_label, self.bmf_url)] if 'Lfunction' in self.urls: self.friends += [('L-function', self.urls['Lfunction'])] else: self.friends += [('L-function not available', "")] self.properties = [('Base field', self.field_name), ('Label', self.class_label), (None, self.graph_link), ('Conductor', '%s' % self.conductor_label) ] if self.rk != '?': self.properties += [('Rank', '%s' % self.rk)] else: if self.rk_bnds == 'not recorded': self.properties += [('Rank', '%s' % self.rk_bnds)] else: self.properties += [('Rank bounds', '%s' % self.rk_bnds)] self.bread = [('Elliptic Curves ', url_for(".index")), (self.field_label, self.urls['field']), (self.conductor_label, self.urls['conductor']), ('isogeny class %s' % self.short_label, self.urls['class'])]
def display_number_field(self): if self.number_field == "": return "The number field of this isogeny class is not in the database." else: C = getDBConnection() return nf_display_knowl(self.number_field,C,field_pretty(self.number_field))
def render_bmf_space_webpage(field_label, level_label): info = {} t = "Bianchi modular forms of level %s over %s" % (level_label, field_label) credit = bianchi_credit bread = [('Bianchi modular forms', url_for(".index")), (field_pretty(field_label), url_for(".render_bmf_field_dim_table_gl2", field_label=field_label)), (level_label, '')] friends = [] properties2 = [] if not field_label_regex.match(field_label): info[ 'err'] = "%s is not a valid label for an imaginary quadratic field" % field_label else: pretty_field_label = field_pretty(field_label) if not db_dims().find({'field_label': field_label}): info[ 'err'] = "no dimension information exists in the database for field %s" % pretty_field_label else: t = "Bianchi Modular Forms of level %s over %s" % ( level_label, pretty_field_label) data = db_dims().find({ 'field_label': field_label, 'level_label': level_label }) nres = data.count() if nres == 0: info[ 'err'] = "no dimension information exists in the database for level %s and field %s" % ( level_label, pretty_field_label) else: data = data.next() info['label'] = data['label'] nf = WebNumberField(field_label) info['base_galois_group'] = nf.galois_string() info['field_label'] = field_label info['pretty_field_label'] = pretty_field_label info['level_label'] = level_label info['level_norm'] = data['level_norm'] info['field_degree'] = nf.degree() info['field_classno'] = nf.class_number() info['field_disc'] = str(nf.disc()) info['field_poly'] = teXify_pol(str(nf.poly())) info['field_knowl'] = nf_display_knowl(field_label, getDBConnection(), pretty_field_label) w = 'i' if nf.disc() == -4 else 'a' L = nf.K().change_names(w) alpha = L.gen() info['field_gen'] = latex(alpha) I = ideal_from_label(L, level_label) info['level_gen'] = latex(I.gens_reduced()[0]) info['level_fact'] = latex(I.factor()) dim_data = data['gl2_dims'] weights = dim_data.keys() weights.sort(key=lambda w: int(w)) for w in weights: dim_data[w]['dim'] = dim_data[w]['cuspidal_dim'] info['dim_data'] = dim_data info['weights'] = weights info['nweights'] = len(weights) newdim = data['gl2_dims']['2']['new_dim'] newforms = db_forms().find({ 'field_label': field_label, 'level_label': level_label }).sort('label_suffix', ASCENDING) info['nfdata'] = [{ 'label': f['short_label'], 'url': url_for(".render_bmf_webpage", field_label=f['field_label'], level_label=f['level_label'], label_suffix=f['label_suffix']), 'wt': f['weight'], 'dim': f['dimension'], 'sfe': "+1" if f['sfe'] == 1 else "-1", 'bc': bc_info(f['bc']), 'cm': cm_info(f['CM']), } for f in newforms] info['nnewforms'] = len(info['nfdata']) properties2 = [('Base field', pretty_field_label), ('Level', info['level_label']), ('Norm', str(info['level_norm'])), ('New dimension', str(newdim))] friends = [('Newform {}'.format(f['label']), f['url']) for f in info['nfdata']] return render_template("bmf-space.html", info=info, credit=credit, title=t, bread=bread, properties2=properties2, friends=friends)
def set_info_for_web_newform(level=None, weight=None, character=None, label=None, **kwds): r""" Set the info for on modular form. """ info = to_dict(kwds) info['level'] = level info['weight'] = weight info['character'] = character info['label'] = label if level is None or weight is None or character is None or label is None: s = "In set info for one form but do not have enough args!" s += "level={0},weight={1},character={2},label={3}".format( level, weight, character, label) emf_logger.critical(s) emf_logger.debug("In set_info_for_one_mf: info={0}".format(info)) prec = my_get(info, 'prec', default_prec, int) bprec = my_get(info, 'bprec', default_display_bprec, int) emf_logger.debug("PREC: {0}".format(prec)) emf_logger.debug("BITPREC: {0}".format(bprec)) try: WNF = WebNewForm_cached(level=level, weight=weight, character=character, label=label) if not WNF.has_updated(): raise IndexError( "Unfortunately, we do not have this newform in the database.") info['character_order'] = WNF.character.order info['code'] = WNF.code emf_logger.debug("defined webnewform for rendering!") except IndexError as e: info['error'] = e.message url0 = url_for("mf.modular_form_main_page") url1 = url_for("emf.render_elliptic_modular_forms") url2 = url_for("emf.render_elliptic_modular_forms", level=level) url3 = url_for("emf.render_elliptic_modular_forms", level=level, weight=weight) url4 = url_for("emf.render_elliptic_modular_forms", level=level, weight=weight, character=character) bread = [(MF_TOP, url0), (EMF_TOP, url1)] bread.append(("Level %s" % level, url2)) bread.append(("Weight %s" % weight, url3)) bread.append(("Character \( %s \)" % (WNF.character.latex_name), url4)) bread.append( ("Newform %d.%d.%d.%s" % (level, weight, int(character), label), '')) info['bread'] = bread properties2 = list() friends = list() space_url = url_for('emf.render_elliptic_modular_forms', level=level, weight=weight, character=character) friends.append( ('\( S_{%s}(%s, %s)\)' % (WNF.weight, WNF.level, WNF.character.latex_name), space_url)) if hasattr(WNF.base_ring, "lmfdb_url") and WNF.base_ring.lmfdb_url: friends.append(('Number field ' + WNF.base_ring.lmfdb_pretty, WNF.base_ring.lmfdb_url)) if hasattr(WNF.coefficient_field, "lmfdb_url") and WNF.coefficient_field.lmfdb_label: friends.append(('Number field ' + WNF.coefficient_field.lmfdb_pretty, WNF.coefficient_field.lmfdb_url)) friends = uniq(friends) friends.append(("Dirichlet character \(" + WNF.character.latex_name + "\)", WNF.character.url())) if WNF.dimension == 0 and not info.has_key('error'): info['error'] = "This space is empty!" info['title'] = 'Newform ' + WNF.hecke_orbit_label info['learnmore'] = [('History of modular forms', url_for('.holomorphic_mf_history'))] if 'error' in info: return info ## Until we have figured out how to do the embeddings correctly we don't display the Satake ## parameters for non-trivial characters.... ## Example to illustrate the different cases ## base = CyclotomicField(n) -- of degree phi(n) ## coefficient_field = NumberField( p(x)) for some p in base['x'] of degree m ## we would then have cdeg = m*phi(n) and bdeg = phi(n) ## and rdeg = m ## Unfortunately, for e.g. base = coefficient_field = CyclotomicField(6) ## we get coefficient_field.relative_degree() == 2 although it should be 1 cdeg = WNF.coefficient_field.absolute_degree() bdeg = WNF.base_ring.absolute_degree() if cdeg == 1: rdeg = 1 else: ## just setting rdeg = WNF.coefficient_field.relative_degree() does not give correct result... ## rdeg = QQ(cdeg) / QQ(bdeg) cf_is_QQ = (cdeg == 1) br_is_QQ = (bdeg == 1) if cf_is_QQ: info['satake'] = WNF.satake if WNF.complexity_of_first_nonvanishing_coefficients( ) > default_max_height: info['qexp'] = "" info['qexp_display'] = '' info['hide_qexp'] = True n, c = WNF.first_nonvanishing_coefficient() info['trace_nv'] = latex(WNF.first_nonvanishing_coefficient_trace()) info['norm_nv'] = '\\approx ' + latex( WNF.first_nonvanishing_coefficient_norm().n()) info['index_nv'] = n else: if WNF.prec < prec: #get WNF record at larger prec WNF.prec = prec WNF.update_from_db() info['qexp'] = WNF.q_expansion_latex(prec=10, name='\\alpha ') info['qexp_display'] = url_for(".get_qexp_latex", level=level, weight=weight, character=character, label=label) info["hide_qexp"] = False info['max_cn_qexp'] = WNF.q_expansion.prec() ## All combinations should be tested... ## 13/4/4/a -> base ring = coefficient_field = QQ(zeta_6) ## 13/3/8/a -> base_ring = QQ(zeta_4), coefficient_field has poly x^2+(2\zeta_4+2x-3\zeta_$ over base_ring ## 13/4/3/a -> base_ring = coefficient_field = QQ(zeta_3) ## 13/4/1/a -> all rational ## 13/6/1/a/ -> base_ring = QQ, coefficient_field = Q(sqrt(17)) ## These are variables which needs to be set properly below info['polvars'] = {'base_ring': 'x', 'coefficient_field': '\\alpha'} if not cf_is_QQ: if rdeg > 1: # not WNF.coefficient_field == WNF.base_ring: ## Here WNF.base_ring should be some cyclotomic field and we have an extension over this. p1 = WNF.coefficient_field.relative_polynomial() c_pol_ltx = web_latex_poly(p1, '\\alpha') # make the variable \alpha c_pol_ltx_x = web_latex_poly(p1, 'x') zeta = p1.base_ring().gens()[0] # p2 = zeta.minpoly() #this is not used anymore # b_pol_ltx = web_latex_poly(p2, latex(zeta)) #this is not used anymore z1 = zeta.multiplicative_order() info['coeff_field'] = [ WNF.coefficient_field.absolute_polynomial_latex('x'), c_pol_ltx_x, z1 ] if hasattr(WNF.coefficient_field, "lmfdb_url") and WNF.coefficient_field.lmfdb_url: info['coeff_field_pretty'] = [ WNF.coefficient_field.lmfdb_url, WNF.coefficient_field.lmfdb_pretty, WNF.coefficient_field.lmfdb_label ] if z1 == 4: info[ 'polynomial_st'] = '<div class="where">where</div> {0}\(\mathstrut=0\) and \(\zeta_4=i\).</div><br/>'.format( c_pol_ltx) info['polvars']['base_ring'] = 'i' elif z1 <= 2: info[ 'polynomial_st'] = '<div class="where">where</div> {0}\(\mathstrut=0\).</div><br/>'.format( c_pol_ltx) else: info[ 'polynomial_st'] = '<div class="where">where</div> %s\(\mathstrut=0\) and \(\zeta_{%s}=e^{\\frac{2\\pi i}{%s}}\) ' % ( c_pol_ltx, z1, z1) info['polvars']['base_ring'] = '\zeta_{{ {0} }}'.format(z1) if z1 == 3: info[ 'polynomial_st'] += 'is a primitive cube root of unity.' else: info[ 'polynomial_st'] += 'is a primitive {0}-th root of unity.'.format( z1) elif not br_is_QQ: ## Now we have base and coefficient field being equal, meaning that since the coefficient field is not QQ it is some cyclotomic field ## generated by some \zeta_n p1 = WNF.coefficient_field.absolute_polynomial() z1 = WNF.coefficient_field.gens()[0].multiplicative_order() c_pol_ltx = web_latex_poly(p1, '\\zeta_{{{0}}}'.format(z1)) c_pol_ltx_x = web_latex_poly(p1, 'x') info['coeff_field'] = [ WNF.coefficient_field.absolute_polynomial_latex('x'), c_pol_ltx_x ] if hasattr(WNF.coefficient_field, "lmfdb_url") and WNF.coefficient_field.lmfdb_url: info['coeff_field_pretty'] = [ WNF.coefficient_field.lmfdb_url, WNF.coefficient_field.lmfdb_pretty, WNF.coefficient_field.lmfdb_label ] if z1 == 4: info[ 'polynomial_st'] = '<div class="where">where \(\zeta_4=e^{{\\frac{{\\pi i}}{{ 2 }} }}=i \).</div>'.format( c_pol_ltx) info['polvars']['coefficient_field'] = 'i' elif z1 <= 2: info['polynomial_st'] = '' else: info[ 'polynomial_st'] = '<div class="where">where \(\zeta_{{{0}}}=e^{{\\frac{{2\\pi i}}{{ {0} }} }}\) '.format( z1) info['polvars']['coefficient_field'] = '\zeta_{{{0}}}'.format( z1) if z1 == 3: info[ 'polynomial_st'] += 'is a primitive cube root of unity.</div>' else: info[ 'polynomial_st'] += 'is a primitive {0}-th root of unity.</div>'.format( z1) else: info['polynomial_st'] = '' if info["hide_qexp"]: info['polynomial_st'] = '' info['degree'] = int(cdeg) if cdeg == 1: info['is_rational'] = 1 info['coeff_field_pretty'] = [ WNF.coefficient_field.lmfdb_url, WNF.coefficient_field.lmfdb_pretty ] else: info['is_rational'] = 0 emf_logger.debug("PREC2: {0}".format(prec)) info['embeddings'] = WNF._embeddings[ 'values'] #q_expansion_embeddings(prec, bprec,format='latex') info['embeddings_len'] = len(info['embeddings']) properties2 = [('Level', str(level)), ('Weight', str(weight)), ('Character', '$' + WNF.character.latex_name + '$'), ('Label', WNF.hecke_orbit_label), ('Dimension of Galois orbit', str(WNF.dimension))] if (ZZ(level)).is_squarefree(): info['twist_info'] = WNF.twist_info if isinstance(info['twist_info'], list) and len(info['twist_info']) > 0: info['is_minimal'] = info['twist_info'][0] if (info['twist_info'][0]): s = 'Is minimal<br>' else: s = 'Is a twist of lower level<br>' properties2 += [('Twist info', s)] else: info['twist_info'] = 'Twist info currently not available.' properties2 += [('Twist info', 'not available')] args = list() for x in range(5, 200, 10): args.append({'digits': x}) alev = None CM = WNF._cm_values if CM is not None: if CM.has_key('tau') and len(CM['tau']) != 0: info['CM_values'] = CM info['is_cm'] = WNF.is_cm if WNF.is_cm == 1: info['cm_field'] = "2.0.{0}.1".format(-WNF.cm_disc) info['cm_disc'] = WNF.cm_disc info['cm_field_knowl'] = nf_display_knowl( info['cm_field'], getDBConnection(), field_pretty(info['cm_field'])) info['cm_field_url'] = url_for("number_fields.by_label", label=info["cm_field"]) if WNF.is_cm is None or WNF.is_cm == -1: s = '- Unknown (insufficient data)<br>' elif WNF.is_cm == 1: s = 'Yes<br>' else: s = 'No<br>' properties2.append(('CM', s)) alev = WNF.atkin_lehner_eigenvalues() info['atkinlehner'] = None if isinstance(alev, dict) and len(alev.keys()) > 0 and level != 1: s1 = " Atkin-Lehner eigenvalues " s2 = "" for Q in alev.keys(): s2 += "\( \omega_{ %s } \) : %s <br>" % (Q, alev[Q]) properties2.append((s1, s2)) emf_logger.debug("properties={0}".format(properties2)) # alev = WNF.atkin_lehner_eigenvalues_for_all_cusps() # if isinstance(alev,dict) and len(alev.keys())>0: # emf_logger.debug("alev={0}".format(alev)) # info['atkinlehner'] = list() # for Q in alev.keys(): # s = "\(" + latex(c) + "\)" # Q = alev[c][0] # ev = alev[c][1] # info['atkinlehner'].append([Q, c, ev]) if (level == 1): poly = WNF.explicit_formulas.get('as_polynomial_in_E4_and_E6', '') if poly != '': d, monom, coeffs = poly emf_logger.critical("poly={0}".format(poly)) info['explicit_formulas'] = '\(' for i in range(len(coeffs)): c = QQ(coeffs[i]) s = "" if d > 1 and i > 0 and c > 0: s = "+" if c < 0: s = "-" if c.denominator() > 1: cc = "\\frac{{ {0} }}{{ {1} }}".format( abs(c.numerator()), c.denominator()) else: cc = str(abs(c)) s += "{0} \cdot ".format(cc) a = monom[i][0] b = monom[i][1] if a == 1: a = "" if b == 1: b = "" if a == 0 and b != 0: s += "E_6^{{ {0} }}(z)".format(b) elif b == 0 and a != 0: s += "E_4^{{ {0} }}(z)".format(a) else: s += "E_4^{{ {0} }}(z) \cdot E_6^{{ {1} }}(z)".format(a, b) info['explicit_formulas'] += s info['explicit_formulas'] += " \)" # cur_url = '?&level=' + str(level) + '&weight=' + str(weight) + '&character=' + str(character) + '&label=' + str(label) # never used if len(WNF.parent.hecke_orbits) > 1: for label_other in WNF.parent.hecke_orbits.keys(): if (label_other != label): s = 'Modular form ' if character: s += newform_label(level, weight, character, label_other) else: s += newform_label(level, weight, 1, label_other) url = url_for('emf.render_elliptic_modular_forms', level=level, weight=weight, character=character, label=label_other) friends.append((s, url)) s = 'L-Function ' if character: s += newform_label(level, weight, character, label) else: s += newform_label(level, weight, 1, label) # url = # "/L/ModularForm/GL2/Q/holomorphic?level=%s&weight=%s&character=%s&label=%s&number=%s" # %(level,weight,character,label,0) url = '/L' + url_for('emf.render_elliptic_modular_forms', level=level, weight=weight, character=character, label=label) if WNF.coefficient_field_degree > 1: for h in range(WNF.coefficient_field_degree): s0 = s + ".{0}".format(h) url0 = url + "{0}/".format(h) friends.append((s0, url0)) else: friends.append((s, url)) # if there is an elliptic curve over Q associated to self we also list that if WNF.weight == 2 and WNF.coefficient_field_degree == 1: llabel = str(level) + '.' + label s = 'Elliptic curve isogeny class ' + llabel url = '/EllipticCurve/Q/' + llabel friends.append((s, url)) info['properties2'] = properties2 info['friends'] = friends info['max_cn'] = WNF.max_available_prec() return info
def display_number_field(self): if self.nf == "": return "The number field of this isogeny class is not in the database." else: return nf_display_knowl(self.nf, field_pretty(self.nf))
def make_class(self): # Create a list of the curves in the class from the database self.db_curves = [ c for c in db_ecnf().find({ 'field_label': self.field_label, 'conductor_norm': self.conductor_norm, 'conductor_label': self.conductor_label, 'iso_nlabel': self.iso_nlabel }).sort('number') ] # Rank or bounds try: self.rk = web_latex(self.db_curves[0]['rank']) except KeyError: self.rk = "?" try: self.rk_bnds = "%s...%s" % tuple(self.db_curves[0]['rank_bounds']) except KeyError: self.rank_bounds = [0, sage.rings.infinity.Infinity] self.rk_bnds = "not recorded" # Extract the isogeny degree matrix from the database if possible, else create it if hasattr(self, 'isogeny_matrix'): from sage.matrix.all import Matrix self.isogeny_matrix = Matrix(self.isogeny_matrix) else: self.isogeny_matrix = make_iso_matrix(self.db_curves) # Create isogeny graph: self.graph = make_graph(self.isogeny_matrix) P = self.graph.plot(edge_labels=True) self.graph_img = encode_plot(P) self.graph_link = '<img src="%s" width="200" height="150"/>' % self.graph_img self.isogeny_matrix_str = latex(matrix(self.isogeny_matrix)) self.field = field_pretty(self.field_label) self.field_knowl = nf_display_knowl(self.field_label, lmfdb.base.getDBConnection(), self.field) def curve_url(c): return url_for(".show_ecnf", nf=c['field_label'], conductor_label=c['conductor_label'], class_label=c['iso_label'], number=c['number']) self.curves = [[ c['short_label'], curve_url(c), web_ainvs(self.field_label, c['ainvs']) ] for c in self.db_curves] self.urls = {} self.urls['class'] = url_for(".show_ecnf_isoclass", nf=self.field_label, conductor_label=self.conductor_label, class_label=self.iso_label) self.urls['conductor'] = url_for(".show_ecnf_conductor", nf=self.field_label, conductor_label=self.conductor_label) self.urls['field'] = url_for('.show_ecnf1', nf=self.field_label) sig = self.signature totally_real = sig[1] == 0 imag_quadratic = sig == [0, 1] if totally_real: self.hmf_label = "-".join( [self.field_label, self.conductor_label, self.iso_label]) self.urls['hmf'] = url_for('hmf.render_hmf_webpage', field_label=self.field_label, label=self.hmf_label) self.urls['Lfunction'] = url_for("l_functions.l_function_hmf_page", field=self.field_label, label=self.hmf_label, character='0', number='0') if imag_quadratic: self.bmf_label = "-".join( [self.field_label, self.conductor_label, self.iso_label]) self.friends = [] if totally_real: self.friends += [('Hilbert Modular Form ' + self.hmf_label, self.urls['hmf'])] self.friends += [('L-function', self.urls['Lfunction'])] if imag_quadratic: self.friends += [ ('Bianchi Modular Form %s not available' % self.bmf_label, '') ] self.properties = [('Base field', self.field), ('Label', self.class_label), (None, self.graph_link), ('Conductor', '%s' % self.conductor_label)] if self.rk != '?': self.properties += [('Rank', '%s' % self.rk)] else: if self.rk_bnds == 'not recorded': self.properties += [('Rank', '%s' % self.rk_bnds)] else: self.properties += [('Rank bounds', '%s' % self.rk_bnds)] self.bread = [('Elliptic Curves ', url_for(".index")), (self.field_label, self.urls['field']), (self.conductor_label, self.urls['conductor']), ('isogeny class %s' % self.short_label, self.urls['class'])]
def make_class(self): # Create a list of the curves in the class from the database self.db_curves = [c for c in db_ec().find( {'field_label': self.field_label, 'conductor_label': self.conductor_label, 'iso_label': self.iso_label}).sort('number')] # Rank or bounds try: self.rk = web_latex(self.db_curves[0]['rank']) except KeyError: self.rk = "?" try: self.rk_bnds = "%s...%s" % tuple(self.db_curves[0]['rank_bounds']) except KeyError: self.rank_bounds = [0, sage.rings.infinity.Infinity] self.rk_bnds = "not recorded" # Extract the isogeny degree matrix from the database if possible, else create it if hasattr(self, 'isogeny_matrix'): from sage.matrix.all import Matrix self.isogeny_matrix = Matrix(self.isogeny_matrix) else: self.isogeny_matrix = make_iso_matrix(self.db_curves) # Create isogeny graph: self.graph = make_graph(self.isogeny_matrix) P = self.graph.plot(edge_labels=True) self.graph_img = encode_plot(P) self.graph_link = '<img src="%s" width="200" height="150"/>' % self.graph_img self.isogeny_matrix_str = latex(matrix(self.isogeny_matrix)) self.field = field_pretty(self.field_label) self.field_knowl = nf_display_knowl(self.field_label, lmfdb.base.getDBConnection(), self.field) def curve_url(c): return url_for(".show_ecnf", nf=c['field_label'], conductor_label=c['conductor_label'], class_label=c['iso_label'], number=c['number']) self.curves = [[c['short_label'], curve_url(c), web_ainvs(self.field_label,c['ainvs'])] for c in self.db_curves] self.urls = {} self.urls['class'] = url_for(".show_ecnf_isoclass", nf=self.field_label, conductor_label=self.conductor_label, class_label=self.iso_label) self.urls['conductor'] = url_for(".show_ecnf_conductor", nf=self.field_label, conductor_label=self.conductor_label) self.urls['field'] = url_for('.show_ecnf1', nf=self.field_label) sig = self.signature totally_real = sig[1] == 0 imag_quadratic = sig == [0,1] if totally_real: self.hmf_label = "-".join([self.field_label, self.conductor_label, self.iso_label]) self.urls['hmf'] = url_for('hmf.render_hmf_webpage', field_label=self.field_label, label=self.hmf_label) self.urls['Lfunction'] = url_for("l_functions.l_function_hmf_page", field=self.field_label, label=self.hmf_label, character='0', number='0') if imag_quadratic: self.bmf_label = "-".join([self.field_label, self.conductor_label, self.iso_label]) self.friends = [] if totally_real: self.friends += [('Hilbert Modular Form ' + self.hmf_label, self.urls['hmf'])] self.friends += [('L-function', self.urls['Lfunction'])] if imag_quadratic: self.friends += [('Bianchi Modular Form %s not available' % self.bmf_label, '')] self.properties = [('Base field', self.field), ('Label', self.class_label), (None, self.graph_link), ('Conductor', '%s' % self.conductor_label) ] if self.rk != '?': self.properties += [('Rank', '%s' % self.rk)] else: if self.rk_bnds == 'not recorded': self.properties += [('Rank', '%s' % self.rk_bnds)] else: self.properties += [('Rank bounds', '%s' % self.rk_bnds)] self.bread = [('Elliptic Curves ', url_for(".index")), (self.field_label, self.urls['field']), (self.conductor_label, self.urls['conductor']), ('isogeny class %s' % self.short_label, self.urls['class'])]
def display_number_field(self): if self.nf == "": return "The number field of this isogeny class is not in the database." else: return nf_display_knowl(self.nf,field_pretty(self.nf))
def make_form(self): # To start with the data fields of self are just those from # the database. We need to reformat these and compute some # further (easy) data about it. # from lmfdb.ecnf.WebEllipticCurve import FIELD self.field = FIELD(self.field_label) pretty_field = field_pretty(self.field_label) self.field_knowl = nf_display_knowl(self.field_label, getDBConnection(), pretty_field) try: dims = db_dims().find_one({'field_label':self.field_label, 'level_label':self.level_label})['gl2_dims'] self.newspace_dimension = dims[str(self.weight)]['new_dim'] except TypeError: self.newspace_dimension = 'not available' self.newspace_label = "-".join([self.field_label,self.level_label]) self.newspace_url = url_for(".render_bmf_space_webpage", field_label=self.field_label, level_label=self.level_label) K = self.field.K() if self.dimension>1: Qx = PolynomialRing(QQ,'x') self.hecke_poly = Qx(str(self.hecke_poly)) F = NumberField(self.hecke_poly,'z') self.hecke_poly = web_latex(self.hecke_poly) def conv(ap): if '?' in ap: return 'not known' else: return F(str(ap)) self.hecke_eigs = [conv(str(ap)) for ap in self.hecke_eigs] self.nap = len(self.hecke_eigs) self.nap0 = min(50, self.nap) self.hecke_table = [[web_latex(p.norm()), ideal_label(p), web_latex(p.gens_reduced()[0]), web_latex(ap)] for p,ap in zip(primes_iter(K), self.hecke_eigs[:self.nap0])] level = ideal_from_label(K,self.level_label) self.level_ideal2 = web_latex(level) badp = level.prime_factors() self.have_AL = self.AL_eigs[0]!='?' if self.have_AL: self.AL_table = [[web_latex(p.norm()), ideal_label(p), web_latex(p.gens_reduced()[0]), web_latex(ap)] for p,ap in zip(badp, self.AL_eigs)] self.sign = 'not determined' if self.sfe == 1: self.sign = "+1" elif self.sfe == -1: self.sign = "-1" if self.Lratio == '?': self.Lratio = "not determined" self.anrank = "not determined" else: self.Lratio = QQ(self.Lratio) self.anrank = "\(0\)" if self.Lratio!=0 else "odd" if self.sfe==-1 else "\(\ge2\), even" self.properties2 = [('Base field', pretty_field), ('Weight', str(self.weight)), ('Level norm', str(self.level_norm)), ('Level', self.level_ideal2), ('Label', self.label), ('Dimension', str(self.dimension)) ] if self.CM == '?': self.CM = 'not determined' elif self.CM == 0: self.CM = 'no' self.properties2.append(('CM', str(self.CM))) self.bc_extra = '' self.bcd = 0 self.bct = self.bc!='?' and self.bc!=0 if self.bc == '?': self.bc = 'not determined' elif self.bc == 0: self.bc = 'no' elif self.bc == 1: self.bcd = self.bc self.bc = 'yes' elif self.bc >1: self.bcd = self.bc self.bc = 'yes' self.bc_extra = ', of a form over \(\mathbb{Q}\) with coefficients in \(\mathbb{Q}(\sqrt{'+str(self.bcd)+'})\)' elif self.bc == -1: self.bc = 'no' self.bc_extra = ', but is a twist of the base-change of a form over \(\mathbb{Q}\)' elif self.bc < -1: self.bcd = -self.bc self.bc = 'no' self.bc_extra = ', but is a twist of the base-change of a form over \(\mathbb{Q}\) with coefficients in \(\mathbb{Q}(\sqrt{'+str(self.bcd)+'})\)' self.properties2.append(('Base-change', str(self.bc))) curve = db_ecnf().find_one({'class_label':self.label}) if curve: self.ec_status = 'exists' self.ec_url = url_for("ecnf.show_ecnf_isoclass", nf=self.field_label, conductor_label=self.level_label, class_label=self.label_suffix) curve_bc = curve['base_change'] curve_bc_parts = [split_lmfdb_label(lab) for lab in curve_bc] bc_urls = [url_for("emf.render_elliptic_modular_forms", level=cond, weight=2, character=1, label=iso) for cond, iso, num in curve_bc_parts] bc_labels = [newform_label(cond,2,1,iso) for cond,iso,num in curve_bc_parts] bc_exists = [is_newform_in_db(lab) for lab in bc_labels] self.bc_forms = [{'exists':ex, 'label':lab, 'url':url} for ex,lab,url in zip(bc_exists, bc_labels, bc_urls)] else: self.bc_forms = [] if self.bct: self.ec_status = 'none' else: self.ec_status = 'missing' self.properties2.append(('Sign', self.sign)) self.properties2.append(('Analytic rank', self.anrank)) self.friends = [] if self.dimension==1: if self.ec_status == 'exists': self.friends += [('Elliptic curve isogeny class {}'.format(self.label), self.ec_url)] elif self.ec_status == 'missing': self.friends += [('Elliptic curve {} missing'.format(self.label), "")] else: self.friends += [('No elliptic curve', "")] self.friends += [ ('Newspace {}'.format(self.newspace_label),self.newspace_url)] self.friends += [ ('L-function not available','')]
def bmf_field_dim_table(**args): argsdict = to_dict(args) argsdict.update(to_dict(request.args)) gl_or_sl = argsdict['gl_or_sl'] field_label=argsdict['field_label'] field_label = nf_string_to_label(field_label) start = 0 if 'start' in argsdict: start = int(argsdict['start']) info={} info['gl_or_sl'] = gl_or_sl # level_flag controls whether to list all levels ('all'), only # those with positive cuspidal dimension ('cusp'), or only those # with positive new dimension ('new'). Default is 'cusp'. level_flag = argsdict.get('level_flag', 'cusp') info['level_flag'] = level_flag count = 50 if 'count' in argsdict: count = int(argsdict['count']) pretty_field_label = field_pretty(field_label) bread = [('Bianchi Modular Forms', url_for(".index")), ( pretty_field_label, ' ')] properties = [] if gl_or_sl=='gl2_dims': info['group'] = 'GL(2)' info['bgroup'] = '\GL(2,\mathcal{O}_K)' else: info['group'] = 'SL(2)' info['bgroup'] = '\SL(2,\mathcal{O}_K)' t = ' '.join(['Dimensions of Spaces of {} Bianchi Modular Forms over'.format(info['group']), pretty_field_label]) query = {} query['field_label'] = field_label query[gl_or_sl] = {'$exists': True} data = db_dims().find(query) data = data.sort([('level_norm', ASCENDING)]) info['number'] = nres = data.count() if nres > count or start != 0: info['report'] = 'Displaying items %s-%s of %s levels,' % (start + 1, min(nres, start + count), nres) else: info['report'] = 'Displaying all %s levels,' % nres # convert data to a list and eliminate levels where all # new/cuspidal dimensions are 0. (This could be done at the # search stage, but that requires adding new fields to each # record.) def filter(dat, flag): dat1 = dat[gl_or_sl] return any([int(dat1[w][flag])>0 for w in dat1]) flag = 'cuspidal_dim' if level_flag=='cusp' else 'new_dim' data = [dat for dat in data if level_flag == 'all' or filter(dat, flag)] data = data[start:start+count] info['field'] = field_label info['field_pretty'] = pretty_field_label nf = WebNumberField(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())) weights = set() for dat in data: weights = weights.union(set(dat[gl_or_sl].keys())) weights = list([int(w) for w in weights]) weights.sort() info['weights'] = weights info['nweights'] = len(weights) info['count'] = count info['start'] = start info['more'] = int(start + count < nres) data.sort(key = lambda x: [int(y) for y in x['level_label'].split(".")]) dims = {} for dat in data: dims[dat['level_label']] = d = {} for w in weights: sw = str(w) if sw in dat[gl_or_sl]: d[w] = {'d': dat[gl_or_sl][sw]['cuspidal_dim'], 'n': dat[gl_or_sl][sw]['new_dim']} else: d[w] = {'d': '?', 'n': '?'} info['nlevels'] = len(data) dimtable = [{'level_label': dat['level_label'], 'level_norm': dat['level_norm'], 'level_space': url_for(".render_bmf_space_webpage", field_label=field_label, level_label=dat['level_label']) if gl_or_sl=='gl2_dims' else "", 'dims': dims[dat['level_label']]} for dat in data] info['dimtable'] = dimtable return render_template("bmf-field_dim_table.html", info=info, title=t, properties=properties, bread=bread)
def make_form(self): # To start with the data fields of self are just those from # the database. We need to reformat these and compute some # further (easy) data about it. # from lmfdb.ecnf.WebEllipticCurve import FIELD self.field = FIELD(self.field_label) pretty_field = field_pretty(self.field_label) self.field_knowl = nf_display_knowl(self.field_label, pretty_field) try: dims = db.bmf_dims.lucky( { 'field_label': self.field_label, 'level_label': self.level_label }, projection='gl2_dims') self.newspace_dimension = dims[str(self.weight)]['new_dim'] except TypeError: self.newspace_dimension = 'not available' self.newspace_label = "-".join([self.field_label, self.level_label]) self.newspace_url = url_for(".render_bmf_space_webpage", field_label=self.field_label, level_label=self.level_label) K = self.field.K() if self.dimension > 1: Qx = PolynomialRing(QQ, 'x') self.hecke_poly = Qx(str(self.hecke_poly)) F = NumberField(self.hecke_poly, 'z') self.hecke_poly = web_latex(self.hecke_poly) def conv(ap): if '?' in ap: return 'not known' else: return F(str(ap)) self.hecke_eigs = [conv(str(ap)) for ap in self.hecke_eigs] self.nap = len(self.hecke_eigs) self.nap0 = min(50, self.nap) self.hecke_table = [[ web_latex(p.norm()), ideal_label(p), web_latex(p.gens_reduced()[0]), web_latex(ap) ] for p, ap in zip(primes_iter(K), self.hecke_eigs[:self.nap0])] level = ideal_from_label(K, self.level_label) self.level_ideal2 = web_latex(level) badp = level.prime_factors() self.have_AL = self.AL_eigs[0] != '?' if self.have_AL: self.AL_table = [[ web_latex(p.norm()), ideal_label(p), web_latex(p.gens_reduced()[0]), web_latex(ap) ] for p, ap in zip(badp, self.AL_eigs)] self.sign = 'not determined' if self.sfe == 1: self.sign = "+1" elif self.sfe == -1: self.sign = "-1" if self.Lratio == '?': self.Lratio = "not determined" self.anrank = "not determined" else: self.Lratio = QQ(self.Lratio) self.anrank = "\(0\)" if self.Lratio != 0 else "odd" if self.sfe == -1 else "\(\ge2\), even" self.properties2 = [('Base field', pretty_field), ('Weight', str(self.weight)), ('Level norm', str(self.level_norm)), ('Level', self.level_ideal2), ('Label', self.label), ('Dimension', str(self.dimension))] if self.CM == '?': self.CM = 'not determined' elif self.CM == 0: self.CM = 'no' self.properties2.append(('CM', str(self.CM))) self.bc_extra = '' self.bcd = 0 self.bct = self.bc != '?' and self.bc != 0 if self.bc == '?': self.bc = 'not determined' elif self.bc == 0: self.bc = 'no' elif self.bc == 1: self.bcd = self.bc self.bc = 'yes' elif self.bc > 1: self.bcd = self.bc self.bc = 'yes' self.bc_extra = ', of a form over \(\mathbb{Q}\) with coefficients in \(\mathbb{Q}(\sqrt{' + str( self.bcd) + '})\)' elif self.bc == -1: self.bc = 'no' self.bc_extra = ', but is a twist of the base-change of a form over \(\mathbb{Q}\)' elif self.bc < -1: self.bcd = -self.bc self.bc = 'no' self.bc_extra = ', but is a twist of the base-change of a form over \(\mathbb{Q}\) with coefficients in \(\mathbb{Q}(\sqrt{' + str( self.bcd) + '})\)' self.properties2.append(('Base-change', str(self.bc))) curve_bc = db.ec_nfcurves.lucky({'class_label': self.label}, projection="base_change") if curve_bc is not None: self.ec_status = 'exists' self.ec_url = url_for("ecnf.show_ecnf_isoclass", nf=self.field_label, conductor_label=self.level_label, class_label=self.label_suffix) curve_bc_parts = [split_lmfdb_label(lab) for lab in curve_bc] bc_urls = [ url_for("emf.render_elliptic_modular_forms", level=cond, weight=2, character=1, label=iso) for cond, iso, num in curve_bc_parts ] bc_labels = [ newform_label(cond, 2, 1, iso) for cond, iso, num in curve_bc_parts ] bc_exists = [is_newform_in_db(lab) for lab in bc_labels] self.bc_forms = [{ 'exists': ex, 'label': lab, 'url': url } for ex, lab, url in zip(bc_exists, bc_labels, bc_urls)] else: self.bc_forms = [] if self.bct: self.ec_status = 'none' else: self.ec_status = 'missing' self.properties2.append(('Sign', self.sign)) self.properties2.append(('Analytic rank', self.anrank)) self.friends = [] if self.dimension == 1: if self.ec_status == 'exists': self.friends += [ ('Elliptic curve isogeny class {}'.format(self.label), self.ec_url) ] elif self.ec_status == 'missing': self.friends += [ ('Elliptic curve {} missing'.format(self.label), "") ] else: self.friends += [('No elliptic curve', "")] self.friends += [('Newspace {}'.format(self.newspace_label), self.newspace_url)] self.friends += [('L-function not available', '')]
def render_field_webpage(args): data = None info = {} bread = [('Global Number Fields', url_for(".number_field_render_webpage"))] # This function should not be called unless label is set. label = clean_input(args['label']) nf = WebNumberField(label) data = {} if nf.is_null(): bread.append(('Search Results', ' ')) info['err'] = 'There is no field with label %s in the database' % label info['label'] = args['label_orig'] if 'label_orig' in args else args[ 'label'] return search_input_error(info, bread) info['wnf'] = nf data['degree'] = nf.degree() data['class_number'] = nf.class_number_latex() ram_primes = nf.ramified_primes() t = nf.galois_t() n = nf.degree() data['is_galois'] = nf.is_galois() data['is_abelian'] = nf.is_abelian() if nf.is_abelian(): conductor = nf.conductor() data['conductor'] = conductor dirichlet_chars = nf.dirichlet_group() if len(dirichlet_chars) > 0: data['dirichlet_group'] = [ '<a href = "%s">$\chi_{%s}(%s,·)$</a>' % (url_for('characters.render_Dirichletwebpage', modulus=data['conductor'], number=j), data['conductor'], j) for j in dirichlet_chars ] data['dirichlet_group'] = r'$\lbrace$' + ', '.join( data['dirichlet_group']) + r'$\rbrace$' if data['conductor'].is_prime() or data['conductor'] == 1: data['conductor'] = "\(%s\)" % str(data['conductor']) else: factored_conductor = factor_base_factor(data['conductor'], ram_primes) factored_conductor = factor_base_factorization_latex( factored_conductor) data['conductor'] = "\(%s=%s\)" % (str( data['conductor']), factored_conductor) data['galois_group'] = group_display_knowl(n, t) data['cclasses'] = cclasses_display_knowl(n, t) data['character_table'] = character_table_display_knowl(n, t) data['class_group'] = nf.class_group() data['class_group_invs'] = nf.class_group_invariants() data['signature'] = nf.signature() data['coefficients'] = nf.coeffs() nf.make_code_snippets() D = nf.disc() data['disc_factor'] = nf.disc_factored_latex() if D.abs().is_prime() or D == 1: data['discriminant'] = "\(%s\)" % str(D) else: data['discriminant'] = "\(%s=%s\)" % (str(D), data['disc_factor']) data['frob_data'], data['seeram'] = frobs(nf) # Bad prime information npr = len(ram_primes) ramified_algebras_data = nf.ramified_algebras_data() if isinstance(ramified_algebras_data, str): loc_alg = '' else: # [label, latex, e, f, c, gal] loc_alg = '' for j in range(npr): if ramified_algebras_data[j] is None: loc_alg += '<tr><td>%s<td colspan="7">Data not computed' % str( ram_primes[j]) else: mydat = ramified_algebras_data[j] p = ram_primes[j] loc_alg += '<tr><td rowspan="%d">$%s$</td>' % (len(mydat), str(p)) mm = mydat[0] myurl = url_for('local_fields.by_label', label=mm[0]) lab = mm[0] if mm[3] * mm[2] == 1: lab = r'$\Q_{%s}$' % str(p) loc_alg += '<td><a href="%s">%s</a><td>$%s$<td>$%d$<td>$%d$<td>$%d$<td>%s<td>$%s$' % ( myurl, lab, mm[1], mm[2], mm[3], mm[4], mm[5], show_slope_content(mm[8], mm[6], mm[7])) for mm in mydat[1:]: lab = mm[0] if mm[3] * mm[2] == 1: lab = r'$\Q_{%s}$' % str(p) loc_alg += '<tr><td><a href="%s">%s</a><td>$%s$<td>$%d$<td>$%d$<td>$%d$<td>%s<td>$%s$' % ( myurl, lab, mm[1], mm[2], mm[3], mm[4], mm[5], show_slope_content(mm[8], mm[6], mm[7])) loc_alg += '</tbody></table>' ram_primes = str(ram_primes)[1:-1] if ram_primes == '': ram_primes = r'\textrm{None}' data['phrase'] = group_phrase(n, t) zk = nf.zk() Ra = PolynomialRing(QQ, 'a') zk = [latex(Ra(x)) for x in zk] zk = ['$%s$' % x for x in zk] zk = ', '.join(zk) grh_label = '<small>(<a title="assuming GRH" knowl="nf.assuming_grh">assuming GRH</a>)</small>' if nf.used_grh( ) else '' # Short version for properties grh_lab = nf.short_grh_string() if 'Not' in str(data['class_number']): grh_lab = '' grh_label = '' pretty_label = field_pretty(label) if label != pretty_label: pretty_label = "%s: %s" % (label, pretty_label) info.update(data) if nf.degree() > 1: gpK = nf.gpK() rootof1coeff = gpK.nfrootsof1() rootofunityorder = int(rootof1coeff[1]) rootof1coeff = rootof1coeff[2] rootofunity = web_latex( Ra( str(pari("lift(%s)" % gpK.nfbasistoalg(rootof1coeff))).replace( 'x', 'a'))) rootofunity += ' (order $%d$)' % rootofunityorder else: rootofunity = web_latex(Ra('-1')) + ' (order $2$)' info.update({ 'label': pretty_label, 'label_raw': label, 'polynomial': web_latex_split_on_pm(nf.poly()), 'ram_primes': ram_primes, 'integral_basis': zk, 'regulator': web_latex(nf.regulator()), 'unit_rank': nf.unit_rank(), 'root_of_unity': rootofunity, 'fund_units': nf.units(), 'grh_label': grh_label, 'loc_alg': loc_alg }) bread.append(('%s' % info['label_raw'], ' ')) info['downloads_visible'] = True info['downloads'] = [('worksheet', '/')] info['friends'] = [] if nf.can_class_number(): # hide ones that take a lond time to compute on the fly # note that the first degree 4 number field missed the zero of the zeta function if abs(D**n) < 50000000: info['friends'].append(('L-function', "/L/NumberField/%s" % label)) info['friends'].append(('Galois group', "/GaloisGroup/%dT%d" % (n, t))) if 'dirichlet_group' in info: info['friends'].append(('Dirichlet character group', url_for("characters.dirichlet_group_table", modulus=int(conductor), char_number_list=','.join( [str(a) for a in dirichlet_chars]), poly=info['polynomial']))) resinfo = [] galois_closure = nf.galois_closure() if galois_closure[0] > 0: if len(galois_closure[1]) > 0: resinfo.append(('gc', galois_closure[1])) if len(galois_closure[2]) > 0: info['friends'].append(('Galois closure', url_for(".by_label", label=galois_closure[2][0]))) else: resinfo.append(('gc', [dnc])) sextic_twins = nf.sextic_twin() if sextic_twins[0] > 0: if len(sextic_twins[1]) > 0: resinfo.append(('sex', r' $\times$ '.join(sextic_twins[1]))) else: resinfo.append(('sex', dnc)) siblings = nf.siblings() # [degsib list, label list] # first is list of [deg, num expected, list of knowls] if len(siblings[0]) > 0: for sibdeg in siblings[0]: if len(sibdeg[2]) == 0: sibdeg[2] = dnc else: sibdeg[2] = ', '.join(sibdeg[2]) if len(sibdeg[2]) < sibdeg[1]: sibdeg[2] += ', some ' + dnc resinfo.append(('sib', siblings[0])) for lab in siblings[1]: if lab != '': labparts = lab.split('.') info['friends'].append(("Degree %s sibling" % labparts[0], url_for(".by_label", label=lab))) arith_equiv = nf.arith_equiv() if arith_equiv[0] > 0: if len(arith_equiv[1]) > 0: resinfo.append( ('ae', ', '.join(arith_equiv[1]), len(arith_equiv[1]))) for aelab in arith_equiv[2]: info['friends'].append(('Arithmetically equivalent sibling', url_for(".by_label", label=aelab))) else: resinfo.append(('ae', dnc, len(arith_equiv[1]))) info['resinfo'] = resinfo learnmore = learnmore_list() #if info['signature'] == [0,1]: # info['learnmore'].append(('Quadratic imaginary class groups', url_for(".render_class_group_data"))) # With Galois group labels, probably not needed here # info['learnmore'] = [('Global number field labels', # url_for(".render_labels_page")), ('Galois group # labels',url_for(".render_groups_page")), # (Completename,url_for(".render_discriminants_page"))] title = "Global Number Field %s" % info['label'] if npr == 1: primes = 'prime' else: primes = 'primes' properties2 = [('Label', label), ('Degree', '$%s$' % data['degree']), ('Signature', '$%s$' % data['signature']), ('Discriminant', '$%s$' % data['disc_factor']), ('Ramified ' + primes + '', '$%s$' % ram_primes), ('Class number', '%s %s' % (data['class_number'], grh_lab)), ('Class group', '%s %s' % (data['class_group_invs'], grh_lab)), ('Galois Group', group_display_short(data['degree'], t))] downloads = [] for lang in [["Magma", "magma"], ["SageMath", "sage"], ["Pari/GP", "gp"]]: downloads.append(('Download {} code'.format(lang[0]), url_for(".nf_code_download", nf=label, download_type=lang[1]))) from lmfdb.artin_representations.math_classes import NumberFieldGaloisGroup try: info["tim_number_field"] = NumberFieldGaloisGroup(nf._data['coeffs']) v = nf.factor_perm_repn(info["tim_number_field"]) def dopow(m): if m == 0: return '' if m == 1: return '*' return '*<sup>%d</sup>' % m info["mydecomp"] = [dopow(x) for x in v] except AttributeError: pass return render_template("number_field.html", properties2=properties2, credit=NF_credit, title=title, bread=bread, code=nf.code, friends=info.pop('friends'), downloads=downloads, learnmore=learnmore, info=info)
def render_field_webpage(args): data = None info = {} bread = [('Global Number Fields', url_for(".number_field_render_webpage"))] # This function should not be called unless label is set. label = clean_input(args['label']) nf = WebNumberField(label) data = {} if nf.is_null(): bread.append(('Search Results', ' ')) info['err'] = 'There is no field with label %s in the database' % label info['label'] = args['label_orig'] if 'label_orig' in args else args['label'] return search_input_error(info, bread) info['wnf'] = nf data['degree'] = nf.degree() data['class_number'] = nf.class_number_latex() ram_primes = nf.ramified_primes() t = nf.galois_t() n = nf.degree() data['is_galois'] = nf.is_galois() data['is_abelian'] = nf.is_abelian() if nf.is_abelian(): conductor = nf.conductor() data['conductor'] = conductor dirichlet_chars = nf.dirichlet_group() if len(dirichlet_chars)>0: data['dirichlet_group'] = ['<a href = "%s">$\chi_{%s}(%s,·)$</a>' % (url_for('characters.render_Dirichletwebpage',modulus=data['conductor'], number=j), data['conductor'], j) for j in dirichlet_chars] data['dirichlet_group'] = r'$\lbrace$' + ', '.join(data['dirichlet_group']) + r'$\rbrace$' if data['conductor'].is_prime() or data['conductor'] == 1: data['conductor'] = "\(%s\)" % str(data['conductor']) else: factored_conductor = factor_base_factor(data['conductor'], ram_primes) factored_conductor = factor_base_factorization_latex(factored_conductor) data['conductor'] = "\(%s=%s\)" % (str(data['conductor']), factored_conductor) data['galois_group'] = group_display_knowl(n, t) data['cclasses'] = cclasses_display_knowl(n, t) data['character_table'] = character_table_display_knowl(n, t) data['class_group'] = nf.class_group() data['class_group_invs'] = nf.class_group_invariants() data['signature'] = nf.signature() data['coefficients'] = nf.coeffs() nf.make_code_snippets() D = nf.disc() data['disc_factor'] = nf.disc_factored_latex() if D.abs().is_prime() or D == 1: data['discriminant'] = "\(%s\)" % str(D) else: data['discriminant'] = "\(%s=%s\)" % (str(D), data['disc_factor']) data['frob_data'], data['seeram'] = frobs(nf) # Bad prime information npr = len(ram_primes) ramified_algebras_data = nf.ramified_algebras_data() if isinstance(ramified_algebras_data,str): loc_alg = '' else: # [label, latex, e, f, c, gal] loc_alg = '' for j in range(npr): if ramified_algebras_data[j] is None: loc_alg += '<tr><td>%s<td colspan="7">Data not computed'%str(ram_primes[j]) else: mydat = ramified_algebras_data[j] p = ram_primes[j] loc_alg += '<tr><td rowspan="%d">$%s$</td>'%(len(mydat),str(p)) mm = mydat[0] myurl = url_for('local_fields.by_label', label=mm[0]) lab = mm[0] if mm[3]*mm[2]==1: lab = r'$\Q_{%s}$'%str(p) loc_alg += '<td><a href="%s">%s</a><td>$%s$<td>$%d$<td>$%d$<td>$%d$<td>%s<td>$%s$'%(myurl,lab,mm[1],mm[2],mm[3],mm[4],mm[5],show_slope_content(mm[8],mm[6],mm[7])) for mm in mydat[1:]: lab = mm[0] if mm[3]*mm[2]==1: lab = r'$\Q_{%s}$'%str(p) loc_alg += '<tr><td><a href="%s">%s</a><td>$%s$<td>$%d$<td>$%d$<td>$%d$<td>%s<td>$%s$'%(myurl,lab,mm[1],mm[2],mm[3],mm[4],mm[5],show_slope_content(mm[8],mm[6],mm[7])) loc_alg += '</tbody></table>' ram_primes = str(ram_primes)[1:-1] if ram_primes == '': ram_primes = r'\textrm{None}' data['phrase'] = group_phrase(n, t) zk = nf.zk() Ra = PolynomialRing(QQ, 'a') zk = [latex(Ra(x)) for x in zk] zk = ['$%s$' % x for x in zk] zk = ', '.join(zk) grh_label = '<small>(<a title="assuming GRH" knowl="nf.assuming_grh">assuming GRH</a>)</small>' if nf.used_grh() else '' # Short version for properties grh_lab = nf.short_grh_string() if 'Not' in str(data['class_number']): grh_lab='' grh_label='' pretty_label = field_pretty(label) if label != pretty_label: pretty_label = "%s: %s" % (label, pretty_label) info.update(data) if nf.degree() > 1: gpK = nf.gpK() rootof1coeff = gpK.nfrootsof1() rootofunityorder = int(rootof1coeff[1]) rootof1coeff = rootof1coeff[2] rootofunity = web_latex(Ra(str(pari("lift(%s)" % gpK.nfbasistoalg(rootof1coeff))).replace('x','a'))) rootofunity += ' (order $%d$)' % rootofunityorder else: rootofunity = web_latex(Ra('-1'))+ ' (order $2$)' info.update({ 'label': pretty_label, 'label_raw': label, 'polynomial': web_latex_split_on_pm(nf.poly()), 'ram_primes': ram_primes, 'integral_basis': zk, 'regulator': web_latex(nf.regulator()), 'unit_rank': nf.unit_rank(), 'root_of_unity': rootofunity, 'fund_units': nf.units(), 'grh_label': grh_label, 'loc_alg': loc_alg }) bread.append(('%s' % info['label_raw'], ' ')) info['downloads_visible'] = True info['downloads'] = [('worksheet', '/')] info['friends'] = [] if nf.can_class_number(): # hide ones that take a lond time to compute on the fly # note that the first degree 4 number field missed the zero of the zeta function if abs(D**n) < 50000000: info['friends'].append(('L-function', "/L/NumberField/%s" % label)) info['friends'].append(('Galois group', "/GaloisGroup/%dT%d" % (n, t))) if 'dirichlet_group' in info: info['friends'].append(('Dirichlet character group', url_for("characters.dirichlet_group_table", modulus=int(conductor), char_number_list=','.join( [str(a) for a in dirichlet_chars]), poly=info['polynomial']))) resinfo=[] galois_closure = nf.galois_closure() if galois_closure[0]>0: if len(galois_closure[1])>0: resinfo.append(('gc', galois_closure[1])) if len(galois_closure[2]) > 0: info['friends'].append(('Galois closure',url_for(".by_label", label=galois_closure[2][0]))) else: resinfo.append(('gc', [dnc])) sextic_twins = nf.sextic_twin() if sextic_twins[0]>0: if len(sextic_twins[1])>0: resinfo.append(('sex', r' $\times$ '.join(sextic_twins[1]))) else: resinfo.append(('sex', dnc)) siblings = nf.siblings() # [degsib list, label list] # first is list of [deg, num expected, list of knowls] if len(siblings[0])>0: for sibdeg in siblings[0]: if len(sibdeg[2]) ==0: sibdeg[2] = dnc else: sibdeg[2] = ', '.join(sibdeg[2]) if len(sibdeg[2])<sibdeg[1]: sibdeg[2] += ', some '+dnc resinfo.append(('sib', siblings[0])) for lab in siblings[1]: if lab != '': labparts = lab.split('.') info['friends'].append(("Degree %s sibling"%labparts[0] ,url_for(".by_label", label=lab))) arith_equiv = nf.arith_equiv() if arith_equiv[0]>0: if len(arith_equiv[1])>0: resinfo.append(('ae', ', '.join(arith_equiv[1]), len(arith_equiv[1]))) for aelab in arith_equiv[2]: info['friends'].append(('Arithmetically equivalent sibling',url_for(".by_label", label=aelab))) else: resinfo.append(('ae', dnc, len(arith_equiv[1]))) info['resinfo'] = resinfo learnmore = learnmore_list() #if info['signature'] == [0,1]: # info['learnmore'].append(('Quadratic imaginary class groups', url_for(".render_class_group_data"))) # With Galois group labels, probably not needed here # info['learnmore'] = [('Global number field labels', # url_for(".render_labels_page")), ('Galois group # labels',url_for(".render_groups_page")), # (Completename,url_for(".render_discriminants_page"))] title = "Global Number Field %s" % info['label'] if npr == 1: primes = 'prime' else: primes = 'primes' properties2 = [('Label', label), ('Degree', '$%s$' % data['degree']), ('Signature', '$%s$' % data['signature']), ('Discriminant', '$%s$' % data['disc_factor']), ('Ramified ' + primes + '', '$%s$' % ram_primes), ('Class number', '%s %s' % (data['class_number'], grh_lab)), ('Class group', '%s %s' % (data['class_group_invs'], grh_lab)), ('Galois Group', group_display_short(data['degree'], t)) ] downloads = [] for lang in [["Magma","magma"], ["SageMath","sage"], ["Pari/GP", "gp"]]: downloads.append(('Download {} code'.format(lang[0]), url_for(".nf_code_download", nf=label, download_type=lang[1]))) from lmfdb.artin_representations.math_classes import NumberFieldGaloisGroup try: info["tim_number_field"] = NumberFieldGaloisGroup(nf._data['coeffs']) v = nf.factor_perm_repn(info["tim_number_field"]) def dopow(m): if m==0: return '' if m==1: return '*' return '*<sup>%d</sup>'% m info["mydecomp"] = [dopow(x) for x in v] except AttributeError: pass return render_template("number_field.html", properties2=properties2, credit=NF_credit, title=title, bread=bread, code=nf.code, friends=info.pop('friends'), downloads=downloads, learnmore=learnmore, info=info)
def bianchi_modular_form_search(**args): """Function to handle requests from the top page, either jump to one newform or do a search. """ info = to_dict(args) # what has been entered in the search boxes if 'label' in info: # The Label button has been pressed. return bianchi_modular_form_by_label(info['label']) query = {} for field in ['field_label', 'weight', 'level_norm', 'dimension']: if info.get(field): if field == 'weight': query['weight'] = info[field] elif field == 'field_label': parse_nf_string(info, query, field, 'base number field', field) elif field == 'label': query[field] = info[field] elif field == 'dimension': query['dimension'] = int(info[field]) elif field == 'level_norm': query[field] = parse_range(info[field]) else: query[field] = info[field] if not 'sfe' in info: info['sfe'] = "any" elif info['sfe'] != "any": query['sfe'] = int(info['sfe']) if 'include_cm' in info: if info['include_cm'] == 'exclude': query['CM'] = 0 elif info['include_cm'] == 'only': query['CM'] = {'$nin': [0, '?']} if 'include_base_change' in info and info['include_base_change'] == 'off': query['bc'] = 0 else: info['include_base_change'] = "on" start = 0 if 'start' in request.args: start = int(request.args['start']) count = 50 if 'count' in request.args: count = int(request.args['count']) info['query'] = dict(query) res = db_forms().find(query).sort([('level_norm', ASCENDING), ('label', ASCENDING) ]).skip(start).limit(count) nres = res.count() if nres > 0: info['field_pretty_name'] = field_pretty(res[0]['field_label']) else: info['field_pretty_name'] = '' info['number'] = nres if nres == 1: info['report'] = 'unique match' elif nres == 2: info['report'] = 'displaying both matches' else: if nres > count or start != 0: info['report'] = 'displaying items %s-%s of %s matches' % ( start + 1, min(nres, start + count), nres) else: info['report'] = 'displaying all %s matches' % nres res_clean = [] for v in res: v_clean = {} v_clean['field_label'] = v['field_label'] v_clean['short_label'] = v['short_label'] v_clean['level_label'] = v['level_label'] v_clean['label_suffix'] = v['label_suffix'] v_clean['label'] = v['label'] v_clean['level_ideal'] = teXify_pol(v['level_ideal']) v_clean['dimension'] = v['dimension'] v_clean['sfe'] = "+1" if v['sfe'] == 1 else "-1" v_clean['url'] = url_for('.render_bmf_webpage', field_label=v['field_label'], level_label=v['level_label'], label_suffix=v['label_suffix']) v_clean['bc'] = bc_info(v['bc']) v_clean['cm'] = cm_info(v['CM']) res_clean.append(v_clean) info['forms'] = res_clean info['count'] = count info['start'] = start info['more'] = int(start + count < nres) t = 'Bianchi modular form search results' bread = [('Bianchi Modular Forms', url_for(".index")), ('Search results', ' ')] properties = [] return render_template("bmf-search_results.html", info=info, title=t, properties=properties, bread=bread, learnmore=learnmore_list())
def make_class(self): curves_data = db_g2c().curves.find({"class" : self.label}).sort([("disc_key", pymongo.ASCENDING), ("label", pymongo.ASCENDING)]) self.curves = [ {"label" : c['label'], "equation_formatted" : list_to_min_eqn(c['min_eqn']), "url": url_for_label(c['label'])} for c in curves_data ] self.ncurves = curves_data.count() self.bad_lfactors = [ [c[0], list_to_factored_poly_otherorder(c[1])] for c in self.bad_lfactors] for endalgtype in ['end_alg', 'rat_end_alg', 'real_end_alg', 'geom_end_alg', 'rat_geom_end_alg', 'real_geom_end_alg']: if hasattr(self, endalgtype): setattr(self,endalgtype + '_name',end_alg_name(getattr(self,endalgtype))) else: setattr(self,endalgtype + '_name','') self.st_group_name = st_group_name(self.st_group) if hasattr(self, 'geom_end_field') and self.geom_end_field <> '': self.geom_end_field_name = field_pretty(self.geom_end_field) else: self.geom_end_field_name = '' if self.is_gl2_type: self.is_gl2_type_name = 'yes' else: self.is_gl2_type_name = 'no' if hasattr(self, 'is_simple'): if self.is_simple: self.is_simple_name = 'yes' else: self.is_simple_name = 'no' else: self.is_simple_name = '?' if hasattr(self, 'is_geom_simple'): if self.is_geom_simple: self.is_geom_simple_name = 'yes' else: self.is_geom_simple_name = 'no' else: self.is_geom_simple_name = '?' x = self.label.split('.')[1] self.friends = [ ('L-function', url_for("l_functions.l_function_genus2_page", cond=self.cond,x=x)), ('Siegel modular form someday', '.')] self.ecproduct_wurl = [] if hasattr(self, 'ecproduct'): for i in range(2): curve_label = self.ecproduct[i] crv_url = url_for("ec.by_ec_label", label=curve_label) if i == 1 or len(set(self.ecproduct)) <> 1: self.friends.append(('Elliptic curve ' + curve_label, crv_url)) self.ecproduct_wurl.append({'label' : curve_label, 'url' : crv_url}) self.ecquadratic_wurl = [] if hasattr(self, 'ecquadratic'): for i in range(len(self.ecquadratic)): curve_label = self.ecquadratic[i] crv_spl = curve_label.split('-') crv_url = url_for("ecnf.show_ecnf_isoclass", nf = crv_spl[0], conductor_label = crv_spl[1], class_label = crv_spl[2]) self.friends.append(('Elliptic curve ' + curve_label, crv_url)) self.ecquadratic_wurl.append({'label' : curve_label, 'url' : crv_url, 'nf' : crv_spl[0]}) if hasattr(self, 'mfproduct'): for i in range(len(self.mfproduct)): mf_label = self.mfproduct[i] mf_spl = mf_label.split('.') mf_spl.append(mf_spl[2][-1]) mf_spl[2] = mf_spl[2][:-1] # Need a splitting function mf_url = url_for("emf.render_elliptic_modular_forms", level=mf_spl[0], weight=mf_spl[1], character=mf_spl[2], label=mf_spl[3]) self.friends.append(('Modular form ' + mf_label, mf_url)) if hasattr(self, 'mfhilbert'): for i in range(len(self.mfhilbert)): mf_label = self.mfhilbert[i] mf_spl = mf_label.split('-') mf_url = url_for("hmf.render_hmf_webpage", field_label=mf_spl[0], label=mf_label) self.friends.append(('Hilbert modular form ' + mf_label, mf_url)) self.properties = [('Label', self.label), ('Number of curves', str(self.ncurves)), ('Conductor','%s' % self.cond), ('Sato-Tate group', '\(%s\)' % self.st_group_name), ('\(\mathrm{End}(J_{\overline{\Q}}) \otimes \R\)','\(%s\)' % self.real_geom_end_alg_name), ('\(\mathrm{GL}_2\)-type','%s' % self.is_gl2_type_name)] self.title = "Genus 2 Isogeny Class %s" % (self.label) self.downloads = [ ('Download Euler factors', ".")] # url_for(".download_g2c_eulerfactors", label=self.label)), # ('Download stored data for all curves', url_for(".download_g2c_all", label=self.label))] self.bread = [ ('Genus 2 Curves', url_for(".index")), ('$\Q$', url_for(".index_Q")), ('%s' % self.cond, url_for(".by_conductor", conductor=self.cond)), ('%s' % self.label, ' ') ]
def bmf_field_dim_table(**args): argsdict = to_dict(args) argsdict.update(to_dict(request.args)) gl_or_sl = argsdict['gl_or_sl'] field_label=argsdict['field_label'] field_label = nf_string_to_label(field_label) start = 0 if 'start' in argsdict: start = int(argsdict['start']) info={} info['gl_or_sl'] = gl_or_sl # level_flag controls whether to list all levels ('all'), only # those with positive cuspidal dimension ('cusp'), or only those # with positive new dimension ('new'). Default is 'cusp'. level_flag = argsdict.get('level_flag', 'cusp') info['level_flag'] = level_flag count = 50 if 'count' in argsdict: count = int(argsdict['count']) pretty_field_label = field_pretty(field_label) bread = [('Bianchi Modular Forms', url_for(".index")), ( pretty_field_label, ' ')] properties = [] if gl_or_sl=='gl2_dims': info['group'] = 'GL(2)' info['bgroup'] = '\GL(2,\mathcal{O}_K)' else: info['group'] = 'SL(2)' info['bgroup'] = '\SL(2,\mathcal{O}_K)' t = ' '.join(['Dimensions of spaces of {} Bianchi modular forms over'.format(info['group']), pretty_field_label]) query = {} query['field_label'] = field_label query[gl_or_sl] = {'$exists': True} if level_flag != 'all': # find which weights are present (TODO: get this from a stats collection) wts = list(sum((Set(d.keys()) for d in db_dims().distinct(gl_or_sl)),Set())) if level_flag == 'cusp': # restrict the query to only return levels where at least one # cuspidal dimension is positive: query.update( {'$or':[{gl_or_sl+'.{}.cuspidal_dim'.format(w):{'$gt':0}} for w in wts]} ) if level_flag == 'new': # restrict the query to only return levels where at least one # new dimension is positive: query.update( {'$or':[{gl_or_sl+'.{}.new_dim'.format(w):{'$gt':0}} for w in wts]} ) data = db_dims().find(query) data = data.sort([('level_norm', ASCENDING)]) info['number'] = nres = data.count() if nres > count or start != 0: info['report'] = 'Displaying items %s-%s of %s levels,' % (start + 1, min(nres, start + count), nres) else: info['report'] = 'Displaying all %s levels,' % nres data = list(data.skip(start).limit(count)) info['field'] = field_label info['field_pretty'] = pretty_field_label nf = WebNumberField(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())) weights = set() for dat in data: weights = weights.union(set(dat[gl_or_sl].keys())) weights = list([int(w) for w in weights]) weights.sort() info['weights'] = weights info['nweights'] = len(weights) info['count'] = count info['start'] = start info['more'] = int(start + count < nres) dims = {} for dat in data: dims[dat['level_label']] = d = {} for w in weights: sw = str(w) if sw in dat[gl_or_sl]: d[w] = {'d': dat[gl_or_sl][sw]['cuspidal_dim'], 'n': dat[gl_or_sl][sw]['new_dim']} else: d[w] = {'d': '?', 'n': '?'} info['nlevels'] = len(data) dimtable = [{'level_label': dat['level_label'], 'level_norm': dat['level_norm'], 'level_space': url_for(".render_bmf_space_webpage", field_label=field_label, level_label=dat['level_label']) if gl_or_sl=='gl2_dims' else "", 'dims': dims[dat['level_label']]} for dat in data] print("Length of dimtable = {}".format(len(dimtable))) info['dimtable'] = dimtable return render_template("bmf-field_dim_table.html", info=info, title=t, properties=properties, bread=bread)
def render_field_webpage(args): data = None C = base.getDBConnection() info = {} bread = [('Global Number Fields', url_for(".number_field_render_webpage"))] # This function should not be called unless label is set. label = clean_input(args['label']) nf = WebNumberField(label) data = {} if nf.is_null(): bread.append(('Search results', ' ')) info['err'] = 'There is no field with label %s in the database' % label info['label'] = args['label_orig'] if 'label_orig' in args else args['label'] return search_input_error(info, bread) info['wnf'] = nf data['degree'] = nf.degree() data['class_number'] = nf.class_number() t = nf.galois_t() n = nf.degree() data['is_galois'] = nf.is_galois() data['is_abelian'] = nf.is_abelian() if nf.is_abelian(): conductor = nf.conductor() data['conductor'] = conductor dirichlet_chars = nf.dirichlet_group() if len(dirichlet_chars)>0: data['dirichlet_group'] = ['<a href = "%s">$\chi_{%s}(%s,·)$</a>' % (url_for('characters.render_Dirichletwebpage',modulus=data['conductor'], number=j), data['conductor'], j) for j in dirichlet_chars] data['dirichlet_group'] = r'$\lbrace$' + ', '.join(data['dirichlet_group']) + r'$\rbrace$' if data['conductor'].is_prime() or data['conductor'] == 1: data['conductor'] = "\(%s\)" % str(data['conductor']) else: data['conductor'] = "\(%s=%s\)" % (str(data['conductor']), latex(data['conductor'].factor())) data['galois_group'] = group_display_knowl(n, t, C) data['cclasses'] = cclasses_display_knowl(n, t, C) data['character_table'] = character_table_display_knowl(n, t, C) data['class_group'] = nf.class_group() data['class_group_invs'] = nf.class_group_invariants() data['signature'] = nf.signature() data['coefficients'] = nf.coeffs() nf.make_code_snippets() D = nf.disc() ram_primes = D.prime_factors() data['disc_factor'] = nf.disc_factored_latex() if D.abs().is_prime() or D == 1: data['discriminant'] = "\(%s\)" % str(D) else: data['discriminant'] = "\(%s=%s\)" % (str(D), data['disc_factor']) npr = len(ram_primes) ram_primes = str(ram_primes)[1:-1] if ram_primes == '': ram_primes = r'\textrm{None}' data['frob_data'], data['seeram'] = frobs(nf) data['phrase'] = group_phrase(n, t, C) zk = nf.zk() Ra = PolynomialRing(QQ, 'a') zk = [latex(Ra(x)) for x in zk] zk = ['$%s$' % x for x in zk] zk = ', '.join(zk) grh_label = '<small>(<a title="assuming GRH" knowl="nf.assuming_grh">assuming GRH</a>)</small>' if nf.used_grh() else '' # Short version for properties grh_lab = nf.short_grh_string() if 'Not' in str(data['class_number']): grh_lab='' grh_label='' pretty_label = field_pretty(label) if label != pretty_label: pretty_label = "%s: %s" % (label, pretty_label) info.update(data) if nf.degree() > 1: gpK = nf.gpK() rootof1coeff = gpK.nfrootsof1()[2] rootofunity = Ra(str(pari("lift(%s)" % gpK.nfbasistoalg(rootof1coeff))).replace('x','a')) else: rootofunity = Ra('-1') info.update({ 'label': pretty_label, 'label_raw': label, 'polynomial': web_latex_split_on_pm(nf.poly()), 'ram_primes': ram_primes, 'integral_basis': zk, 'regulator': web_latex(nf.regulator()), 'unit_rank': nf.unit_rank(), 'root_of_unity': web_latex(rootofunity), 'fund_units': nf.units(), 'grh_label': grh_label }) bread.append(('%s' % info['label_raw'], ' ')) info['downloads_visible'] = True info['downloads'] = [('worksheet', '/')] info['friends'] = [] if nf.can_class_number(): # hide ones that take a lond time to compute on the fly # note that the first degree 4 number field missed the zero of the zeta function if abs(D**n) < 50000000: info['friends'].append(('L-function', "/L/NumberField/%s" % label)) info['friends'].append(('Galois group', "/GaloisGroup/%dT%d" % (n, t))) if 'dirichlet_group' in info: info['friends'].append(('Dirichlet group', url_for("characters.dirichlet_group_table", modulus=int(conductor), char_number_list=','.join( [str(a) for a in dirichlet_chars]), poly=info['polynomial']))) info['learnmore'] = [('Global number field labels', url_for( ".render_labels_page")), (Completename, url_for(".render_discriminants_page")), ('How data was computed', url_for(".how_computed_page"))] if info['signature'] == [0,1]: info['learnmore'].append(('Quadratic imaginary class groups', url_for(".render_class_group_data"))) # With Galois group labels, probably not needed here # info['learnmore'] = [('Global number field labels', # url_for(".render_labels_page")), ('Galois group # labels',url_for(".render_groups_page")), # (Completename,url_for(".render_discriminants_page"))] title = "Global Number Field %s" % info['label'] if npr == 1: primes = 'prime' else: primes = 'primes' properties2 = [('Label', label), ('Degree', '%s' % data['degree']), ('Signature', '$%s$' % data['signature']), ('Discriminant', '$%s$' % data['disc_factor']), ('Ramified ' + primes + '', '$%s$' % ram_primes), ('Class number', '%s %s' % (data['class_number'], grh_lab)), ('Class group', '%s %s' % (data['class_group_invs'], grh_lab)), ('Galois Group', group_display_short(data['degree'], t, C)) ] from lmfdb.math_classes import NumberFieldGaloisGroup try: info["tim_number_field"] = NumberFieldGaloisGroup(nf._data['coeffs']) v = nf.factor_perm_repn(info["tim_number_field"]) def dopow(m): if m==0: return '' if m==1: return '*' return '*<sup>%d</sup>'% m info["mydecomp"] = [dopow(x) for x in v] except AttributeError: pass # del info['_id'] return render_template("number_field.html", properties2=properties2, credit=NF_credit, title=title, bread=bread, code=nf.code, friends=info.pop('friends'), learnmore=info.pop('learnmore'), info=info)
def bmf_field_dim_table(**args): argsdict = to_dict(args) argsdict.update(to_dict(request.args)) gl_or_sl = argsdict['gl_or_sl'] field_label=argsdict['field_label'] field_label = nf_string_to_label(field_label) start = 0 if 'start' in argsdict: start = int(argsdict['start']) info={} info['gl_or_sl'] = gl_or_sl # level_flag controls whether to list all levels ('all'), only # those with positive cuspidal dimension ('cusp'), or only those # with positive new dimension ('new'). Default is 'cusp'. level_flag = argsdict.get('level_flag', 'cusp') info['level_flag'] = level_flag count = 50 if 'count' in argsdict: count = int(argsdict['count']) pretty_field_label = field_pretty(field_label) bread = [('Bianchi Modular Forms', url_for(".index")), ( pretty_field_label, ' ')] properties = [] if gl_or_sl=='gl2_dims': info['group'] = 'GL(2)' info['bgroup'] = '\GL(2,\mathcal{O}_K)' else: info['group'] = 'SL(2)' info['bgroup'] = '\SL(2,\mathcal{O}_K)' t = ' '.join(['Dimensions of spaces of {} Bianchi modular forms over'.format(info['group']), pretty_field_label]) query = {} query['field_label'] = field_label query[gl_or_sl] = {'$exists': True} data = db_dims().find(query) data = data.sort([('level_norm', ASCENDING)]) info['number'] = nres = data.count() if nres > count or start != 0: info['report'] = 'Displaying items %s-%s of %s levels,' % (start + 1, min(nres, start + count), nres) else: info['report'] = 'Displaying all %s levels,' % nres # convert data to a list and eliminate levels where all # new/cuspidal dimensions are 0. (This could be done at the # search stage, but that requires adding new fields to each # record.) def filter(dat, flag): dat1 = dat[gl_or_sl] return any([int(dat1[w][flag])>0 for w in dat1]) flag = 'cuspidal_dim' if level_flag=='cusp' else 'new_dim' data = [dat for dat in data if level_flag == 'all' or filter(dat, flag)] data = data[start:start+count] info['field'] = field_label info['field_pretty'] = pretty_field_label nf = WebNumberField(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())) weights = set() for dat in data: weights = weights.union(set(dat[gl_or_sl].keys())) weights = list([int(w) for w in weights]) weights.sort() info['weights'] = weights info['nweights'] = len(weights) info['count'] = count info['start'] = start info['more'] = int(start + count < nres) data.sort(key = lambda x: [int(y) for y in x['level_label'].split(".")]) dims = {} for dat in data: dims[dat['level_label']] = d = {} for w in weights: sw = str(w) if sw in dat[gl_or_sl]: d[w] = {'d': dat[gl_or_sl][sw]['cuspidal_dim'], 'n': dat[gl_or_sl][sw]['new_dim']} else: d[w] = {'d': '?', 'n': '?'} info['nlevels'] = len(data) dimtable = [{'level_label': dat['level_label'], 'level_norm': dat['level_norm'], 'level_space': url_for(".render_bmf_space_webpage", field_label=field_label, level_label=dat['level_label']) if gl_or_sl=='gl2_dims' else "", 'dims': dims[dat['level_label']]} for dat in data] info['dimtable'] = dimtable return render_template("bmf-field_dim_table.html", info=info, title=t, properties=properties, bread=bread)
def set_info_for_web_newform(level=None, weight=None, character=None, label=None, **kwds): r""" Set the info for on modular form. """ info = to_dict(kwds) info['level'] = level info['weight'] = weight info['character'] = character info['label'] = label if level is None or weight is None or character is None or label is None: s = "In set info for one form but do not have enough args!" s += "level={0},weight={1},character={2},label={3}".format(level, weight, character, label) emf_logger.critical(s) emf_logger.debug("In set_info_for_one_mf: info={0}".format(info)) prec = my_get(info, 'prec', default_prec, int) bprec = my_get(info, 'bprec', default_display_bprec, int) emf_logger.debug("PREC: {0}".format(prec)) emf_logger.debug("BITPREC: {0}".format(bprec)) try: WNF = WebNewForm_cached(level=level, weight=weight, character=character, label=label) if not WNF.has_updated(): raise IndexError("Unfortunately, we do not have this newform in the database.") info['character_order'] = WNF.character.order info['code'] = WNF.code emf_logger.debug("defined webnewform for rendering!") except IndexError as e: info['error'] = e.message url0 = url_for("mf.modular_form_main_page") url1 = url_for("emf.render_elliptic_modular_forms") url2 = url_for("emf.render_elliptic_modular_forms", level=level) url3 = url_for("emf.render_elliptic_modular_forms", level=level, weight=weight) url4 = url_for("emf.render_elliptic_modular_forms", level=level, weight=weight, character=character) bread = [(MF_TOP, url0), (EMF_TOP, url1)] bread.append(("Level %s" % level, url2)) bread.append(("Weight %s" % weight, url3)) bread.append(("Character \( %s \)" % (WNF.character.latex_name), url4)) bread.append(("Newform %d.%d.%d.%s" % (level, weight, int(character), label),'')) info['bread'] = bread properties2 = list() friends = list() space_url = url_for('emf.render_elliptic_modular_forms',level=level, weight=weight, character=character) friends.append(('\( S_{%s}(%s, %s)\)'%(WNF.weight, WNF.level, WNF.character.latex_name), space_url)) if hasattr(WNF.base_ring, "lmfdb_url") and WNF.base_ring.lmfdb_url: friends.append(('Number field ' + WNF.base_ring.lmfdb_pretty, WNF.base_ring.lmfdb_url)) if hasattr(WNF.coefficient_field, "lmfdb_url") and WNF.coefficient_field.lmfdb_label: friends.append(('Number field ' + WNF.coefficient_field.lmfdb_pretty, WNF.coefficient_field.lmfdb_url)) friends = uniq(friends) friends.append(("Dirichlet character \(" + WNF.character.latex_name + "\)", WNF.character.url())) if WNF.dimension==0 and not info.has_key('error'): info['error'] = "This space is empty!" info['title'] = 'Newform ' + WNF.hecke_orbit_label info['learnmore'] = [('History of modular forms', url_for('.holomorphic_mf_history'))] if 'error' in info: return info ## Until we have figured out how to do the embeddings correctly we don't display the Satake ## parameters for non-trivial characters.... ## Example to illustrate the different cases ## base = CyclotomicField(n) -- of degree phi(n) ## coefficient_field = NumberField( p(x)) for some p in base['x'] of degree m ## we would then have cdeg = m*phi(n) and bdeg = phi(n) ## and rdeg = m ## Unfortunately, for e.g. base = coefficient_field = CyclotomicField(6) ## we get coefficient_field.relative_degree() == 2 although it should be 1 cdeg = WNF.coefficient_field.absolute_degree() bdeg = WNF.base_ring.absolute_degree() if cdeg == 1: rdeg = 1 else: ## just setting rdeg = WNF.coefficient_field.relative_degree() does not give correct result... ## rdeg = QQ(cdeg)/QQ(bdeg) cf_is_QQ = (cdeg == 1) br_is_QQ = (bdeg == 1) if cf_is_QQ: info['satake'] = WNF.satake if WNF.complexity_of_first_nonvanishing_coefficients() > default_max_height: info['qexp'] = "" info['qexp_display'] = '' info['hide_qexp'] = True n,c = WNF.first_nonvanishing_coefficient() info['trace_nv'] = latex(WNF.first_nonvanishing_coefficient_trace()) info['norm_nv'] = '\\approx ' + latex(WNF.first_nonvanishing_coefficient_norm().n()) info['index_nv'] = n else: if WNF.prec < prec: #get WNF record at larger prec WNF.prec = prec WNF.update_from_db() info['qexp'] = WNF.q_expansion_latex(prec=10, name='\\alpha ') info['qexp_display'] = url_for(".get_qexp_latex", level=level, weight=weight, character=character, label=label) info["hide_qexp"] = False info['max_cn_qexp'] = WNF.q_expansion.prec() ## All combinations should be tested... ## 13/4/4/a -> base ring = coefficient_field = QQ(zeta_6) ## 13/3/8/a -> base_ring = QQ(zeta_4), coefficient_field has poly x^2+(2\zeta_4+2x-3\zeta_$ over base_ring ## 13/4/3/a -> base_ring = coefficient_field = QQ(zeta_3) ## 13/4/1/a -> all rational ## 13/6/1/a/ -> base_ring = QQ, coefficient_field = Q(sqrt(17)) ## These are variables which needs to be set properly below info['polvars'] = {'base_ring':'x','coefficient_field':'\\alpha'} if not cf_is_QQ: if rdeg>1: # not WNF.coefficient_field == WNF.base_ring: ## Here WNF.base_ring should be some cyclotomic field and we have an extension over this. p1 = WNF.coefficient_field.relative_polynomial() c_pol_ltx = web_latex_poly(p1, '\\alpha') # make the variable \alpha c_pol_ltx_x = web_latex_poly(p1, 'x') zeta = p1.base_ring().gens()[0] # p2 = zeta.minpoly() #this is not used anymore # b_pol_ltx = web_latex_poly(p2, latex(zeta)) #this is not used anymore z1 = zeta.multiplicative_order() info['coeff_field'] = [ WNF.coefficient_field.absolute_polynomial_latex('x'),c_pol_ltx_x, z1] if hasattr(WNF.coefficient_field, "lmfdb_url") and WNF.coefficient_field.lmfdb_url: info['coeff_field_pretty'] = [ WNF.coefficient_field.lmfdb_url, WNF.coefficient_field.lmfdb_pretty, WNF.coefficient_field.lmfdb_label] if z1==4: info['polynomial_st'] = '<div class="where">where</div> {0}\(\mathstrut=0\) and \(\zeta_4=i\).</div><br/>'.format(c_pol_ltx) info['polvars']['base_ring']='i' elif z1<=2: info['polynomial_st'] = '<div class="where">where</div> {0}\(\mathstrut=0\).</div><br/>'.format(c_pol_ltx) else: info['polynomial_st'] = '<div class="where">where</div> %s\(\mathstrut=0\) and \(\zeta_{%s}=e^{\\frac{2\\pi i}{%s}}\) '%(c_pol_ltx, z1,z1) info['polvars']['base_ring']='\zeta_{{ {0} }}'.format(z1) if z1==3: info['polynomial_st'] += 'is a primitive cube root of unity.' else: info['polynomial_st'] += 'is a primitive {0}-th root of unity.'.format(z1) elif not br_is_QQ: ## Now we have base and coefficient field being equal, meaning that since the coefficient field is not QQ it is some cyclotomic field ## generated by some \zeta_n p1 = WNF.coefficient_field.absolute_polynomial() z1 = WNF.coefficient_field.gens()[0].multiplicative_order() c_pol_ltx = web_latex_poly(p1, '\\zeta_{{{0}}}'.format(z1)) c_pol_ltx_x = web_latex_poly(p1, 'x') info['coeff_field'] = [ WNF.coefficient_field.absolute_polynomial_latex('x'), c_pol_ltx_x] if hasattr(WNF.coefficient_field, "lmfdb_url") and WNF.coefficient_field.lmfdb_url: info['coeff_field_pretty'] = [ WNF.coefficient_field.lmfdb_url, WNF.coefficient_field.lmfdb_pretty, WNF.coefficient_field.lmfdb_label] if z1==4: info['polynomial_st'] = '<div class="where">where \(\zeta_4=e^{{\\frac{{\\pi i}}{{ 2 }} }}=i \).</div>'.format(c_pol_ltx) info['polvars']['coefficient_field']='i' elif z1<=2: info['polynomial_st'] = '' else: info['polynomial_st'] = '<div class="where">where \(\zeta_{{{0}}}=e^{{\\frac{{2\\pi i}}{{ {0} }} }}\) '.format(z1) info['polvars']['coefficient_field']='\zeta_{{{0}}}'.format(z1) if z1==3: info['polynomial_st'] += 'is a primitive cube root of unity.</div>' else: info['polynomial_st'] += 'is a primitive {0}-th root of unity.</div>'.format(z1) else: info['polynomial_st'] = '' if info["hide_qexp"]: info['polynomial_st'] = '' info['degree'] = int(cdeg) if cdeg==1: info['is_rational'] = 1 info['coeff_field_pretty'] = [ WNF.coefficient_field.lmfdb_url, WNF.coefficient_field.lmfdb_pretty ] else: info['is_rational'] = 0 emf_logger.debug("PREC2: {0}".format(prec)) info['embeddings'] = WNF._embeddings['values'] #q_expansion_embeddings(prec, bprec,format='latex') info['embeddings_len'] = len(info['embeddings']) properties2 = [('Level', str(level)), ('Weight', str(weight)), ('Character', '$' + WNF.character.latex_name + '$'), ('Label', WNF.hecke_orbit_label), ('Dimension of Galois orbit', str(WNF.dimension))] if (ZZ(level)).is_squarefree(): info['twist_info'] = WNF.twist_info if isinstance(info['twist_info'], list) and len(info['twist_info'])>0: info['is_minimal'] = info['twist_info'][0] if(info['twist_info'][0]): s = 'Is minimal<br>' else: s = 'Is a twist of lower level<br>' properties2 += [('Twist info', s)] else: info['twist_info'] = 'Twist info currently not available.' properties2 += [('Twist info', 'not available')] args = list() for x in range(5, 200, 10): args.append({'digits': x}) alev = None CM = WNF._cm_values if CM is not None: if CM.has_key('tau') and len(CM['tau']) != 0: info['CM_values'] = CM info['is_cm'] = WNF.is_cm if WNF.is_cm == 1: info['cm_field'] = "2.0.{0}.1".format(-WNF.cm_disc) info['cm_disc'] = WNF.cm_disc info['cm_field_knowl'] = nf_display_knowl(info['cm_field'], getDBConnection(), field_pretty(info['cm_field'])) info['cm_field_url'] = url_for("number_fields.by_label", label=info["cm_field"]) if WNF.is_cm is None or WNF.is_cm==-1: s = '- Unknown (insufficient data)<br>' elif WNF.is_cm == 1: s = 'Yes<br>' else: s = 'No<br>' properties2.append(('CM', s)) alev = WNF.atkin_lehner_eigenvalues() info['atkinlehner'] = None if isinstance(alev,dict) and len(alev.keys())>0 and level != 1: s1 = " Atkin-Lehner eigenvalues " s2 = "" for Q in alev.keys(): s2 += "\( \omega_{ %s } \) : %s <br>" % (Q, alev[Q]) properties2.append((s1, s2)) emf_logger.debug("properties={0}".format(properties2)) # alev = WNF.atkin_lehner_eigenvalues_for_all_cusps() # if isinstance(alev,dict) and len(alev.keys())>0: # emf_logger.debug("alev={0}".format(alev)) # info['atkinlehner'] = list() # for Q in alev.keys(): # s = "\(" + latex(c) + "\)" # Q = alev[c][0] # ev = alev[c][1] # info['atkinlehner'].append([Q, c, ev]) if(level == 1): poly = WNF.explicit_formulas.get('as_polynomial_in_E4_and_E6','') if poly != '': d,monom,coeffs = poly emf_logger.critical("poly={0}".format(poly)) info['explicit_formulas'] = '\(' for i in range(len(coeffs)): c = QQ(coeffs[i]) s = "" if d>1 and i >0 and c>0: s="+" if c<0: s="-" if c.denominator()>1: cc = "\\frac{{ {0} }}{{ {1} }}".format(abs(c.numerator()),c.denominator()) else: cc = str(abs(c)) s += "{0} \cdot ".format(cc) a = monom[i][0]; b = monom[i][1] if a == 0 and b != 0: s+="E_6^{{ {0} }}".format(b) elif b ==0 and a != 0: s+="E_4^{{ {0} }}".format(a) else: s+="E_4^{{ {0} }}E_6^{{ {1} }}".format(a,b) info['explicit_formulas'] += s info['explicit_formulas'] += " \)" # cur_url = '?&level=' + str(level) + '&weight=' + str(weight) + '&character=' + str(character) + '&label=' + str(label) # never used if len(WNF.parent.hecke_orbits) > 1: for label_other in WNF.parent.hecke_orbits.keys(): if(label_other != label): s = 'Modular form ' if character: s += newform_label(level,weight,character,label_other) else: s += newform_label(level,weight,1,label_other) url = url_for('emf.render_elliptic_modular_forms', level=level, weight=weight, character=character, label=label_other) friends.append((s, url)) s = 'L-Function ' if character: s += newform_label(level,weight,character,label) else: s += newform_label(level,weight,1,label) # url = # "/L/ModularForm/GL2/Q/holomorphic?level=%s&weight=%s&character=%s&label=%s&number=%s" # %(level,weight,character,label,0) url = '/L' + url_for( 'emf.render_elliptic_modular_forms', level=level, weight=weight, character=character, label=label) if WNF.coefficient_field_degree > 1: for h in range(WNF.coefficient_field_degree): s0 = s + ".{0}".format(h) url0 = url + "{0}/".format(h) friends.append((s0, url0)) else: friends.append((s, url)) # if there is an elliptic curve over Q associated to self we also list that if WNF.weight == 2 and WNF.coefficient_field_degree == 1: llabel = str(level) + '.' + label s = 'Elliptic curve isogeny class ' + llabel url = '/EllipticCurve/Q/' + llabel friends.append((s, url)) info['properties2'] = properties2 info['friends'] = friends info['max_cn'] = WNF.max_available_prec() return info
def render_bmf_space_webpage(field_label, level_label): info = {} t = "Bianchi modular forms of level %s over %s" % (level_label, field_label) credit = bianchi_credit bread = [('Modular Forms', url_for('mf.modular_form_main_page')), ('Bianchi Modular Forms', url_for(".index")), (field_pretty(field_label), url_for(".render_bmf_field_dim_table_gl2", field_label=field_label)), (level_label, '')] friends = [] properties2 = [] if not field_label_regex.match(field_label): info['err'] = "%s is not a valid label for an imaginary quadratic field" % field_label else: pretty_field_label = field_pretty(field_label) if not db_dims().find({'field_label': field_label}): info['err'] = "no dimension information exists in the database for field %s" % pretty_field_label else: t = "Bianchi Modular Forms of level %s over %s" % (level_label, pretty_field_label) data = db_dims().find({'field_label': field_label, 'level_label': level_label}) nres = data.count() if nres==0: info['err'] = "no dimension information exists in the database for level %s and field %s" % (level_label, pretty_field_label) else: data = data.next() info['label'] = data['label'] info['nf'] = nf = WebNumberField(field_label) info['field_label'] = field_label info['pretty_field_label'] = pretty_field_label info['level_label'] = level_label info['level_norm'] = data['level_norm'] info['field_poly'] = teXify_pol(str(nf.poly())) info['field_knowl'] = nf_display_knowl(field_label, getDBConnection(), pretty_field_label) w = 'i' if nf.disc()==-4 else 'a' L = nf.K().change_names(w) alpha = L.gen() info['field_gen'] = latex(alpha) I = ideal_from_label(L,level_label) info['level_gen'] = latex(I.gens_reduced()[0]) info['level_fact'] = web_latex_ideal_fact(I.factor(), enclose=False) dim_data = data['gl2_dims'] weights = dim_data.keys() weights.sort(key=lambda w: int(w)) for w in weights: dim_data[w]['dim']=dim_data[w]['cuspidal_dim'] info['dim_data'] = dim_data info['weights'] = weights info['nweights'] = len(weights) newdim = data['gl2_dims']['2']['new_dim'] newforms = db_forms().find({'field_label':field_label, 'level_label':level_label}).sort('label_suffix', ASCENDING) info['nfdata'] = [{ 'label': f['short_label'], 'url': url_for(".render_bmf_webpage",field_label=f['field_label'], level_label=f['level_label'], label_suffix=f['label_suffix']), 'wt': f['weight'], 'dim': f['dimension'], 'sfe': "+1" if f['sfe']==1 else "-1", 'bc': bc_info(f['bc']), 'cm': cm_info(f['CM']), } for f in newforms] info['nnewforms'] = len(info['nfdata']) properties2 = [('Base field', pretty_field_label), ('Level',info['level_label']), ('Norm',str(info['level_norm'])), ('New dimension',str(newdim))] friends = [('Newform {}'.format(f['label']), f['url']) for f in info['nfdata'] ] return render_template("bmf-space.html", info=info, credit=credit, title=t, bread=bread, properties2=properties2, friends=friends)
def bmf_field_dim_table(**args): argsdict = to_dict(args) argsdict.update(to_dict(request.args)) gl_or_sl = argsdict['gl_or_sl'] field_label = argsdict['field_label'] field_label = nf_string_to_label(field_label) start = 0 if 'start' in argsdict: start = int(argsdict['start']) info = {} info['gl_or_sl'] = gl_or_sl # level_flag controls whether to list all levels ('all'), only # those with positive cuspidal dimension ('cusp'), or only those # with positive new dimension ('new'). Default is 'cusp'. level_flag = argsdict.get('level_flag', 'cusp') info['level_flag'] = level_flag count = 50 if 'count' in argsdict: count = int(argsdict['count']) pretty_field_label = field_pretty(field_label) bread = [('Bianchi Modular Forms', url_for(".index")), (pretty_field_label, ' ')] properties = [] if gl_or_sl == 'gl2_dims': info['group'] = 'GL(2)' info['bgroup'] = '\GL(2,\mathcal{O}_K)' else: info['group'] = 'SL(2)' info['bgroup'] = '\SL(2,\mathcal{O}_K)' t = ' '.join([ 'Dimensions of spaces of {} Bianchi modular forms over'.format( info['group']), pretty_field_label ]) query = {} query['field_label'] = field_label query[gl_or_sl] = {'$exists': True} if level_flag != 'all': # find which weights are present (TODO: get this from a stats collection) wts = list( sum((Set(d.keys()) for d in db_dims().distinct(gl_or_sl)), Set())) if level_flag == 'cusp': # restrict the query to only return levels where at least one # cuspidal dimension is positive: query.update({ '$or': [{ gl_or_sl + '.{}.cuspidal_dim'.format(w): { '$gt': 0 } } for w in wts] }) if level_flag == 'new': # restrict the query to only return levels where at least one # new dimension is positive: query.update({ '$or': [{ gl_or_sl + '.{}.new_dim'.format(w): { '$gt': 0 } } for w in wts] }) data = db_dims().find(query) data = data.sort([('level_norm', ASCENDING)]) info['number'] = nres = data.count() if nres > count or start != 0: info['report'] = 'Displaying items %s-%s of %s levels,' % ( start + 1, min(nres, start + count), nres) else: info['report'] = 'Displaying all %s levels,' % nres data = list(data.skip(start).limit(count)) info['field'] = field_label info['field_pretty'] = pretty_field_label nf = WebNumberField(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())) weights = set() for dat in data: weights = weights.union(set(dat[gl_or_sl].keys())) weights = list([int(w) for w in weights]) weights.sort() info['weights'] = weights info['nweights'] = len(weights) info['count'] = count info['start'] = start info['more'] = int(start + count < nres) dims = {} for dat in data: dims[dat['level_label']] = d = {} for w in weights: sw = str(w) if sw in dat[gl_or_sl]: d[w] = { 'd': dat[gl_or_sl][sw]['cuspidal_dim'], 'n': dat[gl_or_sl][sw]['new_dim'] } else: d[w] = {'d': '?', 'n': '?'} info['nlevels'] = len(data) dimtable = [{ 'level_label': dat['level_label'], 'level_norm': dat['level_norm'], 'level_space': url_for(".render_bmf_space_webpage", field_label=field_label, level_label=dat['level_label']) if gl_or_sl == 'gl2_dims' else "", 'dims': dims[dat['level_label']] } for dat in data] print("Length of dimtable = {}".format(len(dimtable))) info['dimtable'] = dimtable return render_template("bmf-field_dim_table.html", info=info, title=t, properties=properties, bread=bread)
def bianchi_modular_form_search(**args): """Function to handle requests from the top page, either jump to one newform or do a search. """ info = to_dict(args) # what has been entered in the search boxes if 'label' in info: # The Label button has been pressed. label = info['label'] dat = label.split("-") if len(dat)==2: # assume field & level, display space return render_bmf_space_webpage(dat[0], dat[1]) else: # assume single newform label; will display an error if invalid return bianchi_modular_form_by_label(label) query = {} for field in ['field_label', 'weight', 'level_norm', 'dimension']: if info.get(field): if field == 'weight': query['weight'] = info[field] elif field == 'field_label': parse_nf_string(info,query,field,'base number field',field) elif field == 'label': query[field] = info[field] elif field == 'dimension': query['dimension'] = int(info[field]) elif field == 'level_norm': query[field] = parse_range(info[field]) else: query[field] = info[field] if not 'sfe' in info: info['sfe'] = "any" elif info['sfe'] != "any": query['sfe'] = int(info['sfe']) if 'include_cm' in info: if info['include_cm'] == 'exclude': query['CM'] = 0 elif info['include_cm'] == 'only': query['CM'] = {'$nin' : [0,'?']} if 'include_base_change' in info and info['include_base_change'] == 'off': query['bc'] = 0 else: info['include_base_change'] = "on" start = 0 if 'start' in request.args: start = int(request.args['start']) count = 50 if 'count' in request.args: count = int(request.args['count']) info['query'] = dict(query) res = db_forms().find(query).sort([('level_norm', ASCENDING), ('label', ASCENDING)]).skip(start).limit(count) nres = res.count() if nres > 0: info['field_pretty_name'] = field_pretty(res[0]['field_label']) else: info['field_pretty_name'] = '' info['number'] = nres if nres == 1: info['report'] = 'unique match' elif nres == 2: info['report'] = 'displaying both matches' else: if nres > count or start != 0: info['report'] = 'displaying items %s-%s of %s matches' % (start + 1, min(nres, start + count), nres) else: info['report'] = 'displaying all %s matches' % nres res_clean = [] for v in res: v_clean = {} v_clean['field_label'] = v['field_label'] v_clean['short_label'] = v['short_label'] v_clean['level_label'] = v['level_label'] v_clean['level_norm'] = v['level_norm'] v_clean['level_number'] = v['level_label'].split(".")[1] v_clean['label_suffix'] = v['label_suffix'] v_clean['label'] = v['label'] v_clean['level_ideal'] = teXify_pol(v['level_ideal']) v_clean['dimension'] = v['dimension'] v_clean['sfe'] = "+1" if v['sfe']==1 else "-1" v_clean['url'] = url_for('.render_bmf_webpage',field_label=v['field_label'], level_label=v['level_label'], label_suffix=v['label_suffix']) v_clean['bc'] = bc_info(v['bc']) v_clean['cm'] = cm_info(v['CM']) res_clean.append(v_clean) res_clean.sort(key=lambda x: [int(x['level_norm']), int(x['level_number']), x['label_suffix']]) info['forms'] = res_clean info['count'] = count info['start'] = start info['more'] = int(start + count < nres) t = 'Bianchi modular form search results' bread = [('Bianchi Modular Forms', url_for(".index")), ( 'Search Results', ' ')] properties = [] return render_template("bmf-search_results.html", info=info, title=t, properties=properties, bread=bread, learnmore=learnmore_list())
def make_class(self): curves_data = db_g2c().curves.find({ "class": self.label }).sort([("disc_key", pymongo.ASCENDING), ("label", pymongo.ASCENDING)]) self.curves = [{ "label": c['label'], "equation_formatted": list_to_min_eqn(c['min_eqn']), "url": url_for_label(c['label']) } for c in curves_data] self.ncurves = curves_data.count() self.bad_lfactors = [[c[0], list_to_factored_poly_otherorder(c[1])] for c in self.bad_lfactors] for endalgtype in [ 'end_alg', 'rat_end_alg', 'real_end_alg', 'geom_end_alg', 'rat_geom_end_alg', 'real_geom_end_alg' ]: if hasattr(self, endalgtype): setattr(self, endalgtype + '_name', end_alg_name(getattr(self, endalgtype))) else: setattr(self, endalgtype + '_name', '') self.st_group_name = st_group_name(self.st_group) if hasattr(self, 'geom_end_field') and self.geom_end_field <> '': self.geom_end_field_name = field_pretty(self.geom_end_field) else: self.geom_end_field_name = '' if self.is_gl2_type: self.is_gl2_type_name = 'yes' else: self.is_gl2_type_name = 'no' if hasattr(self, 'is_simple'): if self.is_simple: self.is_simple_name = 'yes' else: self.is_simple_name = 'no' else: self.is_simple_name = '?' if hasattr(self, 'is_geom_simple'): if self.is_geom_simple: self.is_geom_simple_name = 'yes' else: self.is_geom_simple_name = 'no' else: self.is_geom_simple_name = '?' x = self.label.split('.')[1] self.friends = [('L-function', url_for("l_functions.l_function_genus2_page", cond=self.cond, x=x)), ('Siegel modular form someday', '.')] self.ecproduct_wurl = [] if hasattr(self, 'ecproduct'): for i in range(2): curve_label = self.ecproduct[i] crv_url = url_for("ec.by_ec_label", label=curve_label) if i == 1 or len(set(self.ecproduct)) <> 1: self.friends.append( ('Elliptic curve ' + curve_label, crv_url)) self.ecproduct_wurl.append({ 'label': curve_label, 'url': crv_url }) self.ecquadratic_wurl = [] if hasattr(self, 'ecquadratic'): for i in range(len(self.ecquadratic)): curve_label = self.ecquadratic[i] crv_spl = curve_label.split('-') crv_url = url_for("ecnf.show_ecnf_isoclass", nf=crv_spl[0], conductor_label=crv_spl[1], class_label=crv_spl[2]) self.friends.append(('Elliptic curve ' + curve_label, crv_url)) self.ecquadratic_wurl.append({ 'label': curve_label, 'url': crv_url, 'nf': crv_spl[0] }) if hasattr(self, 'mfproduct'): for i in range(len(self.mfproduct)): mf_label = self.mfproduct[i] mf_spl = mf_label.split('.') mf_spl.append(mf_spl[2][-1]) mf_spl[2] = mf_spl[2][:-1] # Need a splitting function mf_url = url_for("emf.render_elliptic_modular_forms", level=mf_spl[0], weight=mf_spl[1], character=mf_spl[2], label=mf_spl[3]) self.friends.append(('Modular form ' + mf_label, mf_url)) if hasattr(self, 'mfhilbert'): for i in range(len(self.mfhilbert)): mf_label = self.mfhilbert[i] mf_spl = mf_label.split('-') mf_url = url_for("hmf.render_hmf_webpage", field_label=mf_spl[0], label=mf_label) self.friends.append( ('Hilbert modular form ' + mf_label, mf_url)) self.properties = [('Label', self.label), ('Number of curves', str(self.ncurves)), ('Conductor', '%s' % self.cond), ('Sato-Tate group', '\(%s\)' % self.st_group_name), ('\(\mathrm{End}(J_{\overline{\Q}}) \otimes \R\)', '\(%s\)' % self.real_geom_end_alg_name), ('\(\mathrm{GL}_2\)-type', '%s' % self.is_gl2_type_name)] self.title = "Genus 2 Isogeny Class %s" % (self.label) self.downloads = [ ('Download Euler factors', ".") ] # url_for(".download_g2c_eulerfactors", label=self.label)), # ('Download stored data for all curves', url_for(".download_g2c_all", label=self.label))] self.bread = [('Genus 2 Curves', url_for(".index")), ('$\Q$', url_for(".index_Q")), ('%s' % self.cond, url_for(".by_conductor", conductor=self.cond)), ('%s' % self.label, ' ')]
def make_class(self): # Create a list of the curves in the class from the database self.db_curves = [ c for c in db_ecnf().find({ 'field_label': self.field_label, 'conductor_norm': self.conductor_norm, 'conductor_label': self.conductor_label, 'iso_nlabel': self.iso_nlabel }).sort('number') ] # Rank or bounds try: self.rk = web_latex(self.db_curves[0]['rank']) except KeyError: self.rk = "?" try: self.rk_bnds = "%s...%s" % tuple(self.db_curves[0]['rank_bounds']) except KeyError: self.rank_bounds = [0, Infinity] self.rk_bnds = "not recorded" # Extract the isogeny degree matrix from the database if not hasattr(self, 'isogeny_matrix'): # this would happen if the class is initiated with a curve # which is not #1 in its class: self.isogeny_matrix = self.db_curves[0].isogeny_matrix self.isogeny_matrix = Matrix(self.isogeny_matrix) self.one_deg = ZZ(self.class_deg).is_prime() # Create isogeny graph: self.graph = make_graph(self.isogeny_matrix) P = self.graph.plot(edge_labels=True) self.graph_img = encode_plot(P) self.graph_link = '<img src="%s" width="200" height="150"/>' % self.graph_img self.isogeny_matrix_str = latex(Matrix(self.isogeny_matrix)) self.field = FIELD(self.field_label) self.field_name = field_pretty(self.field_label) self.field_knowl = nf_display_knowl(self.field_label, lmfdb.base.getDBConnection(), self.field_name) def curve_url(c): return url_for(".show_ecnf", nf=c['field_label'], conductor_label=c['conductor_label'], class_label=c['iso_label'], number=c['number']) self.curves = [[ c['short_label'], curve_url(c), web_ainvs(self.field_label, c['ainvs']) ] for c in self.db_curves] self.urls = {} self.urls['class'] = url_for(".show_ecnf_isoclass", nf=self.field_label, conductor_label=self.conductor_label, class_label=self.iso_label) self.urls['conductor'] = url_for(".show_ecnf_conductor", nf=self.field_label, conductor_label=self.conductor_label) self.urls['field'] = url_for('.show_ecnf1', nf=self.field_label) sig = self.signature totally_real = sig[1] == 0 imag_quadratic = sig == [0, 1] if totally_real: self.hmf_label = "-".join( [self.field_label, self.conductor_label, self.iso_label]) self.urls['hmf'] = url_for('hmf.render_hmf_webpage', field_label=self.field_label, label=self.hmf_label) if sig[0] <= 2: self.urls['Lfunction'] = url_for( "l_functions.l_function_ecnf_page", field_label=self.field_label, conductor_label=self.conductor_label, isogeny_class_label=self.iso_label) elif self.abs_disc**2 * self.conductor_norm < 40000: # we shouldn't trust the Lfun computed on the fly for large conductor self.urls['Lfunction'] = url_for( "l_functions.l_function_hmf_page", field=self.field_label, label=self.hmf_label, character='0', number='0') if imag_quadratic: self.bmf_label = "-".join( [self.field_label, self.conductor_label, self.iso_label]) self.bmf_url = url_for('bmf.render_bmf_webpage', field_label=self.field_label, level_label=self.conductor_label, label_suffix=self.iso_label) self.urls['Lfunction'] = url_for( "l_functions.l_function_ecnf_page", field_label=self.field_label, conductor_label=self.conductor_label, isogeny_class_label=self.iso_label) self.friends = [] if totally_real: self.friends += [('Hilbert Modular Form ' + self.hmf_label, self.urls['hmf'])] if imag_quadratic: #self.friends += [('Bianchi Modular Form %s not available' % self.bmf_label, '')] self.friends += [('Bianchi Modular Form %s' % self.bmf_label, self.bmf_url)] if 'Lfunction' in self.urls: self.friends += [('L-function', self.urls['Lfunction'])] else: self.friends += [('L-function not available', "")] self.properties = [('Base field', self.field_name), ('Label', self.class_label), (None, self.graph_link), ('Conductor', '%s' % self.conductor_label)] if self.rk != '?': self.properties += [('Rank', '%s' % self.rk)] else: if self.rk_bnds == 'not recorded': self.properties += [('Rank', '%s' % self.rk_bnds)] else: self.properties += [('Rank bounds', '%s' % self.rk_bnds)] self.bread = [('Elliptic Curves ', url_for(".index")), (self.field_label, self.urls['field']), (self.conductor_label, self.urls['conductor']), ('isogeny class %s' % self.short_label, self.urls['class'])]