FindPermutation

FindPermutation[expr]

gives a permutation that produces expr by permuting Sort[expr].

FindPermutation[expr1,expr2]

gives a permutation that converts expr1 to expr2 for two expressions that differ only in the order of their arguments.

Details

  • The permutation is returned with head Cycles, in disjoint cyclic form.
  • If the arguments of expr1 are different, the permutation returned is uniquely defined.
  • FindPermutation[expr2,expr1] gives the inverse permutation of FindPermutation[expr1,expr2].

Examples

open allclose all

Basic Examples  (1)

Permutation relating two expressions with the same elements:

In[1]:=
Click for copyable input
Out[1]=

Verify the result using Permute:

In[2]:=
Click for copyable input
Out[2]=

Scope  (1)

Properties & Relations  (1)

See Also

Cycles  Permute  Ordering

Tutorials

Introduced in 2010
(8.0)