Joining two lists with relational operators
Thread[liste - listv <= 0] // Reduce
2 <= y <= 3 && z >= 4 && x <= 1
List @@ %
{2 <= y <= 3, z >= 4, x <= 1}
How do I reorder the inequities in an "alphabetic + numeric" order, such as
{2 <= x1 <= 3, x2 >= 4, z <= 1}
Assuming there is one variable per inequality and there are no different length variables, e.g. x, x1, x12
at once, then:
#[[Ordering[Cases[#, s_Symbol /; Context[s] =!= "System`", ∞] & /@ #]]] &[
{2 <= y <= 3, z >= 4, x <= 1}
]
{x <= 1, 2 <= y <= 3, z >= 4}
so at the end
Composition[
#[[
Ordering[
Cases[
#, s_Symbol /; Context[s] =!= "System`", ∞
] & /@ #
]
]] &,
Apply[List],
Reduce,
Thread
][liste - listv <= 0]
LessEqual @@@ Transpose@{l1, l2} // Reduce
2 <= y <= 3 && z >= 4 && x <= 1