本文整理汇总了Python中sage.combinat.partition.Partition.contains方法的典型用法代码示例。如果您正苦于以下问题:Python Partition.contains方法的具体用法?Python Partition.contains怎么用?Python Partition.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.combinat.partition.Partition
的用法示例。
在下文中一共展示了Partition.contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: q_subgroups_of_abelian_group
# 需要导入模块: from sage.combinat.partition import Partition [as 别名]
# 或者: from sage.combinat.partition.Partition import contains [as 别名]
#.........这里部分代码省略.........
conjugate to `\lambda` and `\mu` respectively. Let
.. MATH::
\mathfrak{F}(\xi_1, \ldots, \xi_k) = \xi_1^{r_2} \xi_2^{r_3} \cdots
\xi_{k-1}^{r_k} \prod_{i_1=r_2}^{r_1-1} (\xi_1-q^{i_1})
\prod_{i_2=r_3}^{r_2-1} (\xi_2-q^{i_2}) \cdots
\prod_{i_k=0}^{r_k-1} (\xi_k-q^{-i_k}).
Then the number of subgroups of type `\mu` in a group of type `\lambda`
is given by
.. MATH::
\frac{\mathfrak{F}(q^{s_1}, q^{s_2}, \ldots, q^{s_k})}{\mathfrak{F}
(q^{r_1}, q^{r_2}, \ldots, q^{r_k})}.
EXAMPLES::
sage: from sage.combinat.q_analogues import q_subgroups_of_abelian_group
sage: q_subgroups_of_abelian_group([1,1], [1])
q + 1
sage: q_subgroups_of_abelian_group([3,3,2,1], [2,1])
q^6 + 2*q^5 + 3*q^4 + 2*q^3 + q^2
sage: R.<t> = QQ[]
sage: q_subgroups_of_abelian_group([5,3,1], [3,1], t)
t^4 + 2*t^3 + t^2
sage: q_subgroups_of_abelian_group([5,3,1], [3,1], 3)
144
sage: q_subgroups_of_abelian_group([1,1,1], [1]) == q_subgroups_of_abelian_group([1,1,1], [1,1])
True
sage: q_subgroups_of_abelian_group([5], [3])
1
sage: q_subgroups_of_abelian_group([1], [2])
0
sage: q_subgroups_of_abelian_group([2], [1,1])
0
TESTS:
Check the same examples with ``algorithm='delsarte'``::
sage: q_subgroups_of_abelian_group([1,1], [1], algorithm='delsarte')
q + 1
sage: q_subgroups_of_abelian_group([3,3,2,1], [2,1], algorithm='delsarte')
q^6 + 2*q^5 + 3*q^4 + 2*q^3 + q^2
sage: q_subgroups_of_abelian_group([5,3,1], [3,1], t, algorithm='delsarte')
t^4 + 2*t^3 + t^2
sage: q_subgroups_of_abelian_group([5,3,1], [3,1], 3, algorithm='delsarte')
144
sage: q_subgroups_of_abelian_group([1,1,1], [1], algorithm='delsarte') == q_subgroups_of_abelian_group([1,1,1], [1,1])
True
sage: q_subgroups_of_abelian_group([5], [3], algorithm='delsarte')
1
sage: q_subgroups_of_abelian_group([1], [2], algorithm='delsarte')
0
sage: q_subgroups_of_abelian_group([2], [1,1], algorithm='delsarte')
0
REFERENCES:
.. [Bu87] Butler, Lynne M. *A unimodality result in the enumeration
of subgroups of a finite abelian group.* Proceedings of the American
Mathematical Society 101, no. 4 (1987): 771-775.
:doi:`10.1090/S0002-9939-1987-0911049-8`
.. [Delsarte48] \S. Delsarte, *Fonctions de Möbius Sur Les Groupes Abeliens
Finis*, Annals of Mathematics, second series, Vol. 45, No. 3, (Jul 1948),
pp. 600-609. http://www.jstor.org/stable/1969047
AUTHORS:
- Amritanshu Prasad (2013-06-07): Implemented the Delsarte algorithm
- Tomer Bauer (2013-09-26): Implemented the Birkhoff algorithm
"""
if q is None:
q = ZZ['q'].gens()[0]
la_c = Partition(la).conjugate()
mu_c = Partition(mu).conjugate()
k = mu_c.length()
if not la_c.contains(mu_c):
return q.parent().zero()
if algorithm == 'delsarte':
def F(args):
prd = lambda j: prod(args[j]-q**i for i in range(mu_c[j+1],mu_c[j]))
F1 = prod(args[i]**mu_c[i+1] * prd(i) for i in range(k-1))
return F1 * prod(args[k-1]-q**i for i in range(mu_c[k-1]))
return F([q**ss for ss in la_c[:k]])/F([q**rr for rr in mu_c])
if algorithm == 'birkhoff':
fac1 = q**(sum(mu_c[i+1] * (la_c[i]-mu_c[i]) for i in range(k-1)))
fac2 = prod(q_binomial(la_c[i]-mu_c[i+1], mu_c[i]-mu_c[i+1], q=q) for i in range(k-1))
fac3 = q_binomial(la_c[k-1], mu_c[k-1], q=q)
return prod([fac1, fac2, fac3])
raise ValueError("invalid algorithm choice")