id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
7660 arithmetic with equations and inequalities confusing burcin burcin "Equations and relations should behave like this:
equations:
* `(a==b) +-*/ c` same 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)`
- `False` if `*/0`
* `(a==b)^c` --> `a^c == b^c`
* `f(a==b)` --> `f(a)==f(b)`
relations:
* `(a** b*/c` for `c` real and negative, or if `c` is assumed negative
- `a*/c < b*/c` for `c` real and positive, or if `c` is assumed positive
- `False` if `c=0` or assumed zero
- if `c` contains variables (and no assumptions exist about it) raise `ArithmeticError: missing assumption: is ...>0?`
- if `c` contains no variables `ArithmeticError: multiplication of inequality with irreal`
* `(a**** `(a**** `f(a**** 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 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 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 f*-1;
-(x f*-5;
-5*(x f*-z;
-z*(x f*z;
z*(x**