Saturday, January 17, 2026
HomeLanguagesPython | Sympy Permutation().array_form method

Python | Sympy Permutation().array_form method

With the help of sympy.combinatorics.Permutation().array_form method, we can get the linear array from multidimensional array or matrix by using sympy.combinatorics.Permutation().array_form method.

Syntax : sympy.combinatorics.Permutation().array_form

Return : Return an array having single dimension.

Example #1 :
In this example we can see that by using sympy.combinatorics.Permutation().array_form method, we are able to get the linear array from matrix or multidimensional array.




# import sympy and Permutation
from sympy.combinatorics.permutations import Permutation
from sympy import * 
  
Permutation.print_cyclic = False
    
# Using sympy.combinatorics.partitions.Permutation().array_form method
gfg = Permutation([ [1, 2, 3], [21, 32, 44] ])
    
print(gfg.array_form)


Output :

[0, 2, 3, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 32, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 44, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 21]

Example #2 :




# import sympy and Permutation
from sympy.combinatorics.permutations import Permutation
from sympy import * 
  
Permutation.print_cyclic = False
    
# Using sympy.combinatorics.partitions.Permutation().array_form method
gfg = Permutation([ [1, 2], [3, 4], [5] ])
    
print(gfg.array_form)


Output :

[0, 2, 1, 4, 3, 5]

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

Most Popular

Dominic
32474 POSTS0 COMMENTS
Milvus
118 POSTS0 COMMENTS
Nango Kala
6846 POSTS0 COMMENTS
Nicole Veronica
11977 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12063 POSTS0 COMMENTS
Shaida Kate Naidoo
6985 POSTS0 COMMENTS
Ted Musemwa
7219 POSTS0 COMMENTS
Thapelo Manthata
6933 POSTS0 COMMENTS
Umr Jansen
6911 POSTS0 COMMENTS