|
Calling Sequence
|
|
nextcomb( s, n )
prevcomb( s, n )
firstcomb( n, k )
lastcomb( n, k )
|
|
Parameters
|
|
s
|
-
|
set(posint); a set of positive integers from 1 to n for some n
|
n
|
-
|
nonnegint; size of the set from which combination members are chosen
|
k
|
-
|
nonnegint; size of the combination
|
|
|
|
|
Description
|
|
•
|
Given a combination p (of type set(posint)) of k integers chosen from {1,2, ..., n }, for some n, the command nextcomb returns the lexicographic successor of s.
|
|
If s is the lexicographically last combination (that is, { n - k + 1, n - k + 2, ..., n}), then the value FAIL is returned.
|
•
|
Given a combination s (of type set(posint)) of k integers chosen from {1,2, ..., n }, for some n, the command prevcomb returns the lexicographic predecessor of s.
|
|
If s is the lexicographically first combination (that is, {1,2, ..., k}), then the value FAIL is returned.
|
•
|
The firstcomb command returns the lexicographically first combination of k elements chosen from {1, 2, ..., n }. This is the subset {1,2, ..., k}.
|
•
|
The lastcomb command returns the lexicographically last combination of k elements chosen from {1,2, ..., n }, which is { n - k + 1, n - k + 2, ..., n }.
|
|
|
Thread Safety
|
|
•
|
The combinat[nextcomb], combinat[prevcomb], combinat[firstcomb] and combinat[lastcomb] commands are thread-safe as of Maple 16.
|
|
|
Examples
|
|
| (1) |
>
|
|
>
|
|
>
|
|
>
|
|
|
|
Compatibility
|
|
•
|
The combinat[nextcomb], combinat[prevcomb], combinat[firstcomb] and combinat[lastcomb] commands were introduced in Maple 16.
|
|
|
|