793ecbe487d4874f836b6fdf404c0bc341b616f5
[linpy.git] / doc / examples.rst
1 Pypol Examples
2 ==============
3
4 Creating a Square
5 -----------------
6 To create any polyhedron, first define the symbols used. Then use the polyhedron functions to define the constraints for the polyhedron. This example creates a square::
7
8 >>> x, y = symbols('x y')
9 >>> # define the constraints of the polyhedron
10 >>> square = Le(0, x) & Le(x, 2) & Le(0, y) & Le(y, 2)
11 >>> print(square)
12 >>> And(Ge(x, 0), Ge(-x + 2, 0), Ge(y, 0), Ge(-y + 2, 0))
13
14 Several unary operations can be performed on a polyhedron. For example: ::
15
16 >>> ¬square
17
18
19 Plot Examples
20 -------------
21
22