-
-
Notifications
You must be signed in to change notification settings - Fork 675
Closed
Milestone
Description
In the symbolic ring, cmp implements the print comparison which is probably not what you envisioned:
sage: cmp(1, sqrt(2)) # mathematically correct, uses rich comparison
-1
sage: cmp(SR(1), sqrt(2)) # unexpectedly, you get the print sort order
1
sage: cmp(log(8), 3*log(2))
-1
Everybody who coerces to same parents internally before comparing trips over this, for example the real lazy field:
sage: RLF(1) < RLF(sqrt(2))
False
This also makes RealSet
unusable with symbolics:
sage: RealSet((0, pi),[pi, pi],(pi,4))
[pi, 4)
sage: RealSet((0, pi),[0, pi],(pi,4))
[pi, 4)
sage: RealSet((0, pi),[0, 3.5],(pi,4))
(pi, 4)
CC: @videlec @mezzarobba @jpflori
Component: symbolics
Author: Volker Braun, Ralf Stephan
Branch/Commit: 07f12cd
Reviewer: Ralf Stephan, Volker Braun
Issue created by migration from https://trac.sagemath.org/ticket/16397