# Regarding how to use Reduce

Say for example I am doing the following in Mathematica

Reduce[x1 >= 0 &&
-4*x1 <= 16 &&
4*x1 >= 16 ||
x1 <= 0 &&
4*x1 <= 16 &&
-4*x1 >= 16, {x1}]


This returns $x_1 \leq -4 \;\;||\;\; x_1 \geq 4$. How would I make Mathematica return the bounded parts of the region? I.e. is there some function I can do to these inequalities so that I can return -4 or 4. E.g. I can type bound1[system] and that gives -4, and then bound2[system] and that gives 4. Is that possible?

Thanks

Maybe something like this? I don't know if this is what you meant?

sol=Reduce[x1 >= 0 &&-4*x1 <= 16 &&4*x1 >= 16 ||x1 <= 0 &&4*x1 <= 16 &&-4*x1 >= 16, {x1}];
sol[[1, 2]]
(*-4*)
sol[[2, 2]]
(*4*)

• Amazing, that is quite cheeky just realized that what you have just shown me is that Mathematica can store solutions as strings and then you can manipulate each part of the solution separately and access the character? Am I right in assuming that? Aug 18, 2014 at 20:53
• you are quit correct. the solution is basically translated internally using what is called FullForm. if you want to get any thing, you need to know the level of that thing in the fullForm. you can assume things stored like if they were in lists and you need to know the position of that thing you want to extract. Aug 18, 2014 at 20:59
• I swear Mathematica is absolutely incredible... May have to apply to work there once I graduate... Aug 18, 2014 at 21:00
• @Kadir You should know that they're not really "strings" so to speak. They're Mathematica expressions. You can investigate results with FullForm (or TreeForm) and Part. Aug 18, 2014 at 22:16

I don't want to compete with Algohi's nice answer, but - as to my experience - Reduce can be almost always replaced with Simplify or FullSimplify:

res = Simplify[x1 >= 0 && -4*x1 <= 16 && 4*x1 >= 16 || x1 <= 0 && 4*x1 <= 16 && -4*x1 >= 16]

Cases[res, _?NumberQ, -1]


{-4, 4}

Here's another way (in M10 only):

Cases[
NumberLinePlot[x1 >= 0 && -4*x1 <= 16 && 4*x1 >= 16 || x1 <= 0 && 4*x1 <= 16 && -4*x1 >= 16, x1],
Point[{x_, _}] :> x, \[Infinity]
]

(* {-4, 4} *)