Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 07f12cd

Browse files
committed
16397: restore transitivity
1 parent 24450f8 commit 07f12cd

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/sage/symbolic/comparison.pyx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,18 @@ class _mixed_key(object):
315315
True
316316
"""
317317
from sage.rings.real_mpfi import RIF
318-
if len(self.ex.variables() + other.ex.variables()) > 0:
319-
return _print_key(self.ex) < _print_key(other.ex)
318+
selfv = len(self.ex.variables())
319+
otherv = len(other.ex.variables())
320+
if selfv:
321+
if otherv:
322+
return _print_key(self.ex) < _print_key(other.ex)
323+
else:
324+
return False
325+
else:
326+
if otherv:
327+
return True
320328

329+
# no variables involved from here on
321330
rel = self.ex < other.ex
322331
if (self.ex.is_infinity() or other.ex.is_infinity()):
323332
pynac_result = decide_relational((<Expression>rel)._gobj)
@@ -379,7 +388,7 @@ cpdef mixed_sorted(expressions):
379388
380389
sage: from sage.symbolic.comparison import mixed_sorted
381390
sage: mixed_sorted([SR(1), SR(e), SR(pi), sqrt(2), x, sqrt(x), sin(1/x)])
382-
[sin(1/x), 1, sqrt(2), e, sqrt(x), x, pi]
391+
[1, sqrt(2), e, pi, sin(1/x), sqrt(x), x]
383392
"""
384393
return sorted(expressions, key=_mixed_key)
385394

0 commit comments

Comments
 (0)