本文整理汇总了Python中sage.rings.polynomial.polynomial_ring_constructor.PolynomialRing.characteristic方法的典型用法代码示例。如果您正苦于以下问题:Python PolynomialRing.characteristic方法的具体用法?Python PolynomialRing.characteristic怎么用?Python PolynomialRing.characteristic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.rings.polynomial.polynomial_ring_constructor.PolynomialRing
的用法示例。
在下文中一共展示了PolynomialRing.characteristic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _torsion_poly
# 需要导入模块: from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing [as 别名]
# 或者: from sage.rings.polynomial.polynomial_ring_constructor.PolynomialRing import characteristic [as 别名]
def _torsion_poly(ell, P=None):
"""
Computes the ell-th gauss period. If `P` is given, it must be a
polynomial ring into which the result is coerced.
This is my favourite equality:
sage: all(_torsion_poly(n)(I) == I^n*lucas_number2(n,1,-1) for n in range(1,10))
True
"""
if P is None:
P, R, = PolynomialRing(ZZ, 'x'), ZZ,
elif P.characteristic() == 0:
R = ZZ
else:
R = Zp(P.characteristic(), prec=1, type='capped-rel')
t = [1, 0]
for k in range(1, ell/2 + 1):
m = R(ell - 2*k + 2) * R(ell - 2*k + 1) / (R(ell - k) * R(k))
t.append(-t[-2] * m)
t.append(0)
return P(list(reversed(t))).shift(ell % 2 - 1)