so I'm trying to do the following starting from a list of inequalities:


I want to do the following:

convert the list of inequalities into a list of list


given some of the variable in the inequalities separate them form the others (ex c,d)


Could someone please help me? Thank you very much

in = {{a > b && b < c && c < 1}, {a < b && b < c && d < c && d < 1}};

in /. And -> (Sequence @@ GatherBy[{##}, FreeQ[c | d]] &)
{{{a > b}, {b < c, c < 1}}, {{a < b}, {b < c, d < c, d < 1}}}

The code above uses the v10 operator form for FreeQ; if you are using an earlier version replace FreeQ[c | d] with FreeQ[#, c | d] &.

  • $\begingroup$ @Yyrkoon You're welcome. Let me know if you need any part of this explained. $\endgroup$ – Mr.Wizard Feb 22 '15 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.