1 | initial version |
The documentation for Polyhedron
can be accessed using ?
:
sage: Polyhedron?
or online:
See some examples at
Let us look at the specific polytope in the question.
The H-representation consists in
A * x + b = 0
A * x + b >= 0
To get the vector A
and the scalar b
,
use the A
and b
methods of equalities and inequalities.
sage: eq0 = rep[0]
sage: eq0
sage: eq0.A()
(0, -3, -3/2*sqrt5 - 3/2)
sage: eq0.b()
3/4*sqrt5 + 11/4
sage: eq10 = rep[10]
sage: eq10
An inequality (-132*sqrt5 - 300, 0, -84*sqrt5 - 180) x + 122*sqrt5 + 270 >= 0
sage: eq10.A()
(-132*sqrt5 - 300, 0, -84*sqrt5 - 180)
sage: eq0.b()
3/4*sqrt5 + 11/4
If you need radical expressions (when they exist), change to the symbolic ring:
sage: A10, b10 = eq10.A(), eq10.b()
sage: A10.change_ring(SR), SR(b10)
((-132*sqrt(5) - 300, 0, -84*sqrt(5) - 180), 122*sqrt(5) + 270)