Changes between Version 2 and Version 3 of Ticket #7660


Ignore:
Timestamp:
05/06/11 22:57:59 (11 years ago)
Author:
tnv
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7660 – Description

    v2 v3  
    1 Just wondering if there's any update to this issue ?  I think this behavior is related to the problem in
    2 http://trac.sagemath.org/sage_trac/ticket/11309
     1From the following sage-devel thread:
     2 
     3http://groups.google.com/group/sage-devel/t/951d510c814f894f
     4 
     5 
     6Arithmetic with inequalities can be confusing, since Sage does nothing to keep the inequality ``correct``. For example:
     7 
     8{{{
     9On Thu, 10 Dec 2009 00:37:10 -0800 (PST)
     10        "marik@mendelu.cz" <marik@mendelu.cz> wrote:
     11         
     12        > sage: f = x + 3 < y - 2
     13        > sage: f*(-1)
     14        > -x - 3 < -y + 2
     15        }}}
     16         
     17        It seems MMA doesn't apply any automatic simplification in this case:
     18         
     19        {{{
     20        On Thu, 10 Dec 2009 09:54:36 -0800
     21        William Stein <wstein@gmail.com> wrote:
     22         
     23        > Mathematica does something weird and formal:
     24        > 
     25        > In[1]:= f := x+3 < y-2;
     26        > In[3]:= f*(-1)
     27        > Out[3]= -(3 + x < -2 + y)
     28        }}}
     29         
     30        Maple acts more intuitively, though the way ``formal products`` are printed leaves something to be desired, IMHO:
     31         
     32        {{{
     33        On Thu, 10 Dec 2009 14:15:53 -0800
     34        William Stein <wstein@gmail.com> wrote:
     35         
     36        > Here is what Maple does:
     37        > 
     38        > flat:release_notes wstein$ maple
     39        >     |\^/|     Maple 13 (APPLE UNIVERSAL OSX)
     40        > ._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple
     41        > Inc. 2009 \  MAPLE  /  All rights reserved. Maple is a trademark of
     42        >  <____ ____>  Waterloo Maple Inc.
     43        >       |       Type ? for help.
     44        > > f := x < y;   
     45        >                                   f := x < y
     46        > 
     47        > > f*(-3);   
     48        >                                   -3 y < -3 x
     49        > 
     50        > > f*z;   
     51        >                                   *(x < y, z)
     52        > 
     53        > > f*a;   
     54        >                                   *(x < y, a)
     55        }}}
     56         
     57         
     58        We should multiply both sides of the inequality only if the argument is a real number (as opposed to a symbol with real domain), and invert the relation when the argument is negative.
     59         
     60        Note that GiNaC leaves everything formal, like MMA, by default:
     61         
     62        {{{
     63        ginsh - GiNaC Interactive Shell (ginac V1.5.3)
     64          __,  _______  Copyright (C) 1999-2009 Johannes Gutenberg University Mainz,
     65         (__) *       | Germany.  This is free software with ABSOLUTELY NO WARRANTY.
     66          ._) i N a C | You are welcome to redistribute it under certain conditions.
     67        <-------------' For details type `warranty;'.
     68         
     69        Type ?? for a list of help topics.
     70        > f= x < y;
     71        x<y
     72        > f*-1;
     73        -(x<y)
     74        > f*-5;
     75        -5*(x<y)
     76        > f*-z;
     77        -z*(x<y)
     78        > f*z;
     79        z*(x<y)
     80        }}}