Skip to content

Permute ​

Move the item at position ii of list to position σ(i)\sigma(i), for a permutation perm given as Cycles or a one-line word. Given a PermutationGroup instead, returns list permuted by every element of the group.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguagePermute!
Permute(list, perm)list with position ii moved to σ(i)\sigma(i)
CombinatoricaIf[ListQ[perm] && PermutationQ[perm] && Length[list] == Length[perm], Permute[list, InversePermutation[perm]], Missing["NotCombinatorica"]]
Permute(list, group)one permuted copy of list per element of group
CombinatoricaIf[ListQ[group] && PermutationQ[group] && Length[list] == Length[group], Permute[list, InversePermutation[group]], Missing["NotCombinatorica"]]
Typed signatures
TypePackageApplies
(list<any>, expression<Cycles> | expression<PermutationGroup> | list<integer>) -> list<any> | list<list<any>>groupalgebraalways

Domain: Permutations

Details
  • Permute and PermutationCycles/InversePermutation all read σ\sigma the same way: a one-line word {v1, ..., vn} means σ(i)=vi\sigma(i) = v_i
  • A cycle or one-line word longer than list leaves the call unevaluated — there is nowhere for the extra positions to go
  • The PermutationGroup form orders its output the way GroupElements orders that group

Examples

Basic #
live ↗
InPermute([a,b,c,d],Cycles([[1,3,2]]))\mathrm{Permute}(\bigl\lbrack a, b, c, d\bigr\rbrack, \mathrm{Cycles}(\bigl\lbrack\bigl\lbrack1, 3, 2\bigr\rbrack\bigr\rbrack))Out[b,c,a,d]\bigl\lbrack b, c, a, d\bigr\rbrack
live ↗
InPermute([a,b,c,d,k],Cycles([[1,3,2]]))\mathrm{Permute}(\bigl\lbrack a, b, c, d, k\bigr\rbrack, \mathrm{Cycles}(\bigl\lbrack\bigl\lbrack1, 3, 2\bigr\rbrack\bigr\rbrack))Out[b,c,a,d,k]\bigl\lbrack b, c, a, d, k\bigr\rbrack
live ↗
InPermute([a,b,c,d,k],[3,1,2])\mathrm{Permute}(\bigl\lbrack a, b, c, d, k\bigr\rbrack, \bigl\lbrack3, 1, 2\bigr\rbrack)Out[b,c,a,d,k]\bigl\lbrack b, c, a, d, k\bigr\rbrack
live ↗
InPermute([10,20,30],[2,3,1])\mathrm{Permute}(\bigl\lbrack10, 20, 30\bigr\rbrack, \bigl\lbrack2, 3, 1\bigr\rbrack)Out[30,10,20]\bigl\lbrack30, 10, 20\bigr\rbrack
live ↗
InPermute([10,20,30,40,50],[3,1,2,5,4])\mathrm{Permute}(\bigl\lbrack10, 20, 30, 40, 50\bigr\rbrack, \bigl\lbrack3, 1, 2, 5, 4\bigr\rbrack)Out[20,30,10,50,40]\bigl\lbrack20, 30, 10, 50, 40\bigr\rbrack
Scope #
live ↗
InPermute([a,b,c,d],Cycles([[1,3],[2,4]]))\mathrm{Permute}(\bigl\lbrack a, b, c, d\bigr\rbrack, \mathrm{Cycles}(\bigl\lbrack\bigl\lbrack1, 3\bigr\rbrack, \bigl\lbrack2, 4\bigr\rbrack\bigr\rbrack))Out[c,d,a,b]\bigl\lbrack c, d, a, b\bigr\rbrack
live ↗
InPermute([a,b,c,d],[2,3,4,1])\mathrm{Permute}(\bigl\lbrack a, b, c, d\bigr\rbrack, \bigl\lbrack2, 3, 4, 1\bigr\rbrack)Out[d,a,b,c]\bigl\lbrack d, a, b, c\bigr\rbrack
Applications #

one permuted copy per element of the cyclic group of order 3

live ↗
InPermute([a,b,c],PermutationGroup([Cycles([[1,2,3]])]))\mathrm{Permute}(\bigl\lbrack a, b, c\bigr\rbrack, \mathrm{PermutationGroup}(\bigl\lbrack\mathrm{Cycles}(\bigl\lbrack\bigl\lbrack1, 2, 3\bigr\rbrack\bigr\rbrack)\bigr\rbrack))Out[[a,b,c],[c,a,b],[b,c,a]]\bigl\lbrack\bigl\lbrack a, b, c\bigr\rbrack, \bigl\lbrack c, a, b\bigr\rbrack, \bigl\lbrack b, c, a\bigr\rbrack\bigr\rbrack
About
Examples8
Checked againstWolfram Language 5 agree1 differCombinatorica 2 agree
CrosswalkWolfram LanguageCombinatorica

Implementation

mappedcombinatoricapackages/oracle/src/mappings.ts

Combinatorica's Permute applies the inverse of the permutation ours applies. Covered for a one-line permutation of the same length, not Cycles or a padded word.

See also: Cycles, PermutationCycles, PermutationGroup, GroupElements