Tell me more ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a list of all non-cyclic permutations of n labels. How can I get rid of all elements which are redundant in the sense that they are the inverse of another one. For instance if n=4, the elements {1,2,3,4} and {1,4,3,2} are related by reversal and right rotation by one element. So I want to discard the latter.

Cheers!

share|improve this question
DeleteDuplicates[ Permutations[Range[4]], #1 == InversePermutation[#2] &]? – kguler Oct 11 '12 at 13:33
If I use DeleteDuplicates[ Permutations[Range[4]], #1 == RotateRight[Reverse[#2]] &] it works, i.e. it kills all the entries which are the same under inversion :) For some reason InversePermutation does not do the trick. – A friendly helper Oct 11 '12 at 13:47
@kguler: Apparently InversePermutation[] only works on Cycle[] objects... – J. M. Oct 11 '12 at 13:54
I see ... you meant reversion and right rotation - InversePermutation is quite unrelated. – kguler Oct 11 '12 at 14:09
@J.M. that's the impression one gets from the docs; but it works with permutation lists too. You can see this by replacing the Cycle[] objects with the associated permutation lists in all the examples in docs, or checking PermutationProduct[#, InversePermutation[#]]& with cycles and/or lists as input. – kguler Oct 11 '12 at 14:21
show 2 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.