|
Calling Sequence
|
|
rankcomb( s, n )
unrankcomb( r, n, k )
|
|
Parameters
|
|
s
|
-
|
set(posint); a set of positive integers from 1 to n for some n
|
n
|
-
|
posint; size of the set from which combination members are chosen
|
k
|
-
|
posint; size of the combination
|
r
|
-
|
posint; the rank of a combination
|
|
|
|
|
Description
|
|
•
|
Given a combination (subset) s of the integers from 1 to n, for some positive integer n, the command rankcomb( 's', 'n' ) computes the lexicographic rank of s. That is, if s has k members, and if the k-subsets of {1,2,...,n} are listed lexicographically, then the position of the given subset in this ordered list is returned.
|
•
|
Given a rank r (where r is at most binomial(n,k)), the command unrankcomb( 'r', 'n', 'k' ) computes the k-subset of {1,2,...,n} which occurs in the r-th place in a lexicographically ordered list of the k-subsets of {1,2,...,n}.
|
•
|
The commands rankcomb and unrankcomb are inverse to one another in the sense that they satisfy rankcomb( unrankcomb( r, k, n ), n ) = r and unrankcomb( rankcomb( s, n ), nops( s ), n ) = s.
|
|
|
Thread Safety
|
|
•
|
The combinat[rankcomb] and combinat[unrankcomb] commands are thread-safe as of Maple 16.
|
|
|
Examples
|
|
>
|
|
>
|
|
>
|
|
|
|
Compatibility
|
|
•
|
The combinat[rankcomb] and combinat[unrankcomb] commands were introduced in Maple 16.
|
|
|
|