combinat - Maple Programming Help

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

combinat

 numbcomb
 Count the number of combinations

 Calling Sequence numbcomb(n, m)

Parameters

 n - list or set of expressions or a non-negative integer m - (optional) non-negative integer

Description

 • If n is a list or set, then numbcomb counts the combinations of the elements of n taken m at a time. If m is not given, then all combinations are considered. If n is a non-negative integer, it is interpreted in the same way as a set of the first n integers.
 • Note that the result of numbcomb(n, m) is equivalent to $\mathrm{numelems}\left(\mathrm{choose}\left(n,m\right)\right)$. However, this number is computed either by using binomial coefficients or by using a generating function method.
 • Additionally, note that if n is a non-negative integer, the result of numbcomb(n, m) is identical to that of $\mathrm{binomial}\left(n,m\right)$.
 • The count of combinations takes into account duplicates in n. In the case where there are no duplicates, the count is given by the formula ${2}^{n}$ if m is not specified, or by the formula $\mathrm{binomial}\left(n,m\right)$ if m is specified. If there are duplicates in the list, then the generating function is used.
 • The command with(combinat,numbcomb) allows the use of the abbreviated form of this command.

Examples

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