Python中的SymPy Permutation.support()

Python中的SymPy Permutation.support()

Permutation.support() : support()是一个Sympy Python库函数,用于返回P[i]!=i的permutation, P中的元素。

语法 : sympy.combinatorics.permutations.Permutation.support()

返回:P[i] !=i的排列组合中的元素。

代码#1:support()示例

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

输出 :

Permutation a – support form : [0, 1, 2, 3]
Permutation b – support form : [0, 1, 2, 3, 4, 5]

代码#2:support()示例

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

输出 :

Permutation a – support form : [0, 1, 2, 3, 4, 5, 6]

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程