Python中的SymPy Permutation.mul_inv()

Python中的SymPy Permutation.mul_inv()

Permutation.mul_inv() : mul_inv()是一个Sympy Python库函数,用于返回mul逆的other*~self,self和other有_array_form。

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

返回:mul inverse other*~self,self和other有_array_form。

代码 #1 : mul_inv() 示例

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

输出 :

Permutation a – mul_inv form : (3)
Permutation b – mul_inv form : (5)

代码#2:mul_inv()实例–二维排布

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

输出 :

Permutation a – mul_inv form : (6)

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程

SymPy 教程