combinat - Maple Help

# Online Help

###### All Products    Maple    MapleSim

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

combinat

 composition
 k-compositions of an integer

 Calling Sequence composition(n, k)

Parameters

 n, k - non-negative integers

Description

 • The procedure composition computes and returns a list containing all distinct ordered k-tuples of positive integers whose elements sum to n.  These are known as the compositions of n.
 • In the list of k-tuples returned, each k-tuple is a list representing a particular composition of n.
 • See also the function numbcomp, which computes the number of different compositions of an integer.
 • The command with(combinat,composition) allows the use of the abbreviated form of this command.

Examples

 > $\mathrm{with}\left(\mathrm{combinat}\right):$
 > $\mathrm{composition}\left(5,2\right)$
 $\left\{\left[{1}{,}{4}\right]{,}\left[{2}{,}{3}\right]{,}\left[{3}{,}{2}\right]{,}\left[{4}{,}{1}\right]\right\}$ (1)
 > $\mathrm{composition}\left(3,3\right)$
 $\left\{\left[{1}{,}{1}{,}{1}\right]\right\}$ (2)
 > $\mathrm{composition}\left(4,3\right)$
 $\left\{\left[{1}{,}{1}{,}{2}\right]{,}\left[{1}{,}{2}{,}{1}\right]{,}\left[{2}{,}{1}{,}{1}\right]\right\}$ (3)

 See Also

## Was this information helpful?

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