combinat - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Discrete Mathematics : Combinatorics : combinat : combinat/nextcomb

combinat

  

nextcomb

  

construct the lexicographic successor of a given combination

  

prevcomb

  

construct the lexicographic predecessor of a given combination

  

firstcomb

  

construct the lexicographically first combination

  

lastcomb

  

construct the lexicographically last combination

 

Calling Sequence

Parameters

Description

Thread Safety

Examples

Compatibility

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.

• 

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)

nextcomb1,2,3,5

1,2,4

(2)

nextcomb1,2,3,4,4

FAIL

(3)

prevcomb2,3,4,5

1,4,5

(4)

prevcomb1,2,3,4,5,5

FAIL

(5)

firstcomb5,3

1,2,3

(6)

lastcomb5,3

3,4,5

(7)

Compatibility

• 

The combinat[nextcomb], combinat[prevcomb], combinat[firstcomb] and combinat[lastcomb] commands were introduced in Maple 16.

• 

For more information on Maple 16 changes, see Updates in Maple 16.

See Also

combinat

combinat[choose]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam