📜  SymPy | Python中的 Permutation.order()

📅  最后修改于: 2022-05-13 01:54:37.636000             🧑  作者: Mango

SymPy | Python中的 Permutation.order()

Permutation.order() : order()是一个 sympy Python库函数,用于计算排列的顺序。当排列被提升到它的阶次幂时,那么,在这种情况下,阶等于恒等排列。

代码 #1:order() 示例

# Python code explaining
# SymPy.Permutation.order()
  
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.permutations import Permutation
  
# Using from sympy.combinatorics.permutations.Permutation.order() method 
  
# creating Permutation
a = Permutation([[2, 0], [3, 1]])
  
b = Permutation([1, 3, 5, 4, 2, 0])
  
  
print ("Permutation a - order form : ", a.order())
print ("Permutation b - order form : ", b.order())

输出 :

代码 #2 : order() 示例– 2D 排列

# Python code explaining
# SymPy.Permutation.order()
  
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.permutations import Permutation
  
# Using from sympy.combinatorics.permutations.Permutation.order() method 
  
# creating Permutation
a = Permutation([[2, 4, 0], 
                 [3, 1, 2],
                 [1, 5, 6]])
  
  
print ("Permutation a - order form : ", a.order())

输出 :