本文整理汇总了Python中sage.combinat.permutation.Permutation.parent方法的典型用法代码示例。如果您正苦于以下问题:Python Permutation.parent方法的具体用法?Python Permutation.parent怎么用?Python Permutation.parent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.combinat.permutation.Permutation
的用法示例。
在下文中一共展示了Permutation.parent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: verify_representation
# 需要导入模块: from sage.combinat.permutation import Permutation [as 别名]
# 或者: from sage.combinat.permutation.Permutation import parent [as 别名]
def verify_representation(self):
r"""
Verify the representation: tests that the images of the simple
transpositions are involutions and tests that the braid relations
hold.
EXAMPLES::
sage: spc = SymmetricGroupRepresentation([1,1,1])
sage: spc.verify_representation()
True
sage: spc = SymmetricGroupRepresentation([4,2,1])
sage: spc.verify_representation()
True
"""
n = self._partition.size()
transpositions = []
for i in range(1,n):
si = Permutation(range(1,i) + [i+1,i] + range(i+2,n+1))
transpositions.append(si)
repn_matrices = map(self.representation_matrix, transpositions)
for (i,si) in enumerate(repn_matrices):
for (j,sj) in enumerate(repn_matrices):
if i == j:
if si*sj != si.parent().identity_matrix():
return False, "si si != 1 for i = %s" % (i,)
elif abs(i-j) > 1:
if si*sj != sj*si:
return False, "si sj != sj si for (i,j) =(%s,%s)" % (i,j)
else:
if si*sj*si != sj*si*sj:
return False, "si sj si != sj si sj for (i,j) = (%s,%s)" % (i,j)
return True
示例2: _element_constructor_
# 需要导入模块: from sage.combinat.permutation import Permutation [as 别名]
# 或者: from sage.combinat.permutation.Permutation import parent [as 别名]
def _element_constructor_(self, x):
r"""
Convert ``x`` into ``self``.
EXAMPLES::
sage: R = algebras.FQSym(QQ).G()
sage: x, y, z = R([1]), R([2,1]), R([3,2,1])
sage: R(x)
G[1]
sage: R(x+4*y)
G[1] + 4*G[2, 1]
sage: R(1)
G[]
sage: D = algebras.FQSym(ZZ).G()
sage: X, Y, Z = D([1]), D([2,1]), D([3,2,1])
sage: R(X-Y).parent()
Free Quasi-symmetric functions over Rational Field in the G basis
sage: R([1, 3, 2])
G[1, 3, 2]
sage: R(Permutation([1, 3, 2]))
G[1, 3, 2]
sage: R(SymmetricGroup(4)(Permutation([1,3,4,2])))
G[1, 3, 4, 2]
sage: RF = algebras.FQSym(QQ).F()
sage: R(RF([2, 3, 4, 1]))
G[4, 1, 2, 3]
sage: R(RF([3, 2, 4, 1]))
G[4, 2, 1, 3]
sage: DF = algebras.FQSym(ZZ).F()
sage: D(DF([2, 3, 4, 1]))
G[4, 1, 2, 3]
sage: R(DF([2, 3, 4, 1]))
G[4, 1, 2, 3]
sage: RF(R[2, 3, 4, 1])
F[4, 1, 2, 3]
"""
if isinstance(x, (list, tuple, PermutationGroupElement)):
x = Permutation(x)
try:
P = x.parent()
if isinstance(P, FreeQuasisymmetricFunctions.G):
if P is self:
return x
return self.element_class(self, x.monomial_coefficients())
except AttributeError:
pass
return CombinatorialFreeModule._element_constructor_(self, x)