Matricial conversion of a system of inequations.

13 views
Skip to first unread message

cyrille....@univ-orleans.fr

unread,
Jun 15, 2021, 4:58:48 AMJun 15
to sage-support
The following code write a system of inequations

x = vector(SR, SR.var('x_', 7))
A = random_matrix(SR,7,7)
b = random_vector(SR,7)
o = zero_vector(SR,7)
Z=[SR(A[i]*x-b[i])<=SR(o[i]) for i in range(A.nrows())]
SR(x[1]).variables()[0]
Sol=[solve(SR(Z[i]),SR(x[2]).variables()[0])[1] for i in range(len(Z)-1)]
Sol_inf=[y[0].lhs() for y in Sol if y[0].rhs() == x[2]]
Sol_sup=[y[0].rhs() for y in Sol if y[0].lhs() == x[2]]
Sol_ind=[y[0].lhs()<=0 for y in Sol if y[0].rhs() != x[2] and y[0].lhs() != x[2]]
#result=[[Sol_sup[i].lhs()<= Sol_inf[j].rhs() for i in range(len(Sol_ind))]
#for  j in range(len(Sol_sup))]
#show(result)
show(Sol_inf)
show(Sol_sup)
result=flatten(Sol_ind+[[Sol_inf[i]-Sol_sup[0] <=0 for i in range(len(Sol_inf))] for i in range(len(Sol_sup))])
result

I would like to transform in a matricial system of either the form A*x+b <= 0 or (A, b). I think I have all the elements do do that in an answer of Tmonteil to a question already ask. But unfortunately 'Ask Sagemath' is down.

Thanks

Dima Pasechnik

unread,
Jun 15, 2021, 5:02:30 AMJun 15
to sage-support
Just checking - are you aware of Sage's functionality to deal with constructing of polyhedra by linear inequalities and equations? It seems you are trying to do the same, but in a rather inefficient way.

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/245302733.2807007.1623747522333.JavaMail.zimbra%40univ-orleans.fr.

cyrille....@univ-orleans.fr

unread,
Jun 15, 2021, 5:26:30 AMJun 15
to sage-support
Yes I am aware of it and also use it. What I need is a step by step  Fourier Motzkin decomposition. It's for teaching reasons. I want also be able to draw the projections implied by it from 3D to 2D and 1D. Then I plot it in Asymptote (because on html it has latex label even in 3D, which is not the case of Sagemth).


De: "Dima Pasechnik" <dim...@gmail.com>
À: "sage-support" <sage-s...@googlegroups.com>
Envoyé: Mardi 15 Juin 2021 11:02:14
Objet: Re: [sage-support] Matricial conversion of a system of inequations.

Reply all
Reply to author
Forward
0 new messages