# How to transform a derived set of inequation in the good polyhedron format

This is a follow-up to:

- Ask Sage question 57318: Use solve with inequality extracted from polytope
- Ask Sage question 57359: Symbolic expression not scriptable in Solve
- Ask Sage question 57364: Inequation solution doesn't isolate the operational variable

Applying this code

```
def one_dimension_less(representationH):
x = list(var('x_%i' % i) for i in (0..2))
sol = [solve_ineq(ieq, [x[0]]) for ieq in Ineq]
sol_r = flatten([x[1] for x in sol])
ineq_ge = [z for z in sol_r if z.rhs() == x[0]]
ineq_le = [z for z in sol_r if z.lhs() == x[0]]
ineq_a = [z for z in sol_r if z.lhs() != x[0] and z.rhs() != x[0]]
ineq_aa = [(z.lhs()).full_simplify() >= 0 for z in ineq_a]
result = flatten(ineq_aa + [
[(ineq_le[j].rhs()-ineq_ge[i].lhs()).full_simplify() >= 0
for i in range(len(ineq_ge))]
for j in range(len(ineq_le))])
# result1 = [result[i].factor() for i in range(len(result))]
return result
```

to

```
D = polytopes.dodecahedron()
DH = D.Hrepresentation()
```

with

```
PD1 = one_dimension_less(DH)
show(PD1)
```

I can eliminate one variable and obtain a set of inequalities defining a polyhedron in a lower dimension (here I go from 3 to 2 but it can be higher.

For each `x in PD1`

, I can isolate its right hand side but I don't
know how to isolate the parameters in such a way to write it as

```
sage: Polyhedron(ieqs=[(0, 1, 0), (0, 0, 1), (1, -1, -1)]).Hrepresentation()
(An inequality (-1, -1) x + 1 >= 0,
An inequality (1, 0) x + 0 >= 0,
An inequality (0, 1) x + 0 >= 0)`
```

the lists needed to feed `ieqs`

in `Polyhedron`

. How to do that?

Please, when asking a question, check that copying and pasting the provided code in a fresh Sage session allows to reproduce the behaviour you are asking about.

When running the code provided, I get

For convenience, I added links to the stream of questions this is part of.

Maybe you meant this:

Slelievre I am sincerely sorry for Ineq. Jupyter keep in memory the first tries and as the command was working I have not been enough vigilent. From now on, I will try to restard the kernel before sending a question.