[GAP Forum] Can GAP decode permutations?

Ariel Molina Rueda ariel at fismat.umich.mx
Thu Aug 17 21:22:01 BST 2006


say i have a list and a permuted list.

gap> list1:= [ 34, 31, 29, 25, 28, 26 ];;
gap> list2:= [ 31, 34, 25, 29, 28, 26 ];;

is there a command like, say, 

gap> WhatsThePermutation(list1, list1);
(1,2)(3,4)(5,6)

this tells me that in order to obtain list2 i shall permute list1 with
(1,2)(3,4)(5,6).

... ... ...
Why do i want this?

My problem is that i have lists like this:

k:=[[2,3,4], [3,5,6,8,9,12,14]]

representing rows in a matrix, and i want to have all the permutations
and apply them to a matrix, like

[2,3,4],[5,6,8,9,14,2] <--where i swap rows 14 and 12
[3,2,4],[5,6,8,9,14,2] <--where i swap rows 14 with 12 and 2 with 3.

Note: I cant swap 4 with 5.

But i want all the combinations, i found PermutationsList, that gives me
the permutations of a list, so i want to know which permutations where
made so i can apply them to the matrix.

thanks very much!



More information about the Forum mailing list