10
$\begingroup$
In[1]:= Simplify[x<0, x<0]                                                      

Out[1]= True

In[2]:= Simplify[x<0, {x,y}<0]                                                  

Out[2]= x < 0

In[3]:= $Version                                                                

Out[3]= 11.1.0 for Linux x86 (64-bit) (March 13, 2017)

I always thought {x,y}<0 meant the same thing as {x<0, y<0}, but, per In[2] above, this doesn't appear to be the case. Does {x,y}<0 have a useful meaning or am I seeing a bug in Mathematica?

$\endgroup$
  • 7
    $\begingroup$ I've always understood {x, y} < 0 to be nonsense. $\endgroup$ – Michael E2 Feb 6 '18 at 2:53
  • 2
    $\begingroup$ Simplify[x < 0, Thread[{x, y} < 0]] $\endgroup$ – Bob Hanlon Feb 6 '18 at 4:06
  • 4
    $\begingroup$ Listable inequalities are possible with Positive, Negative, etc.: Simplify[x < 0, Negative[{x, y}]]. $\endgroup$ – Michael E2 Feb 6 '18 at 12:39
13
$\begingroup$

From the documentation:

Less gives True or False when its arguments are real numbers.

Regardless of what x or y are, it is clear that {x,y} is not a real number, so Less doesn't do anything with it (for the most part, some simplifications may still be performed). Note that other functions may also treat {x,y}<0 specifically, and that you can specifically define patterns that take advantage of this form. By itself though, Less is not listable, and does not expand in any way into the list. This is not a bug, just the nature of its definition.

As noted by Bob Hanlon in the comments, Thread can be used to turn {x,y}<0 into {x<0,y<0} which is well-defined as a list of inequalities.

$\endgroup$
13
$\begingroup$

Generally, this is an invalid use of <. Both the left and the right-hand side should be expressions representing real numbers.

However, there are a few special cases where Mathematica will accept a list with <, ==, >, such as

Solve[{x, y} < 2 && y == x^2]
(* {{y -> ConditionalExpression[x^2, -Sqrt[2] < x < Sqrt[2]]}} *)

This may have given you the impression that it is generally okay to use < this way. This is not the case though.

$\endgroup$
  • 3
    $\begingroup$ One can also use Solve[{{x, y} < {1, 2}, y == x^2}], since Solve and Reduce apply Thread to (in)equalities that have a list as an argument. $\endgroup$ – Michael E2 Feb 6 '18 at 15:00
5
$\begingroup$

Writing something like Simplify[x<0,x<0] returns True because the second argument to Simplify is interpreted as an Assumption that is considered to be true.

Had the second argument been eg x==1, evaluating the preceding code segment would produce False; that result is not unexpected, since assuming that the value of x is equal to 1 (a positive number), the truth-value of x<0 is expected to be False.

Now, when Mathematica evaluates {x,y}<0, it returns the same expression (provided that there are no other rules related to symbols x and y). This should not be surprising; it happens because Less[List[x,y],0] (which is the FullForm equivalent expression of {x,y}<0) is a valid Wolfram Language expression like eg x>0; evaluating x>0 also returns x>0 (again assuming no rules are attached to symbol x beforehand).

An expression like {x,y}<0 might anticipate an evaluation result like {x<0,y<0}, but such an expectation is not warranted. The function (or 'operator') Less does not thread over its arguments (as has already been pointed out by other answers) much as some numeric functions like eg Exp or Log do. Evaluating Attributes[Exp] or Attributes[Log] should return a list of the attributes attached to each symbol; in the case of eg Log it returns {Listable, NumericFunction, Protected}; the presence of Listable in the Attributes list of Log 'allows' the user to expect that eg Log[{0,1}] will evaluate to {-Infinity, 0}.

The evaluation of {x,y}<0 does not return what's anticipated, because Less is not Listable.

What this means for the question at hand, is that when Simplify is presented with an Assumption that does not evaluate to a relevant relation (it simply reads Less[List[x,y],0]) for the expression it is expected to simplify-x<0 in this case-it returns the best result it can deliver ie x<0, which-in this case-is the same expression it was presented with, in the first place.

This result is equivalent to eg Simplify[x<0,y<0]; again, in this case, too, the Assumption does not assist in simplifying the expression passed as a first argument to Simplify.

$\endgroup$
3
$\begingroup$

There is an even more weird thing:

Reduce[{x,y}<0,{x,y}]

gives x<0 && y<0.

$\endgroup$
  • $\begingroup$ Can you elaborate on why you believe this to be a weird result? $\endgroup$ – J. M. is away Oct 17 '18 at 9:57
2
$\begingroup$

You can make it work if you set Listable attribute for Less (<) first:

SetAttributes[Less, Listable]
Simplify[x < 0, {x, y} < 0]
(* True *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.