# Simplifying the output to Reduce

I am trying to solve a system of inequalities in Mathematica using Reduce:

u1 = -((b + β + a1)/((b + β) rμ));
u2 = -((μ a2)/((1 + b μ + β μ) rμ)); Reduce[
Abs[1 + rμ u1] > Abs[rμ u2] &&
b > 0 && β > 0 && μ > 0 && 0 < rμ <= 1 &&
Abs[u1] >= 1 && a1 > 0, {a1, a2}, Reals]


with the output:

β > 0 && b > 0 && 0 < rμ <= 1 && μ > 0 &&
a1 > 0 && (-a1 - a1 b μ - a1 β μ)/(
b μ + β μ) < a2 < (
a1 + a1 b μ + a1 β μ)/(b μ + β μ)


(Also see the screenshot)

Note that the simplest way of expressing a2 to a human perhaps would be:

-a1 (1 + 1/((b + β) μ)) < a2 <
a1 (1 + 1/((b + β) μ))


i.e.,

Is there a systematic way to express the output to Reduce in a more simplified format as shown above? Any tips/suggestions will be much appreciated!

Clear["Global*"]

u1 = -((b + β + a1)/((b + β) rμ));
u2 = -((μ a2)/((1 + b μ + β μ) rμ));

sol = Reduce[
Abs[1 + rμ u1] > Abs[rμ u2] &&
b > 0 && β > 0 && μ > 0 && 0 < rμ <= 1 &&
Abs[u1] >= 1 && a1 > 0, {a1, a2}, Reals]

(* β > 0 && b > 0 && 0 < rμ <= 1 && μ > 0 &&
a1 > 0 && (-a1 - a1 b μ - a1 β μ)/(
b μ + β μ) < a2 < (
a1 + a1 b μ + a1 β μ)/(b μ + β μ) *)

Collect[FullSimplify /@ sol[[-1]], a1]

(* a1 (-1 - 1/((b + β) μ)) < a2 <
a1 (1 + 1/((b + β) μ)) *)

• Thanks so much, Bob!
– TDH
Commented Aug 29, 2021 at 15:09
• @Bob Hanlon Bob, what do you do to make the Greek letters, rather than [Beta] and alike in the StackExchange? Commented Aug 29, 2021 at 15:47
• I used this link for additional buttons for the MSE editor. I use Chrome browser. Commented Aug 29, 2021 at 15:55

Try the following. This is your system:

u1 = -((b + \[Beta] + a1)/((b + \[Beta]) r\[Mu]));
u2 = -((\[Mu] a2)/((1 + b \[Mu] + \[Beta] \[Mu]) r\[Mu]));

sys1 =
Reduce[Abs[1 + r\[Mu] u1] > Abs[r\[Mu] u2] &&
b > 0 && \[Beta] > 0 && \[Mu] > 0 && 0 < r\[Mu] <= 1 &&
Abs[u1] >= 1 && a1 > 0, {a1, a2}, Reals];


Step1:

sys2 = MapAt[Apart[Simplify[#]] &, sys1, {6}]

(*  \[Beta] > 0 && b > 0 && 0 < r\[Mu] <= 1 && \[Mu] > 0 &&
a1 > 0 && -a1 - a1/((b + \[Beta]) \[Mu]) < a2 <
a1 + a1/((b + \[Beta]) \[Mu])   *)


Step 2:

sys3 = sys2 /.
a_/((b + \[Beta]) \[Mu]) -> a*Hold[1/((b + \[Beta]) \[Mu])]

(*  \[Beta] > 0 && b > 0 && 0 < r\[Mu] <= 1 && \[Mu] > 0 &&
a1 > 0 && -a1 - a1 Hold[1/((b + \[Beta]) \[Mu])] < a2 <
a1 + a1 Hold[1/((b + \[Beta]) \[Mu])]  *)


Step 3:

MapAt[Factor, sys3, {{6, 1}, {6, 5}}] // ReleaseHold

(*  \[Beta] > 0 && b > 0 && 0 < r\[Mu] <= 1 && \[Mu] > 0 &&
a1 > 0 && -a1 (1 + 1/((b + \[Beta]) \[Mu])) < a2 <
a1 (1 + 1/((b + \[Beta]) \[Mu]))   *)


Done. Have fun!

• Thanks so much, Alexei!
– TDH
Commented Aug 29, 2021 at 15:09

If result is the result of your Reduce[..], then try this:

Map[FullSimplify, result, {2}]


I'm not sure why you want to get rid of some of the conditions. It could be done by deleting the inequalities that do not contain {a1, a2} or just a2:

DeleteCases[%, i_ /; FreeQ[i, a1 | a2]] (* or just FreeQ[i, a2] *)


Notes: The argument {a1, a2} to Reduce in the OP means that each solution will have a form in an order with a1 and a2 coming last:

conditions && Inequality[..., a1,...] && Inequality[..., a2,...]


If there are multiple solutions, it will have a form like sol1 || sol2 || ..., but And and Or will be nested in a way so that the repetition of conditions will be somewhat minimized. The irregular nesting makes the form somewhat difficult to postprocess programmatically. Usually LogicalExpand[result] yields a matrix-like structure:

Or[
And[cond1, i11, i12,...],
And[cond2, i21, i22,...],
...
]


However, it often happens that some of the solutions can be combined to a simpler form. For instance, conditions over circle are often split into semicircles and sometimes into open semicircles and their endpoints (4 pieces). This is an artifact of the algorithm and sometimes not strictly necessary. It can be hard to combine them, except by hand.

P.S. If this particular problem is the only such problem you face, then copying the code typed in the OP is the easiest solution, -a1 (1 + 1/((b + β) μ)) < a2 < a1 (1 + 1/((b + β) μ)). I can see no reason for doing a lot of work just to get Mathematica to give a human-optimal solution when typing it out is so easy, especially when it's programmed to produce computation-oriented solutions.

P.P.S More work, simpler result:

Map[FullSimplify[#,
TransformationFunctions ->
{Automatic, Factor, -Simplify[-#] &}] &,
result, {2}]
`