Ask Your Question
1

Extracting inequalities for polytopes

asked 2020-10-11 08:19:03 +0100

Cyrille gravatar image

updated 2020-10-11 22:54:50 +0100

slelievre gravatar image

Here is a buckyball

bb = polytopes.buckyball()
rep = bb.Hrepresentation()
show(rep)

and its Hrepresentation. When i ask for say

rep[10]

Sagemath returns the 10th inequality in a way that i coud not use it. Is there a way to obtain explicit inequalities for the polytopes ?

If i type

eq0 = rep[0]

I have an acceptable answer with $x_1$ and $x_2$, but I do not know how to call either $x_1$ or $x_2$ to reuse that inequality in say a linear program.

edit retag flag offensive close merge delete

Comments

Searching Ask Sage for "inequalities":

reveals many other questions and answers which might give some insight.

slelievre gravatar imageslelievre ( 2020-10-11 23:19:22 +0100 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2020-10-11 08:47:24 +0100

FrédéricC gravatar image

Comme ça :

sage: P = polytopes.simplex(4)                                                    
sage: P.inequalities_list()                                                     
[[1, 0, -1, -1, -1, -1],
 [0, 0, 1, 0, 0, 0],
 [0, 0, 0, 1, 0, 0],
 [0, 0, 0, 0, 1, 0],
 [0, 0, 0, 0, 0, 1]]
edit flag offensive delete link more

Comments

Thanks for your answer FrédéricC. But I do not understand the format of the list. As I understand it, the simplex in dimension 4. So why 6 enters not 5 ?

Cyrille gravatar imageCyrille ( 2020-10-11 09:24:09 +0100 )edit

C'est pas interdit de parler français. Le 4-simplexe vit en dimension 5. Chaque inégalité contient un scalaire et un vecteur, donc 6 composants. Merci de lire la documentation.

FrédéricC gravatar imageFrédéricC ( 2020-10-11 09:51:04 +0100 )edit

Merci. En ce qui concerne le français, je pensais que tout le monde devait pouvoir lire les messages et qu'un langage universel était souhaitable.

Cyrille gravatar imageCyrille ( 2020-10-11 11:09:03 +0100 )edit

Les traducteurs automatiques sont devenus très performants.

Citons par exemple DeepL accessible via linguee.

slelievre gravatar imageslelievre ( 2020-10-11 22:57:31 +0100 )edit
0

answered 2020-10-11 22:54:10 +0100

slelievre gravatar image

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

  • equalities of the form A * x + b = 0
  • inequalities of the form 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)
edit flag offensive delete link more

Comments

Note: @FrédéricC's answer explains how to list the $[b, a_0, a_1, ..., a_n]$ of all inequalities at once.

slelievre gravatar imageslelievre ( 2020-10-11 23:01:04 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-10-11 08:19:03 +0100

Seen: 85 times

Last updated: Oct 11 '20

Related questions