本文整理汇总了Python中lmfdb.WebNumberField.coeffs方法的典型用法代码示例。如果您正苦于以下问题:Python WebNumberField.coeffs方法的具体用法?Python WebNumberField.coeffs怎么用?Python WebNumberField.coeffs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lmfdb.WebNumberField
的用法示例。
在下文中一共展示了WebNumberField.coeffs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: download_hmf_magma
# 需要导入模块: from lmfdb import WebNumberField [as 别名]
# 或者: from lmfdb.WebNumberField import coeffs [as 别名]
def download_hmf_magma(**args):
C = getDBConnection()
data = None
label = str(args['label'])
f = C.hmfs.forms.find_one({'label': label})
if f is None:
return "No such form"
F = WebNumberField(f['field_label'])
F_hmf = C.hmfs.fields.find_one({'label': f['field_label']})
outstr = 'P<x> := PolynomialRing(Rationals());\n'
outstr += 'g := P!' + str(F.coeffs()) + ';\n'
outstr += 'F<w> := NumberField(g);\n'
outstr += 'ZF := Integers(F);\n\n'
# outstr += 'ideals_str := [' + ','.join([st for st in F_hmf["ideals"]]) + '];\n'
# outstr += 'ideals := [ideal<ZF | {F!x : x in I}> : I in ideals_str];\n\n'
outstr += 'NN := ideal<ZF | {' + f["level_ideal"][1:-1] + '}>;\n\n'
outstr += 'primesArray := [\n' + ','.join([st for st in F_hmf["primes"]]).replace('],[', '],\n[') + '];\n'
outstr += 'primes := [ideal<ZF | {F!x : x in I}> : I in primesArray];\n\n'
if f["hecke_polynomial"] != 'x':
outstr += 'heckePol := ' + f["hecke_polynomial"] + ';\n'
outstr += 'K<e> := NumberField(heckePol);\n'
else:
outstr += 'heckePol := x;\nK := Rationals(); e := 1;\n'
outstr += '\nheckeEigenvaluesArray := [' + ', '.join([st for st in f["hecke_eigenvalues"]]) + '];'
outstr += '\nheckeEigenvalues := AssociativeArray();\n'
outstr += 'for i := 1 to #heckeEigenvaluesArray do\n heckeEigenvalues[primes[i]] := heckeEigenvaluesArray[i];\nend for;\n\n'
outstr += 'ALEigenvalues := AssociativeArray();\n'
for s in f["AL_eigenvalues"]:
outstr += 'ALEigenvalues[ideal<ZF | {' + s[0][1:-1] + '}>] := ' + s[1] + ';\n'
outstr += '\n// EXAMPLE:\n// pp := Factorization(2*ZF)[1][1];\n// heckeEigenvalues[pp];\n\n'
outstr += '/* EXTRA CODE: recompute eigenform (warning, may take a few minutes or longer!):\n'
outstr += 'M := HilbertCuspForms(F, NN);\n'
outstr += 'S := NewSubspace(M);\n'
outstr += '// SetVerbose("ModFrmHil", 1);\n'
outstr += 'newspaces := NewformDecomposition(S);\n'
outstr += 'newforms := [Eigenform(U) : U in newspaces];\n'
outstr += 'ppind := 0;\n'
outstr += 'while #newforms gt 1 do\n'
outstr += ' pp := primes[ppind];\n'
outstr += ' newforms := [f : f in newforms | HeckeEigenvalue(f,pp) eq heckeEigenvalues[pp]];\n'
outstr += 'end while;\n'
outstr += 'f := newforms[1];\n'
outstr += '// [HeckeEigenvalue(f,pp) : pp in primes] eq heckeEigenvaluesArray;\n'
outstr += '*/\n'
return outstr
示例2: download_hmf_magma
# 需要导入模块: from lmfdb import WebNumberField [as 别名]
# 或者: from lmfdb.WebNumberField import coeffs [as 别名]
def download_hmf_magma(**args):
C = getDBConnection()
data = None
label = str(args["label"])
f = C.hmfs.forms.find_one({"label": label})
if f is None:
return "No such form"
F = WebNumberField(f["field_label"])
F_hmf = C.hmfs.fields.find_one({"label": f["field_label"]})
outstr = "P<x> := PolynomialRing(Rationals());\n"
outstr += "g := P!" + str(F.coeffs()) + ";\n"
outstr += "F<w> := NumberField(g);\n"
outstr += "ZF := Integers(F);\n\n"
# outstr += 'ideals_str := [' + ','.join([st for st in F_hmf["ideals"]]) + '];\n'
# outstr += 'ideals := [ideal<ZF | {F!x : x in I}> : I in ideals_str];\n\n'
outstr += "NN := ideal<ZF | {" + f["level_ideal"][1:-1] + "}>;\n\n"
outstr += "primesArray := [\n" + ",".join([st for st in F_hmf["primes"]]).replace("],[", "],\n[") + "];\n"
outstr += "primes := [ideal<ZF | {F!x : x in I}> : I in primesArray];\n\n"
if f["hecke_polynomial"] != "x":
outstr += "heckePol := " + f["hecke_polynomial"] + ";\n"
outstr += "K<e> := NumberField(heckePol);\n"
else:
outstr += "heckePol := x;\nK := Rationals(); e := 1;\n"
outstr += "\nheckeEigenvaluesArray := [" + ", ".join([st for st in f["hecke_eigenvalues"]]) + "];"
outstr += "\nheckeEigenvalues := AssociativeArray();\n"
outstr += "for i := 1 to #heckeEigenvaluesArray do\n heckeEigenvalues[primes[i]] := heckeEigenvaluesArray[i];\nend for;\n\n"
outstr += "ALEigenvalues := AssociativeArray();\n"
for s in f["AL_eigenvalues"]:
outstr += "ALEigenvalues[ideal<ZF | {" + s[0][1:-1] + "}>] := " + s[1] + ";\n"
outstr += "\n// EXAMPLE:\n// pp := Factorization(2*ZF)[1][1];\n// heckeEigenvalues[pp];\n\n"
outstr += "/* EXTRA CODE: recompute eigenform (warning, may take a few minutes or longer!):\n"
outstr += "M := HilbertCuspForms(F, NN);\n"
outstr += "S := NewSubspace(M);\n"
outstr += '// SetVerbose("ModFrmHil", 1);\n'
outstr += "newspaces := NewformDecomposition(S);\n"
outstr += "newforms := [Eigenform(U) : U in newspaces];\n"
outstr += "ppind := 0;\n"
outstr += "while #newforms gt 1 do\n"
outstr += " pp := primes[ppind];\n"
outstr += " newforms := [f : f in newforms | HeckeEigenvalue(f,pp) eq heckeEigenvalues[pp]];\n"
outstr += "end while;\n"
outstr += "f := newforms[1];\n"
outstr += "// [HeckeEigenvalue(f,pp) : pp in primes] eq heckeEigenvaluesArray;\n"
outstr += "*/\n"
return outstr
示例3: download_hmf_sage
# 需要导入模块: from lmfdb import WebNumberField [as 别名]
# 或者: from lmfdb.WebNumberField import coeffs [as 别名]
def download_hmf_sage(**args):
C = getDBConnection()
data = None
label = str(args['label'])
f = C.hmfs.forms.find_one({'label': label})
if f is None:
return "No such form"
F = WebNumberField(f['field_label'])
F_hmf = C.hmfs.fields.find_one({'label': f['field_label']})
outstr = 'P.<x> = PolynomialRing(QQ)\n'
outstr += 'g = P(' + str(F.coeffs()) + ')\n'
outstr += 'F.<w> = NumberField(g)\n'
outstr += 'ZF = F.ring_of_integers()\n\n'
outstr += 'NN = ZF.ideal(' + f["level_ideal"] + ')\n\n'
outstr += 'primes_array = [\n' + ','.join([st for st in F_hmf["primes"]]).replace('],[',
'],\\\n[') + ']\n'
outstr += 'primes = [ZF.ideal(I) for I in primes_array]\n\n'
if f["hecke_polynomial"] != 'x':
outstr += 'hecke_pol = ' + f["hecke_polynomial"] + '\n'
outstr += 'K.<e> = NumberField(heckePol)\n'
else:
outstr += 'heckePol = x\nK = QQ\ne = 1\n'
outstr += '\nhecke_eigenvalues_array = [' + ', '.join([st for st in f["hecke_eigenvalues"]]) + ']'
outstr += '\nhecke_eigenvalues = {}\n'
outstr += 'for i in range(len(hecke_eigenvalues_array)):\n hecke_eigenvalues[primes[i]] = hecke_eigenvalues_array[i]\n\n'
outstr += 'AL_eigenvalues = {}\n'
for s in f["AL_eigenvalues"]:
outstr += 'ALEigenvalues[ZF.ideal(s[0])] = s[1]\n'
outstr += '\n# EXAMPLE:\n# pp = ZF.ideal(2).factor()[0][0]\n# hecke_eigenvalues[pp]\n'
return outstr
示例4: download_hmf_sage
# 需要导入模块: from lmfdb import WebNumberField [as 别名]
# 或者: from lmfdb.WebNumberField import coeffs [as 别名]
def download_hmf_sage(**args):
C = getDBConnection()
data = None
label = str(args["label"])
f = C.hmfs.forms.find_one({"label": label})
if f is None:
return "No such form"
F = WebNumberField(f["field_label"])
F_hmf = C.hmfs.fields.find_one({"label": f["field_label"]})
outstr = "P.<x> = PolynomialRing(QQ)\n"
outstr += "g = P(" + str(F.coeffs()) + ")\n"
outstr += "F.<w> = NumberField(g)\n"
outstr += "ZF = F.ring_of_integers()\n\n"
outstr += "NN = ZF.ideal(" + f["level_ideal"] + ")\n\n"
outstr += "primes_array = [\n" + ",".join([st for st in F_hmf["primes"]]).replace("],[", "],\\\n[") + "]\n"
outstr += "primes = [ZF.ideal(I) for I in primes_array]\n\n"
if f["hecke_polynomial"] != "x":
outstr += "hecke_pol = " + f["hecke_polynomial"] + "\n"
outstr += "K.<e> = NumberField(heckePol)\n"
else:
outstr += "heckePol = x\nK = QQ\ne = 1\n"
outstr += "\nhecke_eigenvalues_array = [" + ", ".join([st for st in f["hecke_eigenvalues"]]) + "]"
outstr += "\nhecke_eigenvalues = {}\n"
outstr += "for i in range(len(hecke_eigenvalues_array)):\n hecke_eigenvalues[primes[i]] = hecke_eigenvalues_array[i]\n\n"
outstr += "AL_eigenvalues = {}\n"
for s in f["AL_eigenvalues"]:
outstr += "ALEigenvalues[ZF.ideal(s[0])] = s[1]\n"
outstr += "\n# EXAMPLE:\n# pp = ZF.ideal(2).factor()[0][0]\n# hecke_eigenvalues[pp]\n"
return outstr
示例5: render_field_webpage
# 需要导入模块: from lmfdb import WebNumberField [as 别名]
# 或者: from lmfdb.WebNumberField import coeffs [as 别名]
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' % label2
info['label'] = args['label_orig'] if 'label_orig' in args else args['label']
return search_input_error(info, bread)
info['wnf'] = nf
from lmfdb.WebNumberField import nf_display_knowl
data['degree'] = nf.degree()
data['class_number'] = nf.class_number()
t = nf.galois_t()
n = nf.degree()
data['is_galois'] = nf.is_galois()
data['is_abelian'] = nf.is_abelian()
if nf.is_abelian():
conductor = nf.conductor()
data['conductor'] = conductor
dirichlet_chars = nf.dirichlet_group()
if len(dirichlet_chars)>0:
data['dirichlet_group'] = ['<a href = "%s">$\chi_{%s}(%s,·)$</a>' % (url_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()
D = nf.disc()
ram_primes = D.prime_factors()
data['disc_factor'] = nf.disc_factored_latex()
if D.abs().is_prime() or D == 1:
data['discriminant'] = "\(%s\)" % str(D)
else:
data['discriminant'] = "\(%s=%s\)" % (str(D), data['disc_factor'])
npr = len(ram_primes)
ram_primes = str(ram_primes)[1:-1]
if ram_primes == '':
ram_primes = r'\textrm{None}'
data['frob_data'], data['seeram'] = frobs(nf.K())
data['phrase'] = group_phrase(n, t, C)
zk = 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)
info.update({
'label': pretty_label,
'label_raw': label,
'polynomial': web_latex_split_on_pm(nf.K().defining_polynomial()),
'ram_primes': ram_primes,
'integral_basis': zk,
'regulator': web_latex(nf.regulator()),
'unit_rank': nf.unit_rank(),
'root_of_unity': web_latex(nf.K().primitive_root_of_unity()),
'fund_units': nf.units(),
'grh_label': grh_label
})
bread.append(('%s' % info['label_raw'], ' '))
info['downloads_visible'] = True
info['downloads'] = [('worksheet', '/')]
info['friends'] = []
if nf.can_class_number():
# 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'])))
#.........这里部分代码省略.........
示例6: render_field_webpage
# 需要导入模块: from lmfdb import WebNumberField [as 别名]
# 或者: from lmfdb.WebNumberField import coeffs [as 别名]
def render_field_webpage(args):
data = None
C = base.getDBConnection()
info = {}
bread = [('Global Number Fields', url_for(".number_field_render_webpage"))]
if 'label' in args:
label = clean_input(args['label'])
nf = WebNumberField(label)
data = {}
if nf.is_null():
bread.append(('Search results', ' '))
label2 = re.sub(r'[<>]', '', args['label'])
if 'You need to enter a field' in label2:
info['err'] = label2
else:
info['err'] = 'No such field: %s in the database' % label2
info['label'] = args['label_orig'] if 'label_orig' in args else args['label']
return search_input_error(info, bread)
info['wnf'] = nf
data['degree'] = nf.degree()
data['class_number'] = nf.class_number()
t = nf.galois_t()
n = nf.degree()
data['is_galois'] = nf.is_galois()
data['is_abelian'] = nf.is_abelian()
if nf.is_abelian():
conductor = nf.conductor()
data['conductor'] = conductor
dirichlet_chars = nf.dirichlet_group()
data['dirichlet_group'] = ['<a href = "%s">$\chi_{%s}(%s,·)$</a>' % (url_for("render_Character", arg1=data['conductor'], arg2=j), data['conductor'], j) for j in dirichlet_chars]
data['dirichlet_group'] = r'$\lbrace$' + ', '.join(data['dirichlet_group']) + r'$\rbrace$'
if data['conductor'].is_prime() or data['conductor'] == 1:
data['conductor'] = "\(%s\)" % str(data['conductor'])
else:
data['conductor'] = "\(%s=%s\)" % (str(data['conductor']), latex(data['conductor'].factor()))
data['galois_group'] = group_display_knowl(n, t, C)
data['cclasses'] = cclasses_display_knowl(n, t, C)
data['character_table'] = character_table_display_knowl(n, t, C)
data['class_group'] = nf.class_group()
data['class_group_invs'] = nf.class_group_invariants()
data['signature'] = nf.signature()
data['coefficients'] = nf.coeffs()
D = nf.disc()
ram_primes = D.prime_factors()
data['disc_factor'] = nf.disc_factored_latex()
if D.abs().is_prime() or D == 1:
data['discriminant'] = "\(%s\)" % str(D)
else:
data['discriminant'] = "\(%s=%s\)" % (str(D), data['disc_factor'])
npr = len(ram_primes)
ram_primes = str(ram_primes)[1:-1]
if ram_primes == '':
ram_primes = r'\textrm{None}'
data['frob_data'], data['seeram'] = frobs(nf.K())
data['phrase'] = group_phrase(n, t, C)
zk = pari(nf.K()).nf_subst('a')
zk = list(zk.nf_get_zk())
Ra = PolynomialRing(QQ, 'a')
zk = [latex(Ra(x)) for x in zk]
zk = ['$%s$' % x for x in zk]
zk = ', '.join(zk)
grh_label = '<small>(<a title="assuming GRH" knowl="nf.assuming_grh">assuming GRH</a>)</small>' if nf.used_grh() else ''
# Short version for properties
grh_lab = nf.short_grh_string()
pretty_label = field_pretty(label)
if label != pretty_label:
pretty_label = "%s: %s" % (label, pretty_label)
info.update(data)
info.update({
'label': pretty_label,
'label_raw': label,
'polynomial': web_latex_split_on_pm(nf.K().defining_polynomial()),
'ram_primes': ram_primes,
'integral_basis': zk,
'regulator': web_latex(nf.regulator()),
'unit_rank': nf.unit_rank(),
'root_of_unity': web_latex(nf.K().primitive_root_of_unity()),
'fund_units': nf.units(),
'grh_label': grh_label
})
bread.append(('%s' % info['label_raw'], ' '))
info['downloads_visible'] = True
info['downloads'] = [('worksheet', '/')]
info['friends'] = []
if nf.can_class_number():
info['friends'].append(('L-function', "/L/NumberField/%s" % label))
info['friends'].append(('Galois group', "/GaloisGroup/%dT%d" % (n, t)))
if 'dirichlet_group' in info:
info['friends'].append(('Dirichlet group', url_for("dirichlet_group_table",
modulus=int(conductor),
char_number_list=','.join(
[str(a) for a in dirichlet_chars]),
poly=info['polynomial'])))
info['learnmore'] = [('Global number field labels', url_for(
".render_labels_page")), (Completename, url_for(".render_discriminants_page"))]
# With Galois group labels, probably not needed here
#.........这里部分代码省略.........
示例7: render_field_webpage
# 需要导入模块: from lmfdb import WebNumberField [as 别名]
# 或者: from lmfdb.WebNumberField import coeffs [as 别名]
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" % label2
info["label"] = args["label_orig"] if "label_orig" in args else args["label"]
return search_input_error(info, bread)
info["wnf"] = nf
from lmfdb.WebNumberField import nf_display_knowl
data["degree"] = nf.degree()
data["class_number"] = nf.class_number()
t = nf.galois_t()
n = nf.degree()
data["is_galois"] = nf.is_galois()
data["is_abelian"] = nf.is_abelian()
if nf.is_abelian():
conductor = nf.conductor()
data["conductor"] = conductor
dirichlet_chars = nf.dirichlet_group()
if len(dirichlet_chars) > 0:
data["dirichlet_group"] = [
'<a href = "%s">$\chi_{%s}(%s,·)$</a>'
% (
url_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.K())
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)
info.update(
{
"label": pretty_label,
"label_raw": label,
"polynomial": web_latex_split_on_pm(nf.K().defining_polynomial()),
"ram_primes": ram_primes,
"integral_basis": zk,
"regulator": web_latex(nf.regulator()),
"unit_rank": nf.unit_rank(),
"root_of_unity": web_latex(nf.K().primitive_root_of_unity()),
"fund_units": nf.units(),
"grh_label": grh_label,
}
)
bread.append(("%s" % info["label_raw"], " "))
info["downloads_visible"] = True
#.........这里部分代码省略.........