本文整理汇总了Python中sage.rings.all.Integer.exact_log方法的典型用法代码示例。如果您正苦于以下问题:Python Integer.exact_log方法的具体用法?Python Integer.exact_log怎么用?Python Integer.exact_log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.rings.all.Integer
的用法示例。
在下文中一共展示了Integer.exact_log方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: xi_degrees
# 需要导入模块: from sage.rings.all import Integer [as 别名]
# 或者: from sage.rings.all.Integer import exact_log [as 别名]
def xi_degrees(n,p=2, reverse=True):
r"""
Decreasing list of degrees of the xi_i's, starting in degree n.
INPUT:
- `n` - integer
- `p` - prime number, optional (default 2)
- ``reverse`` - bool, optional (default True)
OUTPUT: ``list`` - list of integers
When `p=2`: decreasing list of the degrees of the `\xi_i`'s with
degree at most n.
At odd primes: decreasing list of these degrees, each divided by
`2(p-1)`.
If ``reverse`` is False, then return an increasing list rather
than a decreasing one.
EXAMPLES::
sage: sage.algebras.steenrod.steenrod_algebra_bases.xi_degrees(17)
[15, 7, 3, 1]
sage: sage.algebras.steenrod.steenrod_algebra_bases.xi_degrees(17, reverse=False)
[1, 3, 7, 15]
sage: sage.algebras.steenrod.steenrod_algebra_bases.xi_degrees(17,p=3)
[13, 4, 1]
sage: sage.algebras.steenrod.steenrod_algebra_bases.xi_degrees(400,p=17)
[307, 18, 1]
"""
from sage.rings.all import Integer
if n <= 0: return []
N = Integer(n*(p-1) + 1)
l = [int((p**d-1)/(p-1)) for d in range(1,N.exact_log(p)+1)]
if not reverse:
return l
l.reverse()
return l