combinat::countingFunctions – counting functions

Here, we call counting function  math a function from the non negative integers to themselves. Typically math counts the number of objects of size math in a given graded combinatorial class. Otherwise said, math is the math-th coefficient of the generating series associated to the combinatorial class.

Counting functions are often used to count the dimensions of the homogeneous components of a graded vector space. In this case the generating series becomes the Hilbert series of that vector space.

A functor takes one or several counting functions and returns a new counting function. For example, if f counts the objects of a combinatorial class math the functor set returns the counting function for the sets of objects of math. Most functors correspond to operations on combinatorial classes, or on the corresponding generating series math, or on graded vector spaces.

This library essentially provides classical functors for counting functions. Most of those functors actually work more generally with functions from the non-negative integers to some ring.

To define the semantic of all the algebraic functors below ("_mult", "int", ...), we always interpret a counting function math as its corresponding univariate generating series math.

This library is intended as a repository of fast and flexible low-level utilities, upon which higher level interfaces can be built (say in the form of generating series).

All complexity results are given in number of arithmetic operations on the coefficient ring, and do not include the cost of the computation of the counting functions passed as arguments.

→ Examples

Entries

"coeffRing"

The coefficient ring, that is Dom::ExpressionField().

"zero"

The zero counting function, which maps all natural numbers to 0.

"one"

The unit w.r.t. the product of counting functions. This is the function which maps 1 to 1 and all other natural numbers to 0.

Method _plus is inherited from Cat::Ring.

Method _negate is inherited from Cat::Ring.

Method _mult is inherited from Cat::Ring.

Method _invert is inherited from Cat::Ring.

Method _divide is inherited from Cat::Ring.

term – term constructor

combinat::countingFunctions::term(integer degree)

Returns the counting function corresponding to the generating series math.

monomial – monomial constructor

combinat::countingFunctions::monomial(coeffRing coefficient, integer degree)

Returns the counting function corresponding to the generating series math.

fromPoly – constructor from polynomial

combinat::countingFunctions::fromPoly(univariate polynomial p)

Returns the counting function corresponding to the generating series math.

fromList – constructor from list of monomials

combinat::countingFunctions::fromList(list p)

Returns the counting function corresponding to the generating series math.

mult2 – binary multiplication

combinat::countingFunctions::mult2(counting function f, counting function g)

Returns the product h of f and g, Namely math.

This corresponds to the product math of generating series, the cartesian product of graded combinatorial classes, or the tensor product of graded vector spaces.

Complexity: math for computing the math first coefficients. In the short term, this complexity will be reduced to math using a lazy-Karatsuba algorithm; an experimental implementation of this algorithm is readily available under the name mult2Karatsuba although with a still large constant time factor. In theory, the complexity could be further reduced to essentially math using FFT.

_power – power

combinat::countingFunctions::_power(counting function f, coefficient d)

Returns the counting function for F(z)^d.

As long as f(0) is invertible, d can be any element of the coefficient ring.

For the moment, f(0) always has to be non zero.

Same complexity as "mult2".

_sqrt – square root

combinat::countingFunctions::_sqrt(counting function f)

Returns the counting function for the generating series sqrt(F(z)).

f(0) has to be invertible.

Same complexity as "mult2".

exp – exponential

combinat::countingFunctions::exp(counting function f)

Returns the counting function for the generating series math of math by the exponential function.

Same complexity as "mult2".

ln – logarithm

combinat::countingFunctions::ln(counting function f)

Returns the counting function for the generating series math.

Same complexity as "mult2".

shift – shifting operator

combinat::countingFunctions::shift(counting function f, integer delta)

Returns the counting function f with all coefficients shifted by delta. In case delta is positive, the missing coefficients of f are completed with zeroes of the coefficient ring.

Algebraically, when delta is non-negative, this is the counting function for math. When delta is negative, the same formula holds after discarding the first terms of math. For example, shifting math by math yields math.

Complexity: constant time.

int – integration

combinat::countingFunctions::int(counting function f, coefficient math)

Returns the counting function for the unique primitive math of math having constant term math.

It is obtained by the formula: math, math.

Complexity: constant time.

D – derivation

combinat::countingFunctions::D(counting function f)

Returns the counting function for the generating series math.

It is obtained by the formula: math

Complexity: constant time.

laplace – Laplace transform

combinat::countingFunctions::laplace(counting function f)

Returns the counting function for the Laplace transform of the generating series F(z).

It is obtained by the formula math.

Complexity: constant time.

invlaplace – inverse Laplace transform

combinat::countingFunctions::invlaplace(counting function f)

Returns the counting function for the inverse Laplace transform of the generating series F(z).

It is obtained by the formula math.

Complexity: constant time.

sequence – sequence functor

combinat::countingFunctions::sequence(counting function f)

Assuming that f counts the objects of a combinatorial class math, this returns the counting function for the sequences of objects of math.

Assuming that f counts the algebra generators of a graded free algebra math, this returns the Hilbert series math of math.

Same complexity as "mult2".

powerset – powerset functor

combinat::countingFunctions::powerset(counting function f)

Assuming that f counts the objects of a combinatorial class math, this returns the counting function for the sets of objects of math without repetitions.

Assuming that f counts the algebra generators of a graded free exterior algebra math, this returns the Hilbert series math of math.

