-
-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arithmetic with equations and inequalities confusing #7660
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:5
this is quite dangerous (I encountered it as a bug in a project). Hopefully someone will try to fix this soon. Could it be related to this #11309 ? |
comment:6
I propose the following: |
comment:7
Given the ticket description details above and the discussion at #11309 and here, I think that Burcin's original proposal of
|
comment:8
It doesn't seem at all reasonable to me to distribute multiplication over a relation. When you distribute multiplication over addition, the addition expression There is no mathematical rationale for saying that If we allow multiplication to distribute over I think the most sensible answer to all the above questions is the following: we should not perform arithmetic on relational expressions; when asked to do so, we should return a purely formal expression. If the title of this ticket disagrees with that answer, I can make another ticket to implement it, but I'm just wondering if anyone disagrees with me strongly about this. |
comment:9
Well, we could go to the !Ginac/Mathematica way too, instead of the Maple way. But now that #11309 is on the way in, probably it's time to deal with this. FWIW, Maxima seems to go that way as well.
Maybe Burcin has a comment; I don't have that strong of feelings, though I'm partial to
|
comment:10
Honestly I thought the most likely response would be And if None of this makes any sense, IMHO. I think it would be best to go the Mathematica/GiNaC/Maxima way, as shown in your Maxima output, rather than the Maple way. |
comment:11
For the record, Maxima has a share package which implements arithmetic on inequalities.
I gather that's similar to what Maple does. |
prototype patch |
comment:12
Attachment: trac_7660-inequality_arithmetic.patch.gz attachment: trac_7660-inequality_arithmetic.patch comments out a few lines in Quite a few doctests and some documentation will have to change to match this new design decision. I'd like to make sure we agree on the behavior before trying to produce a clean patch. Of course, I'd appreciate help with the documentation in any case. |
comment:15
OK that patch applies cleanly with
I refrained from starting any doctests. |
Branch: u/rws/ticket/7660 |
Commit: |
Changed keywords from none to inequality, solver, maxima |
New commits:
|
comment:18
Here are the statements sent via Before:
After:
Apparently, Sage's last statement sent is the result itself (no idea why), and maxima then barfs because it can't digest its own output. In maxima:
In summary there are three problems:
So maxima refuses to handle the formal expression generated by this patch, and this means they cannot be solved, regardless of method called. So, in addition,
|
Work Issues: fix bug |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:61
does not apply |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:64
does not apply |
comment:65
In the course of this ticket already 12 merge commits were added. The branch has 8 so I'm doing a squash. |
Changed branch from public/7660 to u/rws/7660-1 |
New commits:
|
comment:68
does not apply |
Branch pushed to git repo; I updated commit sha1. New commits:
|
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
same as:(a<b).add_to_both_sides(c)
(a<b).subtract_from_both_sides(c)
(a<b) */ c
same as:a*/c > b*/c
forc
real and negative, or ifc
is assumed negativea*/c < b*/c
forc
real and positive, or ifc
is assumed positiveFalse
ifc=0
or assumed zeroc
contains variables (and no assumptions exist about it) raiseArithmeticError: missing assumption: is ...>0?
c
contains no variablesArithmeticError: multiplication of inequality with irreal
(a<b)^c
-->(a<b)^c
f(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:The text was updated successfully, but these errors were encountered: