本文整理汇总了Python中sage.rings.all.ZZ.valuation方法的典型用法代码示例。如果您正苦于以下问题:Python ZZ.valuation方法的具体用法?Python ZZ.valuation怎么用?Python ZZ.valuation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.rings.all.ZZ
的用法示例。
在下文中一共展示了ZZ.valuation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: twoadic
# 需要导入模块: from sage.rings.all import ZZ [as 别名]
# 或者: from sage.rings.all.ZZ import valuation [as 别名]
def twoadic(line):
r""" Parses one line from a 2adic file. Returns the label and a dict
containing fields with keys '2adic_index', '2adic_log_level',
'2adic_gens' and '2adic_label'.
Input line fields:
conductor iso number ainvs index level gens label
Sample input lines:
110005 a 2 [1,-1,1,-185793,29503856] 12 4 [[3,0,0,1],[3,2,2,3],[3,0,0,3]] X24
27 a 1 [0,0,1,0,-7] inf inf [] CM
"""
data = split(line)
assert len(data) == 8
label = data[0] + data[1] + data[2]
model = data[7]
if model == "CM":
return label, {"2adic_index": int(0), "2adic_log_level": None, "2adic_gens": None, "2adic_label": None}
index = int(data[4])
level = ZZ(data[5])
log_level = int(level.valuation(2))
assert 2 ** log_level == level
if data[6] == "[]":
gens = []
else:
gens = data[6][1:-1].replace("],[", "];[").split(";")
gens = [[int(c) for c in g[1:-1].split(",")] for g in gens]
return label, {"2adic_index": index, "2adic_log_level": log_level, "2adic_gens": gens, "2adic_label": model}
示例2: period_from_coords
# 需要导入模块: from sage.rings.all import ZZ [as 别名]
# 或者: from sage.rings.all.ZZ import valuation [as 别名]
def period_from_coords(p, E, P, prec=20):
r"""
Given a point `P` in the formal group of the elliptic curve `E` with split multiplicative reduction,
this produces an element `u` in `\QQ_p^{\times}` mapped to the point `P` by the Tate parametrisation.
The algorithm return the unique such element in `1+p\ZZ_p`.
INPUT:
- ``P`` - a point on the elliptic curve.
- ``prec`` - the `p`-adic precision, default is 20.
"""
R = Qp(p, prec)
if P[0].valuation(p) >= 0:
raise ValueError, "The point must lie in the formal group."
Etate = E.tate_curve(p)
Eq = Etate.curve(prec=prec)
isom = Etate._isomorphism(prec=prec)
C = isom[0]
r = isom[1]
s = isom[2]
t = isom[3]
xx = r + C ** 2 * P[0]
yy = t + s * C ** 2 * P[0] + C ** 3 * P[1]
try:
EqCp = Eq.change_ring(yy.parent())
Pq = EqCp([xx, yy])
except:
raise RuntimeError, "Bug : Point %s does not lie on the curve " % [xx, yy]
tt = -xx / yy
eqhat = Eq.formal()
eqlog = eqhat.log(prec + 3)
z = eqlog(tt)
u = ZZ(1)
fac = ZZ(1)
for i in range(1, 2 * prec + 1):
fac = fac * i
u = u + z ** i / fac
q = Etate.parameter(prec=prec)
un = u * q ** (-(u.valuation() / q.valuation()).floor())
return un
示例3: coeff
# 需要导入模块: from sage.rings.all import ZZ [as 别名]
# 或者: from sage.rings.all.ZZ import valuation [as 别名]
def coeff(m):
m = ZZ(m)
if m < 0:
return ZZ(0)
elif m == 0:
return ZZ(1)
factor = -2*k / QQ(bernoulli(k)) / lamk
sum1 = sigma(m, k-1)
if M.divides(m):
sum2 = (lamk-1) * sigma(ZZ(m/M), k-1)
else:
sum2 = ZZ(0)
if (M == 1):
sum3 = ZZ(0)
else:
if (m == 1):
N = ZZ(1)
else:
N = ZZ(m / M**ZZ(m.valuation(M)))
sum3 = -sigma(ZZ(N), k-1) * ZZ(m/N)**(k-1) / (lamk + 1)
return factor * (sum1 + sum2 + sum3) * dval**m