Permutation Lists
A possible way of working with permutations is by relating them to the reorderings of the elements of a list. This is the standard point of view in the combinatorial approach to permutations, which shifts the emphasis to the permuted expressions, rather than the permutations themselves. This has always been an implicit interpretation of permutation lists in the Wolfram Language, reorderings of Range[n] for some non-negative integer n. Several standard functions in the Wolfram Language allow basic manipulation of permutation lists, and now other functions have been added to work with permutation lists and convert them into their disjoint cyclic form.
PermutationListQ | validate a list of integers as reordering of {1,…,n} |
PermutationSupport | points moved by a permutation |
Copy to clipboard.
In[1]:=1

✖
https://wolfram.com/xid/0qkd9eayymu-8bxqkz
Direct link to example
Out[1]=1

Copy to clipboard.
In[2]:=2

✖
https://wolfram.com/xid/0qkd9eayymu-q6tti1
Direct link to example
Out[2]=2

Copy to clipboard.
In[3]:=3

✖
https://wolfram.com/xid/0qkd9eayymu-ftjvwm
Direct link to example
Out[3]=3

Copy to clipboard.
In[4]:=4

✖
https://wolfram.com/xid/0qkd9eayymu-3ae3uh
Direct link to example
Out[4]=4

Permutation lists can be converted into disjoint cyclic form and vice versa. This is similar to the functions ToCycles and FromCycles in the Combinatorica package in improved form.
PermutationCycles | convert permutation into disjoint cyclic form |
PermutationList | convert permutation into a permutation list |
Copy to clipboard.
In[5]:=5

✖
https://wolfram.com/xid/0qkd9eayymu-56g270
Direct link to example
Out[5]=5

Copy to clipboard.
In[6]:=6

✖
https://wolfram.com/xid/0qkd9eayymu-yiwaef
Direct link to example
Out[6]=6

Copy to clipboard.
In[7]:=7

✖
https://wolfram.com/xid/0qkd9eayymu-zfj09p
Direct link to example
Out[7]=7

Copy to clipboard.
In[8]:=8

✖
https://wolfram.com/xid/0qkd9eayymu-moq3w1
Direct link to example
Copy to clipboard.
In[9]:=9

✖
https://wolfram.com/xid/0qkd9eayymu-g6oexa
Direct link to example
Out[9]=9

Copy to clipboard.
In[10]:=10

✖
https://wolfram.com/xid/0qkd9eayymu-bk9e8n
Direct link to example
Out[10]=10

Copy to clipboard.
In[11]:=11

✖
https://wolfram.com/xid/0qkd9eayymu-l6f18k
Direct link to example
Out[11]=11

Copy to clipboard.
In[12]:=12

✖
https://wolfram.com/xid/0qkd9eayymu-uqflxa
Direct link to example
Out[12]=12

Copy to clipboard.
In[13]:=13

✖
https://wolfram.com/xid/0qkd9eayymu-k4sd35
Direct link to example
Out[13]=13

Permutation lists can be used to permute the parts of an expression with the functions Part and Permute. There are two differences: First, depending on the length of the permutation list, Part may change the number of arguments of the expression, but Permute never changes it. Second, Part and Permute interpret the permutation in different ways.
Part |
return a subexpression, possibly reordering its elements
|
Permute | permute elements of an expression as given by a permutation |
FindPermutation | compute the permutation that takes the first list to the second |
Copy to clipboard.
In[14]:=14

✖
https://wolfram.com/xid/0qkd9eayymu-gyaar1
Direct link to example
Permute reorders the elements, changing their positions: the first element goes to fourth place etc. The number of elements does not change:
Copy to clipboard.
In[16]:=16

✖
https://wolfram.com/xid/0qkd9eayymu-fme89h
Direct link to example
Out[16]=16

Part extracts a subexpression, possibly changing the length of the result. In order to obtain an equivalent result the permutation list needs to be inverted:
Copy to clipboard.
In[17]:=17

