choose - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


combinat

  

choose

  

construct the combinations of a list

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

choose(n)

choose(n, m)

Parameters

n

-

list or set of objects or an non-negative integer

m

-

(optional) non-negative integer

Description

• 

If n is a list or set, then choose returns a list/set of the combinations of the list elements.  If n is a non-negative integer, it is interpreted in the same way as a list of the first n integers.

• 

If m is given, then only combinations of size m are generated; otherwise, all combinations are generated, including the empty combination, that is, the power set is generated and converted to a sorted list. Note that duplicates in the list n are taken into account.

• 

To calculate the number of combinations of n taken m at a time, use combinat[numbcomb].

• 

The command with(combinat,choose) allows the use of the abbreviated form of this command.

Examples

withcombinat:

choose3,2

1,2,1,3,2,3

(1)

choosea,a,b

,a,b,a,b,a,a,a,a,b

(2)

choosea,b,c

,a,b,c,a,b,a,c,b,c,a,b,c

(3)

choosea,b,b,c,2

a,b,a,c,b,b,b,c

(4)

See Also

binomial

combinat[numbcomb]

combinat[permute]

combine