-
-
Couldn't load subscription status.
- Fork 683
Open
Description
Equations and relations should behave like this:
equations:
(a==b) +-*/ csame as:(a==b).add_to_both_sides(c)(a==b).subtract_from_both_sides(c)(a==b).multiply_both_sides(c)(a==b).divide_both_sides(c)Falseif*/0
(a==b)^c-->a^c == b^cf(a==b)-->f(a)==f(b)
relations:(a<b) +- csame as:(a<b).add_to_both_sides(c)(a<b).subtract_from_both_sides(c)
(a<b) */ csame as:a*/c > b*/cforcreal and negative, or ifcis assumed negativea*/c < b*/cforcreal and positive, or ifcis assumed positiveFalseifc=0or assumed zero- if
ccontains variables (and no assumptions exist about it) raiseArithmeticError: missing assumption: is ...>0? - if
ccontains no variablesArithmeticError: multiplication of inequality with irreal
(a<b)^c-->(a<b)^cf(a<b)-->f(a<b)
Original 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)
```
CC: @kcrisman
Component: **symbolics**
Keywords: **inequality, solver, maxima**
Author: **Burcin Erocal, Ralf Stephan**
Branch/Commit: **[u/rws/7660-1](https://github.com/sagemath/sagetrac-mirror/tree/u/rws/7660-1) @ [`37c5190`](https://github.com/sagemath/sagetrac-mirror/commit/37c5190e9fdc3a6195a564fd3e61f2eaa06bb892)**
_Issue created by migration from https://trac.sagemath.org/ticket/7660_