[Previous] [Next] [Contents]

## `COMP::ListCompo` -- list of compositions of a given weight

#### Call(s)

`COMP::ListCompo(n <,options>)`

#### Parameters

`n` | - | any non negative integer

#### Options

`lg=l, lg<=l` | - | (maximal) number of parts of each composition
`maxouter=p` | - | outermost possible shape of the diagram
`allowzeros` | - | compositions may include zeros
`nb` | - | only counts objects

Use the syntax `hold(identifier)`, instead of `identifier`, if one of the identifiers above is already defined.

#### Introduction

The `COMP::ListCompo` function gives all compositions of `n`. A composition of `n` is a list of positive integers, called parts, with sum `n`.

When called with one argument, say `n`, the function returns the list of all compositions of n.

Given a composition `comp`, `_plus(op(comp))` gives its weight.

#### Example 1

    >> muEC::COMP::ListCompo( 3 );

                         [[3], [2, 1], [1, 2], [1, 1, 1]]

    >> muEC::COMP::ListCompo( 2, allowzeros, lg=3 );

          [[2, 0, 0], [1, 1, 0], [1, 0, 1], [0, 2, 0], [0, 1, 1],

             [0, 0, 2]]

    >> muEC::COMP::ListCompo( 5, maxouter=[4,3], allowzeros, lg<=4 );

               [[4, 1], [4, 1, 0], [4, 1, 0, 0], [3, 2], [3, 2, 0],

                [3, 2, 0, 0], [2, 3], [2, 3, 0], [2, 3, 0, 0]]

    >> muEC::COMP::ListCompo( 20, lg<=10, nb );

                                      262144

#### Related Functions

`ListCompoFatter`, `ListCompoFiner`, `TYP::IsCompo`

[Previous] [Next] [Contents]

MuPAD Combinat, an open source algebraic combinatorics package