rankperm - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


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

Calling Sequence

rankperm( p )

unrankperm( n, r )

Parameters

p

-

permlist; permutation of positive integers from 1 to n for some n

n

-

posint; permutation degree

r

-

posint; rank of permutation

Description

• 

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}.

Thread Safety

• 

The combinat[rankperm] and combinat[unrankperm] commands are thread-safe as of Maple 16.

• 

For more information on thread safety, see index/threadsafe.

Examples

withcombinat

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

(1)

rankperm1,3,2

2

(2)

rankperm4,1,2,3

19

(3)

unrankperm19,4

4,1,2,3

(4)

sequnrankpermr,3,r=1..3!

1,2,3,1,3,2,2,1,3,2,3,1,3,1,2,3,2,1

(5)

Compatibility

• 

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

combinat[permute]