#7660: arithmetic with inequalities confusing
-------------------------+--------------------------------------------------
Reporter: burcin | Owner: burcin
Type: defect | Status: new
Priority: major | Milestone: sage-4.7
Component: symbolics | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
-------------------------+--------------------------------------------------
Description changed by tnv:
Old description:
> From the following sage-devel thread:
>
> http://groups.google.com/group/sage-devel/t/951d510c814f894f
>
> Arithmetic with inequalities can be confusing, since Sage does nothing to
> keep the inequality ``correct``. For example:
>
> {{{
> On Thu, 10 Dec 2009 00:37:10 -0800 (PST)
> "[email protected]" <[email protected]> wrote:
>
> > sage: f = x + 3 < y - 2
> > sage: f*(-1)
> > -x - 3 < -y + 2
> }}}
>
> It seems MMA doesn't apply any automatic simplification in this
> case:
>
> {{{
> On Thu, 10 Dec 2009 09:54:36 -0800
> William Stein <[email protected]> wrote:
>
> > Mathematica does something weird and formal:
> >
> > In[1]:= f := x+3 < y-2;
> > In[3]:= f*(-1)
> > Out[3]= -(3 + x < -2 + y)
> }}}
>
> Maple acts more intuitively, though the way ``formal products``
> are printed leaves something to be desired, IMHO:
>
> {{{
> On Thu, 10 Dec 2009 14:15:53 -0800
> William Stein <[email protected]> wrote:
>
> > Here is what Maple does:
> >
> > flat:release_notes wstein$ maple
> > |\^/| Maple 13 (APPLE UNIVERSAL OSX)
> > ._|\| |/|_. Copyright (c) Maplesoft, a division of Waterloo
> Maple
> > Inc. 2009 \ MAPLE / All rights reserved. Maple is a
> trademark of
> > <____ ____> Waterloo Maple Inc.
> > | Type ? for help.
> > > f := x < y;
> > f := x < y
> >
> > > f*(-3);
> > -3 y < -3 x
> >
> > > f*z;
> > *(x < y, z)
> >
> > > f*a;
> > *(x < y, a)
> }}}
>
> 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.
>
> Note that GiNaC leaves everything formal, like MMA, by default:
>
> {{{
> ginsh - GiNaC Interactive Shell (ginac V1.5.3)
> __, _______ Copyright (C) 1999-2009 Johannes Gutenberg
> University Mainz,
> (__) * | Germany. This is free software with ABSOLUTELY
> NO WARRANTY.
> ._) i N a C | You are welcome to redistribute it under certain
> conditions.
> <-------------' For details type `warranty;'.
>
> Type ?? for a list of help topics.
> > f= x < y;
> x<y
> > f*-1;
> -(x<y)
> > f*-5;
> -5*(x<y)
> > f*-z;
> -z*(x<y)
> > f*z;
> z*(x<y)
> }}}
New description:
From the following sage-devel thread:
http://groups.google.com/group/sage-devel/t/951d510c814f894f
Arithmetic with inequalities can be confusing, since Sage does nothing to
keep the inequality ``correct``. For example:
{{{
On Thu, 10 Dec 2009 00:37:10 -0800 (PST)
"[email protected]" <[email protected]> wrote:
> sage: f = x + 3 < y - 2
> sage: f*(-1)
> -x - 3 < -y + 2
}}}
It seems MMA doesn't apply any automatic simplification in this
case:
{{{
On Thu, 10 Dec 2009 09:54:36 -0800
William Stein <[email protected]> wrote:
> Mathematica does something weird and formal:
>
> In[1]:= f := x+3 < y-2;
> In[3]:= f*(-1)
> Out[3]= -(3 + x < -2 + y)
}}}
Maple acts more intuitively, though the way ``formal products``
are printed leaves something to be desired, IMHO:
{{{
On Thu, 10 Dec 2009 14:15:53 -0800
William Stein <[email protected]> wrote:
> Here is what Maple does:
>
> flat:release_notes wstein$ maple
> |\^/| Maple 13 (APPLE UNIVERSAL OSX)
> ._|\| |/|_. Copyright (c) Maplesoft, a division of Waterloo
Maple
> Inc. 2009 \ MAPLE / All rights reserved. Maple is a trademark
of
> <____ ____> Waterloo Maple Inc.
> | Type ? for help.
> > f := x < y;
> f := x < y
>
> > f*(-3);
> -3 y < -3 x
>
> > f*z;
> *(x < y, z)
>
> > f*a;
> *(x < y, a)
}}}
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.
Note that GiNaC leaves everything formal, like MMA, by default:
{{{
ginsh - GiNaC Interactive Shell (ginac V1.5.3)
__, _______ Copyright (C) 1999-2009 Johannes Gutenberg
University Mainz,
(__) * | Germany. This is free software with ABSOLUTELY NO
WARRANTY.
._) i N a C | You are welcome to redistribute it under certain
conditions.
<-------------' For details type `warranty;'.
Type ?? for a list of help topics.
> f= x < y;
x<y
> f*-1;
-(x<y)
> f*-5;
-5*(x<y)
> f*-z;
-z*(x<y)
> f*z;
z*(x<y)
}}}
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7660#comment:4>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.