Permutations

*To*: mathgroup at smc.vnet.net*Subject*: [mg65508] Permutations*From*: "King, Peter R" <peter.king at imperial.ac.uk>*Date*: Thu, 6 Apr 2006 06:51:48 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

I wish to be able to construct permutations by listing those positions that are unaltered, all other pairs swapping. So if I start from {a,b,c,d,e,f} and apply the rule {1,4} I get {a,c,b,d,f,e}. Note that this is the only kind of permutation that I need. ie there is always at least one pair of positions that aren't changed and in all other positions neighbouring pairs are swapped (the only other kind of permutation is where all pairs cross, I guess I can call this {} and it gives {b,a,d,c,f,e}). I am sure there is a trivial way of doing this (clearly I can construct matrices and do it by multiplication of the vector - or I can extract elements and swap the postions "by hand" but these seem unnecessarily tedious). Any thoughts out there? Many thanks in advance.