# Inequation solution doesn't isolate the operational variable

This is a follow-up to

One more time I encounter a problem I cannot find a solution by myself. In the following code:

D = polytopes.dodecahedron()
DH = D.Hrepresentation()
x = list(var('x_%i' % i) for i in (0..2))
# show(DH)
Ineq=[[el.A()*vector(x) >= -el.b()] for el in DH]
# show(Ineq)
sol = [solve(ieq[0], x[0]) for ieq in Ineq]
sol1 = [el[1] for el in sol]
show(sol1)


when ieq[0] doesn't depend on x[0], sol1 is returned as entered. It's perfectly normal. But I ask to solve on x[0]. Many answers do not isolate x[0] (for instance, it is the case for sol[2]) which is what I ask for. How can I code in such way that SageMath does it by default?

edit retag close merge delete

Sort by ยป oldest newest most voted

Instead of using solve, you could use solve_ineq which is more appropriate. So, you can replace:

sol=[solve(ieq[0],x[0]) for ieq in Ineq]


with

sol=[solve_ineq(ieq,[x[0]]) for ieq in Ineq]

more

Tmontheil Thanks.

( 2021-05-30 21:44:07 +0100 )edit