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

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : PolyhedralSets/NumberOfIntegerPoints

PolyhedralSets

  

NumberOfIntegerPoints

  

returns the number of integer points of a polyhedron

 

Calling Sequence

Parameters

Description

Examples

References

Compatibility

Calling Sequence

NumberOfIntegerPoints(P)

NumberOfIntegerPoints(PP,Vars, Params, opt)

Parameters

P

-

PolyhedralSet

PP

-

list(relation)

Vars

-

list(name)

Params

-

list(name)

opt

-

(optional) equation of the form output = o, where o is either list or piecewise, and/or the keyword compactdisplay

Description

• 

The command NumberOfIntegerPoints(P) returns  the number of integer points of P, if P is bounded.

• 

The command NumberOfIntegerPoints(PP,Vars,Params) returns the number of integer points of the parametric polyhedral set PP, with variables in Vars and parameters in Params, if PP is bounded.

• 

By default, the value that is returned for the second calling sequence is a list of ValuesUnderConstraints objects. Using the ValuesUnderConstraints:-Eval command, one can evaluate this list to a list of sets of values, when specializing the parameters to a particular point. If you pass the output = piecewise option, then the output is a piecewise expression. This piecewise expression evaluates to a set of values, when specializing the parameters to a particular point. You can explicitly request the default output by passing the output = list option. In some circumstances (e.g. if there aren't any parameters), the ValuesUnderConstraints objects or piecewise expressions will be fully evaluated to a list of a set of a single integer (with output = list) or a set of a single integer (with output = piecewise).

• 

The constraints in either the ValuesUnderConstraints objects or the piecewise expressions are systems of linear equations and non-strict linear inequalities in the parameters, while the values are polynomials or quasipolynomials in the parameters. A quasipolynomial is an object that assumes the value of one of several polynomials depending on the value of a parameter modulo an integer. The quasipolynomials will also evaluate to concrete values when one applies ValuesUnderConstraints:-Eval.

• 

By default, any quasipolynomials are displayed in a format that explains to some extent what they represent. In some circumstances it may be better to show the quasipolynomials in a more compact way. This can be selected by using the compactdisplay option.

Assumptions

• 

The list PP is a list of linear equations and non-strict linear inequalities

• 

Each indeterminate of each constraint in PP belongs either to the list of variables Vars or to the list of parameters Params.

Examples

withPolyhedralSets:withExampleSets:withValuesUnderConstraints:

Define a polyhedron

psTetrahedron;PolyhedralSets:-Plotps

ps{Coordinates:x1,x2,x3Relations:x1x2x31,x1+x2+x31,x1x2+x31,x1+x2x31

Compute its generating function

gpsGeneratingFunctionps

gpsx12x22x32+x12x2x3+x3x1x22+x2x1x32+x1x2x3+x12+x1x2+x1x3+x22+x2x3+x32x1x2x3

(1)

Compute the number of integer points of ps, which is calculated by evaluating all variables of  gps to 1.

NumberOfIntegerPointsps

11

(2)

Define another polyhedron

psTruncatedOctahedron;PolyhedralSets:-Plotps

ps{Coordinates:x1,x2,x3Relations:x31,x31,x21,x21,x1x2x332,x2+x3x132,x11,x3+x2x132,x1+x2+x332,x1x3x232, and 4 more constraints

Compute its generating function

gpsGeneratingFunctionps

gpsx2x3x12+x22x1x3+x32x1x2+x2x1x3+x1x2+x1x3+x2x3x2x1x3

(3)

Compute the number of integer points of ps

NumberOfIntegerPointsps

7

(4)

Compute the number of integer points of a parametric polyhedron (in the parameter n).

NumberOfIntegerPoints1i,1j,in,jn,i,j,n

value n2 when 02+n,value 1 when n1=0

(5)

We can view the same result as a piecewise expression.

NumberOfIntegerPoints1i,1j,in,jn,i,j,n,output=piecewise

n202+n1n1=0

(6)

Compute the number of integer points of a parametric polyhedron (in the parameter n).

NumberOfIntegerPointsi1,in,j1,ji0,i,j,n,output=piecewise

12n2+12n02+n1n1=0

(7)

Compute the number of integer points of a parametric polyhedron (in the parameter n and m) and pretty-print the result

NumberOfIntegerPoints1i,jn,im,3i5j,i,j,m,n,output=piecewise

one of the polynomials 00251525 depending on the value of m modulo 5+nm3m210+3m100m205n705n3m1nm1=005n4one of the polynomials 01313 depending on the value of n modulo 3+5n26+n23m5n=005n4one of the polynomials 01313 depending on the value of n modulo 3+5n26+n205n405n+3m1

(8)

We can display the quasipolynomials in a more compact manner as follows.

NumberOfIntegerPoints1i,jn,im,3i5j,i,j,m,n,output=piecewise,compactdisplay

nm3m210+QuasiPolynomial0,0,25,15,25,m,5+3m100m205n705n3m1nm1=005n4QuasiPolynomial0,13,13,n,3+5n26+n23m5n=005n4QuasiPolynomial0,13,13,n,3+5n26+n205n405n+3m1

(9)

Compute the number of integer points of a parametric polyhedron (in the parameter n, m and p) and pretty-print the result

NumberOfIntegerPoints1i,in,im,1j,jp,i,j,m,n,p,output=piecewise

pnmn=002+n02+ppm1=0n1=002+pnp1=0mn=002+n1m1=0n1=0p1=0pn02+n02+p0mn1pn1=002+p0m2np1=002+n0mn11n1=0p1=00m2pm02+p0m20n30m+n1pm1=002+n02+pmp1=00m20n30m+n11m1=0p1=002+n

(10)

The following example shows that the polyhedral set must be bounded, even in the parametric case. Otherwise, an error message is generated.

NumberOfIntegerPoints1i,in,1j,i,j,n

Error, (in PolyhedralSets:-NumberOfIntegerPoints) polyhedral set must be bounded

References

  

Rui-Juan Jing, Yuzhuo Lei, Christopher F. S. Maligec, Marc Moreno Maza: " Counting the Integer Points of Parametric Polytopes: A Maple Implementation." Proceedings of Computer Algebra in Scientific Computing - 26th International Workshop (CASC) 2024: 140-160, Lecture Notes in Computer Science, vol. 14938, Springer. ##

Compatibility

• 

The PolyhedralSets[NumberOfIntegerPoints] command was introduced in Maple 2025.

• 

For more information on Maple 2025 changes, see Updates in Maple 2025.

See Also

PolyhedralSets[NumberOfIntegerPoints]

PolyhedralSets[GeneratingFunction]

PolyhedralSets[ZPolyhedralSets]

PolyhedralSets[IntegerHull]