(1) FullForm[ 2<= x< =3] returns LessEqual[2,x,3]
while
(2) Reduce[ 2<=x && x<=3 ] returns 2 <= x <= 3 whose FullForm is
Inequality[2,LessEqual,x,LessEqual,3].
Any thoughts?
Jack
I sent this post to the two responders but thought it might be of interest
I use a transformations in some of my code that takes a <= x <= b
and converts it into a function I have defined called "characteristic
function" - the name is obviously irrelevant. But to make this
transformation I need to know what the FullForm is. If it (the
FullForm) varies from one command to another, how can I count on my
transformation working. For example, suppose a line in my Module
looks like this:
(1) "something"/.LessEqual[2,x,3] -> characteristic[x,2,3]
But if "something" contains the FullForm "Inequality[ ... ]" the
transformation explicit in (1) will fail.
I ran into this and found a simple work-around. However, it took me a
couple of hours to pinpoint the problem since it was imbedded in a
relatively long code.
Jack
They are equivalent:
Reduce[LessEqual[2, x, 3]] ===
Inequality[2, LessEqual, x, LessEqual, 3]
True
Bob Hanlon
---- Jack L Goldberg 1 <jack...@umich.edu> wrote:
=============
Hello
I would use LogicalExpand with your expressions. Then your three
expressions will all have the same FullForm.
(*This gives False*)
e1 = LessEqual[2, x, 3]; e2 = Inequality[2, LessEqual, x, LessEqual,
3]; e3 = 2 <= x && x <= 3;
SameQ[e1, e2, e3]
(*This gives True*)
e1L = LogicalExpand[e1]; e2L = LogicalExpand[e2]; e3L = LogicalExpand
[e3];
SameQ[e1L, e2L, e3L]
SameQ[e1L // FullForm, e2L // FullForm, e3L // FullForm]
I hope this helps.
Best Regards
Norbert Marxer