I'm having a tough time dealing with inequalities.
in[]: -1 <= x // InputForm
out[]: -1 <= x
in[]: -1 <= x <= 1/2 // InputForm
out[]: -1 <= x <= 1/2
So far so good, but the problem is:
in[]: -1 <= x < 1/2 // InputForm
out[]: Inequality[-1, LessEqual, x, Less, 1/2]
Why this format ?, why such an Inequality[]
function shows up ? It looks like a FullForm
and not InputForm
!
How to deal prevent with this behavior ? How to get a more consistent .. < .. < .. format ?
I tried to workaround and split the Inequality but I do not really want this output...
in[]: Reduce`InequalityExpand[-1 <= x < 1/2] // InputForm
out[]: -1 <= x && x < 1/2
I also tried an awful
in[]: -1 <= x < 1/2 // InputForm /. {Inequality -> List, LessEqual -> "<=", Less -> "<", Greater -> ">", GreaterEqual -> ">="}
out[]: {-1, "<=", x, "<", 1/2}
But I do not know how to adequately concatenate this list.
NB : InputForm matters for me, I'd like to get this one line output.
<
and<=
, is to useInequality
. That's a design choice you cannot overcome, I think. Unfortunately,Inequality[0, Less, x]
evaluates toLess[0, x]
, so you cannot put all inequalities into a consistentInequality[..]
form. (You can expand them, as you point out, but you seem reluctant to deal with that.) I've had to "deal" with this, too, but I don't know if it's the same as your case (see Szabolcs' comments). $\endgroup$InputForm
is notFullForm
, and Mathematica outputsFullForm
in these cases. For me it's a problem, I cannot give you more details... $\endgroup$