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