Same complexity as "mult2".

invpowerset – inverse powerset functor

combinat::countingFunctions::invpowerset(counting function f)

Inverse transform for "powerset"

Same complexity as "mult2".

multiset – multiset functor

combinat::countingFunctions::multiset(counting function f)

Assuming that f counts the objects of a combinatorial class math, this returns the counting function for the multisets of objects of math.

Assuming that f counts the algebra generators of a graded free commutative algebra math, this returns the Hilbert series math of math. The same property holds for the enveloping algebra of a Lie algebra.

Same complexity as "mult2".

invmultiset – inverse multiset functor

combinat::countingFunctions::invmultiset(counting function f)

Inverse transform for "multiset"

Same complexity as "mult2".

cycle – cycle functor

combinat::countingFunctions::cycle(counting function f)

Assuming that f counts the objects of a combinatorial class math, this returns the counting function for the cycles of objects of math.

See also combinat::necklaces.

Same complexity as "mult2".

invcycle – inverse cycle functor

combinat::countingFunctions::invcycle(counting function f)

Inverse transform for "cycle"

Same complexity as "mult2".

lyndon – Lyndon functor

combinat::countingFunctions::lyndon(counting function f)

Assuming that f counts the objects of a combinatorial class math, this returns the counting function math for the Lyndons words of objects of math (that is aperiodic cycles of objects of math).

Assuming that f counts the Lie generators of a graded free Lie algebra math, this returns the Hilbert series math of math.

See also combinat::lyndonWords.

Same complexity as "mult2".

invlyndon – inverse Lyndon functor

combinat::countingFunctions::invlyndon(counting function f)

Inverse transform for "lyndon"

Same complexity as "mult2".

plethysmPowersum – plethysm by powersum symmetric functions

combinat::countingFunctions::plethysmPowersum(counting function f, non negative integer k)

Returns the plethysm of f by the k-th symmetric powersum (this corresponds to the generating series math).

plethysm – plethysm

combinat::countingFunctions::plethysm(counting function g, counting function f)

Returns the plethysm of f by g.

This corresponds to the generating series: math. Combinatorially, this corresponds to the subst operation.

Precondition: math.

Complexity: math for computing the math first coefficients.

plethysmSym – plethysm by symmetric functions

combinat::countingFunctions::plethysmSym(symmetric function g, counting function f)

Returns the plethysm of f by the symmetric function g. This is obtained by expressing g in terms of symmetric powersums, and using plethsymPowersum.

See also examples::SymmetricFunctions.

Example 1:

We start from one of the simplest counting function:

f := n -> 1:

f(n) $ n = 0..10

math

This counting function corresponds to the combinatorial class of natural integers:

Dom::Natural::count(n) $ n = 0..10

math

and to the generating series math:

series(1/(1 - z), z, 11)

math

We construct the product of f by itself:

g := combinat::countingFunctions::mult2(f, f):

g(n) $ n = 0..10

math

It corresponds to the Cartesian product of the set of natural integers by itself. Namely, f(n) counts the couples math of non-negative integers, w.r.t. their sum math:

combinat::integerVectors::list(4, 2);

combinat::integerVectors::count(n, 2) $ n = 0..10

math

math

Note that this Cartesian product can also be explicitly constructed by means of combinat::decomposableObjects:

C := combinat::decomposableObjects([ C = Prod(Domain(Dom::Natural), Domain(Dom::Natural)) ]):

C::list(4);

C::count(n) $ n = 0..10

math

math

The counting function g also corresponds to the generating series math:

series( 1 / (1 - z)^2, z)

math

Now, a more interesting example: applying the "multiset" functor on math (where math represents the unit counting function) counts multisets of positive natural numbers, that is integer partitions:

g := combinat::countingFunctions::multiset(f-combinat::countingFunctions::one):

g(n) $ n = 0..10;

combinat::partitions::count(n) $ n = 0..10

math

math

Note that those are the dimensions of the homogeneous components of the free commutative algebra with one generator per degree, that is the ring of symmetric functions.

Similarly, applying the "powerset" functor counts strictly decreasing integer partitions:

g := combinat::countingFunctions::powerset(f-combinat::countingFunctions::one):

combinat::partitions::count(n, MaxSlope = -1) $ n = 0..10;

g(n) $ n = 0..10

math

math

Example 2:

Counting functions are not typed as such. In fact one can use as counting function any MuPAD object which behaves as a function from the integers to some ring. Typically, in the previous example, the function n->1 can be replaced by just 1:

f := 1:

f(n) $ n = 0..10

math

Another application is to use symbolic functions to produce symbolic formulas for the functors:

delete(f): delete(g):

h := combinat::countingFunctions::mult2(f, g):

h(4)

math

h := combinat::countingFunctions::multiset(f):

h(2)

math

h := combinat::countingFunctions::powerset(f):

h(2)

math

h := combinat::countingFunctions::laplace(f):

h(i) $ i = 0..6

math

There is a price to pay for the speed and flexibility of this low-level design. Namely, writing f*g does not call the product of counting functions. Instead, it returns the point-wise product of f by g (which corresponds to the Hadamard product of generating series):

h := f * g:

h(n) $ n = 0..4

math

Changes in MuPAD 3.1

New Function.

Changes in MuPAD 4.0

Many new functors implemented.