combinat
rankperm
construct the lexicographic successor of a given permutation
unrankperm
construct the lexicographic predecessor of a given permutation
Calling Sequence
Parameters
Description
Thread Safety
Examples
Compatibility
rankperm( p )
unrankperm( n, r )
p
-
permlist; permutation of positive integers from 1 to n for some n
n
posint; permutation degree
r
posint; rank of permutation
Given a permutation p (of type permlist) of the integers 1 through n, for some n, the command rankperm returns the lexicographic rank of p. That is, its position in the lexicographically sorted list of all permutations of degree n.
The unrankperm command is a kind of inverse to rankperm. Given the lexicographic rank r (an integer in the range 1..n!), it returns the permutation that occurs in position r in a lexicographically sorted list of all the permutations of {1,2,...,n}.
The combinat[rankperm] and combinat[unrankperm] commands are thread-safe as of Maple 16.
For more information on thread safety, see index/threadsafe.
with⁡combinat
Chi,bell,binomial,cartprod,character,choose,composition,conjpart,decodepart,encodepart,eulerian1,eulerian2,fibonacci,firstcomb,firstpart,firstperm,graycode,inttovec,lastcomb,lastpart,lastperm,multinomial,nextcomb,nextpart,nextperm,numbcomb,numbcomp,numbpart,numbperm,partition,permute,powerset,prevcomb,prevpart,prevperm,randcomb,randpart,randperm,rankcomb,rankperm,setpartition,stirling1,stirling2,subsets,unrankcomb,unrankperm,vectoint
rankperm⁡1,3,2
2
rankperm⁡4,1,2,3
19
unrankperm⁡19,4
4,1,2,3
seq⁡unrankperm⁡r,3,r=1..3!
1,2,3,1,3,2,2,1,3,2,3,1,3,1,2,3,2,1
The combinat[rankperm] and combinat[unrankperm] commands were introduced in Maple 16.
For more information on Maple 16 changes, see Updates in Maple 16.
See Also
combinat[permute]
Download Help Document