[GAP Forum] Can GAP decode permutations?

Sven Reichard reichard at maths.uwa.edu.au
Fri Aug 18 09:20:48 BST 2006



Ariel Molina Rueda wrote:
> 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).
> 
There is. It may not be the most effective way, but the following works:

gap> sym := SymmetricGroup(Length(list1));
Sym( [ 1 .. 6 ] )
gap> RepresentativeAction(sym, list1, list2, Permuted);
(1,2)(3,4)


Hope this helps,
Sven.


> ... ... ...
> 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!
> 
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
> 
> 
> 
--
Sven Reichard
School of Mathematics and Statistics
University of Western Australia



More information about the Forum mailing list