1 | initial version |

The Ehrhart polynomial $p$ of a polyhedron $P$ helps counting integral points in its dilates.

Indeed, for each integer $n$, the number of integral points in the dilate $n P$ is given by $p(n)$.

Sage also provides a direct method for counting integral points.

Here is an illustration.

Construct a polyhedron:

```
sage: vertex_list = [(1, 9, 0), (2, 4, 5), (3, 3, 2), (5, 0, 9),
....: (6, 1, 9), (6, 3, 1), (9, 3, 2), (8, 6, 9)]
sage: P = Polyhedron(vertices=vertex_list)
```

Find its Ehrhart polynomial via latte (requires installing the optional package latte_int):

```
sage: p = P.ehrhart_polynomial(engine='latte')
sage: p
893/6*t^3 + 13/2*t^2 + 23/3*t + 1
```

Get the number of integral points in the polyhedron via the Ehrhart polynomial:

```
sage: p(1)
164
```

Get the number of integral points in the polyhedron directly:

```
sage: P.integral_points_count()
164
```

2 | No.2 Revision |

The Ehrhart polynomial $p$ of a polyhedron $P$ helps counting integral points in its dilates.

Indeed, for each integer $n$, the number of integral points in the dilate $n P$ is given by $p(n)$.

Sage also provides a direct method for counting integral points.

Here is an illustration.

Construct a polyhedron:

`sage: vertex_list = `~~[(1, 9, 0), ~~[(0, 0, 1), (1, 0, 0), (1, 0, 1),
....: (1, 1, 0), (1, 1, 1), (2, ~~4, 5), (3, 3, 2), (5, 0, 9),
....: (6, 1, 9), (6, 3, 1), (9, 3, 2), (8, 6, 9)]
~~1, 0)]
sage: P = Polyhedron(vertices=vertex_list)

Inspect it:

```
sage: P
A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 6 vertices
```

Find its Ehrhart polynomial via latte (requires installing the optional package latte_int):

```
sage: p = P.ehrhart_polynomial(engine='latte')
sage: p
```~~893/6*t^3 ~~2/3*t^3 + ~~13/2*t^2 ~~2*t^2 + ~~23/3*t ~~7/3*t + 1

Get the number of integral points in the polyhedron via the Ehrhart polynomial:

```
sage: p(1)
```~~164
~~6

Get the number of integral points in the polyhedron directly:

```
sage: P.integral_points_count()
```~~164
~~

6
Besides counting integral points, one can also be interested in finding these points explicitly.

The method `integral_points`

provides that:

```
sage: points = P.integral_points()
sage: points
((1, 0, 0), (0, 0, 1), (1, 0, 1), (1, 1, 0), (2, 1, 0), (1, 1, 1))
```

3 | No.3 Revision |

The Ehrhart polynomial $p$ of a polyhedron $P$ helps counting integral points in its dilates.

Indeed, for each integer $n$, the number of integral points in the dilate $n P$ is given by $p(n)$.

Sage also provides a direct method for counting integral points.

Here is an illustration.

Construct a polyhedron:

```
sage: vertex_list = [(0, 0, 1), (1, 0, 0), (1, 0, 1),
....: (1, 1, 0), (1, 1, 1), (2, 1, 0)]
sage: P = Polyhedron(vertices=vertex_list)
```

Inspect it:

```
sage: P
A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 6 vertices
```

Find its Ehrhart polynomial via latte (requires installing the optional package latte_int):

```
sage: p = P.ehrhart_polynomial(engine='latte')
sage: p
2/3*t^3 + 2*t^2 + 7/3*t + 1
```

Get the number of integral points in the polyhedron via the Ehrhart polynomial:

```
sage: p(1)
6
```

Get the number of integral points in the polyhedron directly:

```
sage: P.integral_points_count()
6
```

Besides counting integral points, one can also be interested in finding these points explicitly.

The method `integral_points`

provides that:

```
sage: points = P.integral_points()
sage: points
((1, 0, 0), (0, 0, 1), (1, 0, 1), (1, 1, 0), (2, 1, 0), (1, 1, 1))
```

The documentation for the `ehrhart polynomial`

method
gives hints about all that.

To access it in text mode, use a question mark:

```
sage: P.ehrhart_polynomial?
```

The documentation can also be browsed rendered in html:

```
sage: browse_sage_doc(P.ehrhart_polynomial)
```

To access the corresponding source code:

```
sage: P.ehrhart_polynomial??
```

To discover the `integral_points_count`

and `integral_points`

methods,
use tab-completion:

```
sage: P.int<TAB>
```

where `<TAB>`

means "press the TAB key on the keyboard".

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.