SymPy | Permutation.support() in Python
Last Updated :
27 Aug, 2019
Permutation.support() : support() is a sympy Python library function that returns the elements in permutation, P, for which P[i] != i.
Syntax : sympy.combinatorics.permutations.Permutation.support()
Return : elements in permutation, P, for which P[i] != i.
Code #1 : support() Example
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.permutations import 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())
|
Output :
Permutation a – support form : [0, 1, 2, 3]
Permutation b – support form : [0, 1, 2, 3, 4, 5]
Code #2 : support() Example
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.permutations import Permutation
a = Permutation([[ 2 , 4 , 0 ],
[ 3 , 1 , 2 ],
[ 1 , 5 , 6 ]])
print ( "Permutation a - support form : " , a.support())
|
Output :
Permutation a – support form : [0, 1, 2, 3, 4, 5, 6]
Share your thoughts in the comments
Please Login to comment...