1 | initial version |

Expanding on hints by Matthias Köppe on sage-support and by FrédéricC here.

In RR^2, consider the set S of all (x, y) satisfying:

```
x >= 1
x <= 9
y >= 1
y <= 9
x + y = 15
```

or if one prefers,

```
-1 + x >= 0
9 - x >= 0
-1 + y >= 0
9 - y >= 0
-15 + x + y = 0
```

Since all the conditions used to define this set are of one of the following forms:

```
(linear form in x and y) = 0
(linear form in x and y) >= 0
```

the subset S is what is called a "polyhedron" in R^2.

The problem in your original post can now be rephrased as:

```
Find all integral points in the polyhedron S.
```

An introduction to polyhedra in Sage is at:

```
http://doc.sagemath.org/html/en/reference/discrete_geometry/sage/geometry/polyhedron/constructor.html
```

The polyhedron S can be input as

```
S = Polyhedron(ieqs=[[-1, 1, 0], [9, -1, 0], [-1, 0, 1], [9, 0, -1]], eqns=[[-15, 1, 1]])
```

Check that our input represents the correct polyhedron:

```
sage: print(S.Hrepresentation_str())
x0 + x1 == 15
-x0 >= -9
x0 >= 6
```

Find all integral points:

```
sage: S.integral_points()
((6, 9), (7, 8), (8, 7), (9, 6))
```

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.