I guess this is something easy that I'm overlooking is a clear sign of illiteracy, but anyway.
How is that
(Map[Sign, LessEqual[x, y]]) === LessEqual[Sign[x], Sign[y]]
-> True
But
(Map[Sign, LessEqual[-1, -100]]) == LessEqual[Sign[-1], Sign[-100]]
-> False
Using Trace on the lhs will help to show what has happened.
Trace[Map[Sign, LessEqual[-1, -100]]]
Out[2]= {{-1 <= -100, False}, Sign /@ False, False}
Notice that Map has no HoldXXX attributes.
Attributes[Map]
Out[3]= {Protected}
So the LessEqual evaluates before Map does anything. At which point you get
Map[Sign,False]
As False is an atomic expression, this just evaluates to False.
The rhs of course evaluates to True, since Sign[-1] and Sign[-100] are both -1.
Daniel Lichtblau Wolfram Research
Look what happens when you do it in two steps:
In[1]:= LessEqual[-1,-100]
Out[1]= False
In[2]:= Map[Sign, False]
Out[2]= False
The second result there may be surprising, but it happens to be how the Map
function works; if you use Map
on an expression with length 0 (like the symbol False
), it just returns that expression unchanged. Another example:
In[3]:= Map[f, "Pillsy"]
Out[3]= "Pillsy"
On the other hand, obviously
In[4]:= LessEqual[Sign[-1],Sign[-100]]
Out[4]= True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With