本文整理汇总了Python中sage.all.NumberField.gens方法的典型用法代码示例。如果您正苦于以下问题:Python NumberField.gens方法的具体用法?Python NumberField.gens怎么用?Python NumberField.gens使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.all.NumberField
的用法示例。
在下文中一共展示了NumberField.gens方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _check
# 需要导入模块: from sage.all import NumberField [as 别名]
# 或者: from sage.all.NumberField import gens [as 别名]
def _check(k, j):
M = vvsmf(j, k, prec)
if M.dimension() > 0:
self.assertEqual(M.dimension(), len(M.basis()))
_chply = M.hecke_charpoly(2)
for cply, _ in _chply.factor():
K = NumberField(cply, names="a")
a = K.gens()[0]
f = M.eigenform_with_eigenvalue_t2(a)
self.assert_hecke_eigen_values(f)
示例2: test_ramanujan_conj
# 需要导入模块: from sage.all import NumberField [as 别名]
# 或者: from sage.all.NumberField import gens [as 别名]
def test_ramanujan_conj(self):
'''Test Ramanujan conjectures for eigenforms of determinant weights
less than or equal to 29.
'''
prec = 6
hpl = hilbert_series_maybe(10)
for k in range(22, 30):
if hpl[k] != 0:
N = sym10_space(k, prec, data_directory=data_dir)
self.assertEqual(N.dimension(), len(N.basis()))
_chply = N.hecke_charpoly(2)
for cply, _ in _chply.factor():
K = NumberField(cply, names="a")
a = K.gens()[0]
f = N.eigenform_with_eigenvalue_t2(a)
self.assert_ramanujan_conj_eigenform(f)
示例3: _a47
# 需要导入模块: from sage.all import NumberField [as 别名]
# 或者: from sage.all.NumberField import gens [as 别名]
def _a47():
x = var("x")
K = NumberField(
x ** 3 - x ** 2 - ZZ(524706) * x + ZZ(103406706), names="a47")
return K.gens()[0]
示例4: _alpha20_3
# 需要导入模块: from sage.all import NumberField [as 别名]
# 或者: from sage.all.NumberField import gens [as 别名]
def _alpha20_3():
x = var("x")
K = NumberField(x ** 2 - ZZ(1378464) * x + ZZ(328189501440), "alpha20_3")
return K.gens()[0]
示例5: upsert_embedding
# 需要导入模块: from sage.all import NumberField [as 别名]
# 或者: from sage.all.NumberField import gens [as 别名]
def upsert_embedding(id_number, skip = True):
rowcc = db.mf_hecke_cc.lucky({'id':id_number}, projection=['an_normalized', 'hecke_orbit_code','id','lfunction_label', 'embedding_root_imag','embedding_root_real'])
if rowcc is None:
return
if skip:
if rowcc.get("embedding_root_imag", None) is not None:
if rowcc.get("embedding_root_real", None) is not None:
return
row_embeddings = {}
hecke_orbit_code = rowcc['hecke_orbit_code']
newform = db.mf_newforms.lucky({'hecke_orbit_code':hecke_orbit_code},['label','weight','field_poly','dim'])
if newform is None:
# No newform in db
return
if newform['dim'] == 1:
row_embeddings['embedding_root_imag'] = 0
row_embeddings['embedding_root_real'] = 0
elif newform['weight'] == 1:
return
elif newform.get('field_poly', None) is None:
return
else:
# print rowcc['lfunction_label']
HF = NumberField(ZZx(newform['field_poly']), "v")
hecke_nf = db.mf_hecke_nf.lucky({'hecke_orbit_code':hecke_orbit_code}, ['hecke_ring_cyclotomic_generator','an','field_poly','hecke_ring_numerators','hecke_ring_denominators', 'hecke_ring_power_basis'])
assert hecke_nf is not None
assert newform['field_poly'] == hecke_nf['field_poly']
assert hecke_nf['hecke_ring_cyclotomic_generator'] == 0
if hecke_nf['hecke_ring_power_basis']:
v = HF.gens()[0]
betas = [ v**i for i in range(len(newform['field_poly'])) ]
else:
numerators = hecke_nf.get('hecke_ring_numerators')
denominators = hecke_nf.get('hecke_ring_denominators')
betas = [HF(elt)/denominators[i] for i, elt in enumerate(numerators)]
embeddings = HF.complex_embeddings(prec=2000)
an_nf = hecke_nf['an']
betas_embedded = [map(elt, betas) for elt in embeddings]
CCC = betas_embedded[0][0].parent()
normalization = -CCC(newform['weight'] - 1).real()/2
qexp = [convert_eigenvals_to_qexp(elt, an_nf, normalization) for elt in betas_embedded]
min_len = min(len(rowcc['an_normalized']), len(qexp[0]))
an_cc = vector(CCC, map(lambda x: CCC(x[0], x[1]), rowcc['an_normalized'][:min_len]))
#qexp_diff = [ (vector(CCC, elt[:min_len]) - an_cc).norm() for elt in qexp ]
# normalized, to avoid the unstability comming from large weight
qexp_diff = [ vector([(elt- an_cc[i])/elt.abs() for i, elt in enumerate(q) if elt != 0]).norm() for j,q in enumerate(qexp)]
qexp_diff_sorted = sorted(qexp_diff)
min_diff = qexp_diff_sorted[0]
#assuring that is something close to zero, and that no other value is close to it
assert min_diff < 1e-6 and min_diff/qexp_diff_sorted[1] < 1e-15, "id = %d label = %s\nmin_diff = %.2e \t min_diff/2nd = %.2e\nan_cc = %s\nqexp = %s" % (id_number, rowcc['lfunction_label'], min_diff, min_diff/qexp_diff_sorted[1], vector(ComplexField(20), an_cc[:5]), matrix(ComplexField(20), [elt[:5] for elt in qexp]))
for i, elt in enumerate(qexp_diff):
if elt == min_diff:
row_embeddings['embedding_root_real'] = float(embeddings[i](HF.gen()).real())
row_embeddings['embedding_root_imag'] = float(embeddings[i](HF.gen()).imag())
break
assert len(row_embeddings) == 2
db.mf_hecke_cc.upsert({'id': rowcc['id']}, row_embeddings)