choose - Maple Help

combinat

 choose
 construct the combinations of a list

 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

 > $\mathrm{with}\left(\mathrm{combinat}\right):$
 > $\mathrm{choose}\left(3,2\right)$
 $\left[\left[{1}{,}{2}\right]{,}\left[{1}{,}{3}\right]{,}\left[{2}{,}{3}\right]\right]$ (1)
 > $\mathrm{choose}\left(\left[a,a,b\right]\right)$
 $\left[\left[\right]{,}\left[{a}\right]{,}\left[{b}\right]{,}\left[{a}{,}{b}\right]{,}\left[{a}{,}{a}\right]{,}\left[{a}{,}{a}{,}{b}\right]\right]$ (2)
 > $\mathrm{choose}\left(\left\{a,b,c\right\}\right)$
 $\left\{{\varnothing }{,}\left\{{a}\right\}{,}\left\{{b}\right\}{,}\left\{{c}\right\}{,}\left\{{a}{,}{b}\right\}{,}\left\{{a}{,}{c}\right\}{,}\left\{{b}{,}{c}\right\}{,}\left\{{a}{,}{b}{,}{c}\right\}\right\}$ (3)
 > $\mathrm{choose}\left(\left[a,b,b,c\right],2\right)$
 $\left[\left[{a}{,}{b}\right]{,}\left[{a}{,}{c}\right]{,}\left[{b}{,}{b}\right]{,}\left[{b}{,}{c}\right]\right]$ (4)