count - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


combstruct

  

draw

  

draw random combinatorial object

  

count

  

count combinatorial objects of a specified size

 

Calling Sequence

Parameters

Description

Examples

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

withcombstruct:

binB=UnionZ,ProdB,B:

drawB,bin,labeled,size=7

ProdZ1,ProdProdProdProdProdZ4,Z3,Z2,Z6,Z7,Z5

(1)

drawB,bin,size=7

ProdProdZ,ProdZ,ProdZ,ProdProdZ,Z,Z,Z

(2)

countB,bin,unlabeled,size=7

132

(3)

drawCombinationa,b,c

a,b

(4)

countPermutationa,b,c,size=2

6

(5)

See Also

combstruct

combstruct[specification]

combstruct[structures]