Tuesday, November 26, 2024
Google search engine
HomeLanguagesSymPy | Permutation.support() in Python

SymPy | Permutation.support() in Python

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]

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments