#16397: Symbolic cmp
-------------------------------------+-------------------------------------
       Reporter:  vbraun             |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  critical           |    Milestone:  sage-7.1
      Component:  symbolics          |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Volker Braun,      |    Reviewers:
  Ralf Stephan                       |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:  public/16397-1     |  06ea5a9957bcfd03fa1476f7651b2d9400e9e36b
   Dependencies:                     |     Stopgaps:  #19465
-------------------------------------+-------------------------------------
Description changed by rws:

Old 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
> }}}
> 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)
> }}}

New 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)
 }}}

--

--
Ticket URL: <http://trac.sagemath.org/ticket/16397#comment:25>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to