本文整理汇总了Python中sage.rings.all.ZZ.divisors方法的典型用法代码示例。如果您正苦于以下问题:Python ZZ.divisors方法的具体用法?Python ZZ.divisors怎么用?Python ZZ.divisors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.rings.all.ZZ
的用法示例。
在下文中一共展示了ZZ.divisors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: graded_dimension
# 需要导入模块: from sage.rings.all import ZZ [as 别名]
# 或者: from sage.rings.all.ZZ import divisors [as 别名]
def graded_dimension(self, k):
r"""
Return the dimension of the ``k``-th graded piece of ``self``.
The `k`-th graded part of a free Lie algebra on `n` generators
has dimension
.. MATH::
\frac{1}{k} \sum_{d \mid k} \mu(d) n^{k/d},
where `\mu` is the Mobius function.
REFERENCES:
[MKO1998]_
EXAMPLES::
sage: L = LieAlgebra(QQ, 'x', 3)
sage: H = L.Hall()
sage: [H.graded_dimension(i) for i in range(1, 11)]
[3, 3, 8, 18, 48, 116, 312, 810, 2184, 5880]
sage: H.graded_dimension(0)
0
"""
if k == 0:
return 0
from sage.arith.all import moebius
s = len(self.lie_algebra_generators())
k = ZZ(k) # Make sure we have something that is in ZZ
return sum(moebius(d) * s**(k // d) for d in k.divisors()) // k