-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
What should be the definition of < or for that matter isless?
Right now, < is redundantly defined, as isless is defined. But it isn't clear they are correct.
The docstrings have:
<: Less-than comparison operator. Falls back to isless. Because of the behavior of floating-point NaN values, this operator implements a partial order. New types with a canonical partial order should implement this function .isless: Test whether x is less than y, according to a fixed total order (defined together with isequal). on-numeric types with a total order should implement this function. If isless(x, y) is defined, then so is isless(y, x) and isequal(x, y), and exactly one of those three yields true.isunordered: Return true if x is a value that is not orderable according to <, such as NaN or missing.
It seems that the definition of isless(x,y) = isless(N(x), N(y)) is incorrect. One could argue this defintion of < isn't. Perhaps we should have isunordered default to isreal(x). (But it seems isreal should check with is_constant and not is_a_Number.
Symbolics defines x < y to be a deferred symbolic comparison. In SymPy their is Eq to define such comparisons and < is defined for numbers, not variables. Being consistent with SymPy would leave < as is and removing isless.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels