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))
Why not this?
Note: also asked at:
Thanks a lot for your answers!!! I will try them all. Perhaps with some additional conditions: x != y, z as a third variable and perhaps two equations.
Dear sielievre, I posted it first in the Google-Group, thats true, but afterwards I recognised, that that group was for more technical questions.
It's fine to ask at either place. Some prefer the mailing list format, others the Q&A website.
When a question is asked in multiple places it's nice if they link to each other so when someone later has a similar question they can see the answers at all places.