The Polyhedral Library (PolyLib for short) operates on objects made up of unions of polyhedra of any dimension. It was first developed by Doran Wilde at IRISA, in Rennes, France, in connection with the ALPHA project. It is now available from the site of University Louis Pasteur, at Strasbourg:
http://icps.u-strasbg.fr/polylib/
We use it here to compute the Ehrhart polynomial of a polyhedron defined under MuPAD. The so-called "Ehrhart polynomial" gives a closed form to the number of integer points in a polyhedron defined by a set of inequalities; the polyhedron is allowed to be defined in terms of symbolic parameters. More details can be found on the same site at Strasbourg :
http://icps.u-strasbg.fr/Ehrhart/
For instance, from the following input, describing a polyhedron parameterized by p:
[x-1>=0, -2*x+p>=0], // the polyhedron
[-p+80>=0], // context
[x], // list of iterators
[p], // list of parameters
[] // substitution list for the parameters, e.g. [p=10]
the present interface will return to MuPAD the expression below:
-- table( --
| p |
| _value = - + _periodic([0, -1/2], p), |
| 2 |
| _cond = _cond = 0 <= p - 2 and 0 <= 80 - p |
-- ) --
This means a list of alternatives, each alternative being implemented as a table:
for each alternative, when _cond is
evaluated to TRUE, _value yields the expected expression, a function of the
parameters. In the present case, there is only one alternative, whose condition
is implied by the context. When given to the pretty printing function prt_poly,
this gives an "Ehrhart polynomial":1/2*p + _periodic([0, -1/2], p)Here _periodic takes 2 parameters: a list l and a parameter p; the result is the k-th element of the list (counting up from 0), where k=p (modulo length of list). E.g. we get (-1/2) when p = 11.
Note that whenever a parameter is given a value in the substitution list, it gets evaluated within the interface.
To install and use this interface:
>> READPATH := your_directory."/Count":The MuPAD procedure constraints2poly takes a friendly description of the polyhedron, and converts it to a description readable by the interface.
>> constraints_ := constraints2poly ([x-1>=0, -2*x+p>=0], [-p+80>=0], [x], [p], []) : >> module(count): >> count::count (op(constraints_,1), op(constraints_,2),[p]) ;