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.

On Tue, 15 Jun 2021, 09:58 cyrille.piate...@univ-orleans.fr, <
cyrille.piate...@univ-orleans.fr> wrote:

> 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
>
> --
> 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+unsubscr...@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
> <https://groups.google.com/d/msgid/sage-support/245302733.2807007.1623747522333.JavaMail.zimbra%40univ-orleans.fr?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAAWYfq0S9hzWF_ku%3DH1wfCTbAE0Dx7uo46Uce-WkF0SFGsoumw%40mail.gmail.com.

Reply via email to