Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

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




# 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())

Output :

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

Code #2 : support() Example




# 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())

Output :

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


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!