count - Maple Help

combstruct

 draw
 draw random combinatorial object
 count
 count combinatorial objects of a specified size

 Calling Sequence draw([A, spec, typ], size=n) draw(struct(args), size=n) count([A, spec, typ], size=n) count(struct(args), size=n)

Parameters

 A - nonterminal of spec spec - combinatorial specification typ - labeling type; 'labeled' or 'unlabeled', the default is 'unlabeled' n - (optional with structures) non-negative integer specifying the size of the object, or string 'allsizes' struct - one of a pre-defined list of available structures args - argument list that corresponds to the structure struct

Description

 • The draw function outputs a random object of size n in the class $A$ defined by the specification spec, with uniform distribution among all objects of the same size.
 • In the case of structures, the draw function returns an object of size n, or an object chosen from all possible sizes, or an object of the default size for that structure, if the size was not specified.
 Use the string 'allsizes' which is available only for predefined structures when the object is chosen from all possible sizes.
 • The count function returns the number of such objects.
 • To learn how to write a grammar specification, see combstruct[specification].
 For a list of available structures, see combstruct[structures].

Examples

 > $\mathrm{with}\left(\mathrm{combstruct}\right):$
 > $\mathrm{bin}≔\left\{B=\mathrm{Union}\left(Z,\mathrm{Prod}\left(B,B\right)\right)\right\}:$
 > $\mathrm{draw}\left(\left[B,\mathrm{bin},\mathrm{labeled}\right],\mathrm{size}=7\right)$
 ${\mathrm{Prod}}{}\left({{Z}}_{{1}}{,}{\mathrm{Prod}}{}\left({\mathrm{Prod}}{}\left({\mathrm{Prod}}{}\left({\mathrm{Prod}}{}\left({\mathrm{Prod}}{}\left({{Z}}_{{4}}{,}{{Z}}_{{3}}\right){,}{{Z}}_{{2}}\right){,}{{Z}}_{{6}}\right){,}{{Z}}_{{7}}\right){,}{{Z}}_{{5}}\right)\right)$ (1)
 > $\mathrm{draw}\left(\left[B,\mathrm{bin}\right],\mathrm{size}=7\right)$
 ${\mathrm{Prod}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Prod}}{}\left({Z}{,}{\mathrm{Prod}}{}\left({\mathrm{Prod}}{}\left({Z}{,}{Z}\right){,}{Z}\right)\right)\right)\right){,}{Z}\right)$ (2)
 > $\mathrm{count}\left(\left[B,\mathrm{bin},\mathrm{unlabeled}\right],\mathrm{size}=7\right)$
 ${132}$ (3)
 > $\mathrm{draw}\left(\mathrm{Combination}\left(\left[a,b,c\right]\right)\right)$
 $\left[{a}{,}{b}\right]$ (4)
 > $\mathrm{count}\left(\mathrm{Permutation}\left(\left[a,b,c\right]\right),\mathrm{size}=2\right)$
 ${6}$ (5)