Documentation directory
[linpy.git] / examples / squares.py
1 #!/usr/bin/env python3
2
3 from pypol import *
4
5 x, y = symbols('x y')
6
7 sq1 = Le(0, x) & Le(x, 2) & Le(0, y) & Le(y, 2)
8 sq2 = Le(2, x) & Le(x, 4) & Le(2, y) & Le(y, 4)
9
10 print('sq1 =', sq1)
11 print('sq2 =', sq2)
12 print()
13 print('¬sq1 =', ~sq1)
14 print()
15 print('sq1 - sq2 =', sq1 - sq2)
16 print('sq1 - sq2 =', Polyhedron(sq1 - sq2))
17 print()
18 print('sq1 ∩ sq2 =', sq1 & sq2)
19 print('sq1 ∪ sq2 =', sq1 | sq2)
20 print()
21 print('sq1 ⊔ sq2 =', Polyhedron(sq1 | sq2))