combinat::integerVectorsWeighted – weighted integer vectors

The library combinat::integerVectorsWeighted provides functions for counting, generating, and manipulating weighted integer vectors.

→ Examples

Superdomain

Dom::BaseDomain

Categories

Cat::CombinatorialClass, Cat::FacadeDomain(DOM_LIST)

Categories

Cat::CombinatorialClass, Cat::FacadeDomain(DOM_LIST)

See Also:

combinat::integerVectors

Details:

Entries

"domtype"

The MuPAD domain used to represent weighted integer vectors: DOM_LIST

count – number of weighted integer vectors

combinat::integerVectorsWeighted::count(nonnegative integer n, weight vector w)

Returns the number of w-weighted integer vectors of sum n.

list – list of the weighted integer vectors

combinat::integerVectorsWeighted::list(nonnegative integer n, weight vector w)

Returns the list of the w-weighted integer vectors of sum n.

generator – generator for weighted integer vectors

combinat::integerVectorsWeighted::generator(nonnegative integer n, weight vector w)

Returns a generator for the w-weighted integer vectors of sum n.

generatingSeries – generating series for weighted integer vectors

combinat::integerVectorsWeighted::generatingSeries(weight vector math, <indeterminate math>)

Returns the generating series in z for the w-weighted integer vectors by sum.

Example 1:

There are math[3,1,2]-weighted integer vectors of sum math:

combinat::integerVectorsWeighted::count(5, [3,1,2])

math

Here is the list:

combinat::integerVectorsWeighted::list(5, [3,1,2])

math

Finally, this is the generating series for the [3,1,2]-weighted integer vectors:

combinat::integerVectorsWeighted::generatingSeries([3,1,2]);

series(%,z)

math

math

Example 2:

We search for all the ways to pay a math cents postal fee using stamps of math, math, and math cents:

combinat::integerVectorsWeighted(17,[3,4,5]);

math

Where [1,1,2] means that we need one stamp of math cents, another of math and two of math.

Another approach is to look for the partitions of math including only math, math, and math. This is easily done by:

combinat::partitions::list(17,MinPart=3,MaxPart=5);

math

Background:

This library uses a crude backtrack algorithm with simple heuristics; this can be slow!