📜  SymPy | Python中的 Permutation.list()

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

SymPy | Python中的 Permutation.list()

Permutation.list() : list()是一个 sympy Python库函数,它以显式列表的形式返回排列,如果大小小于排列中的最大元素,可能会修剪未移动的元素。

代码 #1:list() 示例

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

输出 :

代码 #2:list() 示例——二维排列

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

输出 :