I want a permutation to act on a set. For example: I want the permutation {2,1,3,5,4} to act on the set {2,3,4} by returning {1,3,5}. I need to do this in the same code that has functions that need Combinatorica.

I thought that maybe Orbits[pg,x] might work but I cannot understand the information in the help section.


You can try adding the context of the functions explicitly if you're having clashes with Combinatorica, e.g. System`PermutationReplace[] and System`PermutationCycles[]:

System`PermutationReplace[{2, 3, 4}, System`PermutationCycles[{2, 1, 3, 5, 4}]]

Another possibility is suggested in Leonid's answer here:

Block[{$ContextPath},  Needs["Combinatorica`"]];
PermutationReplace[{2, 3, 4}, PermutationCycles[{2, 1, 3, 5, 4}]]
  • $\begingroup$ Thank you very much. System` works for me. $\endgroup$ – Geoffrey Critzer Oct 28 '15 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.