PolyhedralSets/GeneratingFunction - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : PolyhedralSets/GeneratingFunction

PolyhedralSets

  

GeneratingFunction

  

returns the generating function of a polyhedron

 

Calling Sequence

Parameters

Description

Examples

References

Compatibility

Calling Sequence

GeneratingFunction(P)

Parameters

P

-

PolyhedralSet

Description

• 

The command GeneratingFunction(P) returns  the generating function of P This is a multivariate rational function with a number of variables equal to the dimension of P. If P is bounded, evaluating all the variables of GeneratingFunction(P) produces the number of integer points of P.

Examples

> 

with⁡PolyhedralSets:with⁡ExampleSets:with⁡ValuesUnderConstraints:

Define a polyhedron

> 

ps≔Tetrahedron⁡;PolyhedralSets:-Plot⁡ps

ps≔{Coordinates:x1,x2,x3Relations:−x1−x2−x3≤1,−x1+x2+x3≤1,x1−x2+x3≤1,x1+x2−x3≤1

Compute its generating function

> 

gps≔GeneratingFunction⁡ps

gps≔x12⁢x22⁢x32+x12⁢x2⁢x3+x3⁢x1⁢x22+x2⁢x1⁢x32+x1⁢x2⁢x3+x12+x1⁢x2+x1⁢x3+x22+x2⁢x3+x32x1⁢x2⁢x3

(1)

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

> 

NumberOfIntegerPoints⁡ps

11

(2)

Define another polyhedron

> 

ps≔TruncatedOctahedron⁡;PolyhedralSets:-Plot⁡ps

ps≔{Coordinates:x1,x2,x3Relations:−x3≤1,x3≤1,−x2≤1,x2≤1,−x1−x2−x3≤32,−x2+x3−x1≤32,−x1≤1,−x3+x2−x1≤32,−x1+x2+x3≤32,x1−x3−x2≤32, and 4 more constraints

Compute its generating function

> 

gps≔GeneratingFunction⁡ps

gps≔x2⁢x3⁢x12+x22⁢x1⁢x3+x32⁢x1⁢x2+x2⁢x1⁢x3+x1⁢x2+x1⁢x3+x2⁢x3x2⁢x1⁢x3

(3)

Compute the number of integer points of ps

> 

NumberOfIntegerPoints⁡ps

7

(4)

Compute the number of integer points of a parametric polyhedron (in the parameter n) and pretty-print the result using  ValuesUnderConstraints:-ToPiecewise

> 

NIP≔NumberOfIntegerPoints⁡1≤i,1≤j,i≤n,j≤n,i,j,n:ToPiecewise⁡NIP

ToPiecewise⁡value n2 when 0≤−2+n,value 1 when n−1=0

(5)

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

> 

NIP≔NumberOfIntegerPoints⁡−i≤−1,i≤n,−j≤−1,j−i≤0,i,j,n:ToPiecewise⁡NIP

ToPiecewise⁡value 12⁢n2+12⁢n when 0≤−2+n,value 1 when n−1=0

(6)

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

> 

NIP≔NumberOfIntegerPoints⁡1≤i,j≤n,i≤m,3⁢i≤5⁢j,i,j,m,n:ToPiecewise⁡NIP

ToPiecewise⁡value one of the polynomials 00−25−15−25 depending on the value of m modulo 5+n⁢m−3⁢m210+3⁢m10 when 0≤m−2,0≤5⁢n−7,0≤5⁢n−3⁢m−1,value n when m−1=0,0≤5⁢n−4,value 5⁢n26+n2+one of the polynomials 0−13−13 depending on the value of n modulo 3 when 3⁢m−5⁢n=0,0≤5⁢n−4,value 5⁢n26+n2+one of the polynomials 0−13−13 depending on the value of n modulo 3 when 0≤5⁢n−4,0≤−5⁢n+3⁢m−1

(7)

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

> 

NIP≔NumberOfIntegerPoints⁡1≤i,i≤n,i≤m,1≤j,j≤p,i,j,m,n,p;ToPiecewise⁡NIP

NIP≔value p⁢n when m−n=0,0≤−2+n,0≤−2+p,value p when m−1=0,n−1=0,0≤−2+p,value n when p−1=0,m−n=0,0≤−2+n,value 1 when m−1=0,n−1=0,p−1=0,value p⁢n when 0≤−2+n,0≤−2+p,0≤m−n−1,value p when n−1=0,0≤−2+p,0≤m−2,value n when p−1=0,0≤−2+n,0≤m−n−1,value 1 when n−1=0,p−1=0,0≤m−2,value p⁢m when 0≤−2+p,0≤m−2,0≤n−3,0≤−m+n−1,value p when m−1=0,0≤−2+n,0≤−2+p,value m when p−1=0,0≤m−2,0≤n−3,0≤−m+n−1,value 1 when m−1=0,p−1=0,0≤−2+n

ToPiecewise⁡value p⁢n when m−n=0,0≤−2+n,0≤−2+p,value p when m−1=0,n−1=0,0≤−2+p,value n when p−1=0,m−n=0,0≤−2+n,value 1 when m−1=0,n−1=0,p−1=0,value p⁢n when 0≤−2+n,0≤−2+p,0≤m−n−1,value p when n−1=0,0≤−2+p,0≤m−2,value n when p−1=0,0≤−2+n,0≤m−n−1,value 1 when n−1=0,p−1=0,0≤m−2,value p⁢m when 0≤−2+p,0≤m−2,0≤n−3,0≤−m+n−1,value p when m−1=0,0≤−2+n,0≤−2+p,value m when p−1=0,0≤m−2,0≤n−3,0≤−m+n−1,value 1 when m−1=0,p−1=0,0≤−2+n

(8)

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[GeneratingFunction] 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]