✖
https://wolfram.com/xid/0qkd9eayymu-qqyqxb
Direct link to example
Out[17]=17

Permute also accepts cyclic notation in its second argument:
Copy to clipboard.
In[18]:=18

✖
https://wolfram.com/xid/0qkd9eayymu-ti6p48
Direct link to example
Out[18]=18

Copy to clipboard.
In[19]:=19

✖
https://wolfram.com/xid/0qkd9eayymu-crla2
Direct link to example
Out[19]=19

Copy to clipboard.
In[20]:=20

✖
https://wolfram.com/xid/0qkd9eayymu-kof8ug
Direct link to example
Out[20]=20

Copy to clipboard.
In[21]:=21

✖
https://wolfram.com/xid/0qkd9eayymu-3or0wc
Direct link to example
Out[21]=21

Copy to clipboard.
In[22]:=22

✖
https://wolfram.com/xid/0qkd9eayymu-0nt597
Direct link to example
Out[22]=22

Copy to clipboard.
In[23]:=23

✖
https://wolfram.com/xid/0qkd9eayymu-b0myir
Direct link to example
Out[23]=23

Copy to clipboard.
In[24]:=24

✖
https://wolfram.com/xid/0qkd9eayymu-z2xx6o
Direct link to example
Out[24]=24

Copy to clipboard.
In[25]:=25

✖
https://wolfram.com/xid/0qkd9eayymu-j0ypto
Direct link to example
Out[25]=25

It is possible to perform permutation operations with permutation lists, using standard commands of the Wolfram Language.
Part | permutation list product |
Ordering | permutation list inverse |
Range | identity permutation list |
RandomSample | pseudorandom generation of permutation lists |
Copy to clipboard.
In[26]:=26

✖
https://wolfram.com/xid/0qkd9eayymu-hlu4wr
Direct link to example
Copy to clipboard.
In[28]:=28

✖
https://wolfram.com/xid/0qkd9eayymu-kn5gsc
Direct link to example
Out[28]=28

The same result can be obtained with Part reversing the order of arguments:
Copy to clipboard.
In[29]:=29

✖
https://wolfram.com/xid/0qkd9eayymu-gm08q5
Direct link to example
Out[29]=29

Copy to clipboard.
In[30]:=30

✖
https://wolfram.com/xid/0qkd9eayymu-2y0n1c
Direct link to example
Out[30]=30

Copy to clipboard.
In[31]:=31

✖
https://wolfram.com/xid/0qkd9eayymu-g9f6iz
Direct link to example
Out[31]=31

Copy to clipboard.
In[32]:=32

✖
https://wolfram.com/xid/0qkd9eayymu-0p1adp
Direct link to example
Out[32]=32

The identity permutation list of any length can be expressed with Range:
Copy to clipboard.
In[33]:=33

✖
https://wolfram.com/xid/0qkd9eayymu-ygiozh
Direct link to example
Out[33]=33

Copy to clipboard.
In[34]:=34

✖
https://wolfram.com/xid/0qkd9eayymu-cap984
Direct link to example
Out[34]=34

Another important use of permutation lists is the transposition of arrays with Transpose, which results in a generally different array of permuted dimensions.
Copy to clipboard.
In[35]:=35

✖
https://wolfram.com/xid/0qkd9eayymu-grb4yu
Direct link to example
Out[35]=35

Copy to clipboard.
In[36]:=36

✖
https://wolfram.com/xid/0qkd9eayymu-ht2x03
Direct link to example
Out[36]=36

Copy to clipboard.
In[37]:=37

✖
https://wolfram.com/xid/0qkd9eayymu-wrd8yl
Direct link to example
Out[37]=37

Copy to clipboard.
In[38]:=38

✖
https://wolfram.com/xid/0qkd9eayymu-5d2h1y
Direct link to example
Out[38]=38
