Sunday, November 17, 2024
Google search engine
HomeLanguagesPython | SymPy Permutation.from_inversion_vector() method

Python | SymPy Permutation.from_inversion_vector() method

Permutation.from_inversion_vector() : from_inversion_vector() is a sympy Python library function that returns the permutation from the inversion vector.
Inversion Vector – The number of elements > ith element to the left of ith element in a permutation gives the ith element of the inversion vector.

Syntax :
sympy.combinatorics.permutations.Permutation.from_inversion_vector()

Return :
permutation from the inversion vector

Code #1 : from_inversion_vector() Example




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


Output :

vector a – from_inversion_vector form : Permutation([1, 0], size=5)
vector b – from_inversion_vector form : Permutation([6, 5, 4, 3, 0, 1, 2])

Code #2 : from_inversion_vector() Example




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


Output :

vector a – from_inversion_vector form : Permutation([2, 4, 1, 0, 3])

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