-
-
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
Doctest: Immediate simplifications of symbolic powers #14305
Comments
This comment has been minimized.
This comment has been minimized.
comment:2
This is the problem.
Except this was not exposed before, apparently - it is the case in older Sage as well. This is due to #12780. |
comment:4
By the way, I should point out that Maxima folks probably won't consider this a bug, for the same reasons as discussed in the past on other tickets, and expressed best by Richard Fateman here. But if we don't want this, we'll have to figure out how to deal with this.
I've also posted a comment there, hopefully mjo or someone else will respond. |
comment:5
any news on this ticket? Paul |
comment:6
Jeroen asked a similar question a few months ago: https://groups.google.com/forum/?fromgroups=#!topic/sage-support/jhCJujRtNA4/discussion Maxima should notice that
It sucks that you have to do that, and we should really add either a global method or a property of A better approach would be to notice when an expression contains only real variables, and to set the simplification domain appropriately. This could be done in either Maxima or Sage (pynac/ginac), but probably belongs in both. Symbols in sage have an associated domain, too:
This never passes through Maxima, so arguably, Sage should simplify it if we can convince Maxima to do the same thing. But it's not at all easy to determine whether an expression is real; otherwise, I would have written it a long time ago! I mainly work over the reals myself and would love to have a solution that doesn't involve manually fooling with Maxima. |
comment:7
before #12780, the default domain was 'real', and After #12780, the default domain is that of Maxima (which is 'complex' in Sage 5.9), and I believe the authors of #12780 should fix that issue. Paul |
comment:8
Replying to @zimmermann6:
This isn't true. Before #12780, the domain everywhere in Sage except the There is no simplification of I realize there's no other nice way to get the answer you want (that sucks, I want it too, it's not my fault, etc.), but that's not a good justification for adding back wrong behavior. |
comment:9
Replying to @orlitzky:
I'm not sure you can dispose of the problem just by declaring it invalid. We do accept |
comment:10
We also accept I'm not disagreeing that there should be an easy way to do this. Maxima should just simplify it when A second step would be to have ginac or pynac perform the same simplification on expressions of the simple form Finally (this is the most work), Maxima could be made to recognize when an expression |
comment:11
Please take a look at #14630 which provides an easy way to get this simplification. |
comment:12
Thanks, that looks like a good step to take. Am I correct in saying it doesn't fix the point Nils makes about |
comment:13
Replying to @kcrisman:
Correct, #14630 just provides a way to get the simplification in the description, as an alternative to setting the Maxima domain manually. |
comment:15
while trying to see how we could tell Maxima that
but the same works without
and again it works without
Paul |
comment:16
Interesting. Maybe that is a function of having upgraded Maxima or something? I presume that this wasn't the case at some time, but presumptions can be presumptuous. |
comment:17
maybe Paul |
comment:18
No, that is not it -
Sorry, that would have been easier to deal with. I particularly don't like the |
comment:19
I remember the first example, from #12845. This is the full test:
The assumptions aren't needed for the first result, but they are for the last one (the norm of the vector). The |
comment:20
maybe then the first test could be removed, if unrelated to Anyway the following is very annoying:
Paul |
comment:21
Wow, agreed. Unfortunately, Maxima needs to declare this.
I guess a possible workaround would be to have all SR variables declared |
comment:22
Turns out that it's possible to get all variables used so far in Maxima with
Anyway, I really don't want to go back to assuming things in Maxima on every variable defined in Sage (or even every SR variable) but I think we might have to go that way. Maybe there is a flag we could set as an underscore attribute in the SR vars indicating whether it has been declared complex in Maxima yet, which would be dealt with appropriately for ones which aren't complex, or have been assumed real, etc. - i.e., the next time one went into Maxima, they would be in a queue that was then declared complex. Not sure how hawkish that would be, but hopefully at least not slowing down Pynac variables appreciably. |
comment:23
indeed, maybe we could declare each new variable as complex whenever
Maybe we can add a call to Paul |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Reviewer: Jeroen Demeyer |
comment:39
Thanks. |
comment:40
I wonder why |
comment:41
try |
comment:42
|
comment:43
I don't get this. Why should it matter whether Why is it valid to say that |
comment:44
I opened pynac/pynac#283 |
comment:45
z1/n for z a complex number is defined as the principal branch, which is that having the least argument, see for example https://en.wikipedia.org/wiki/Nth_root. Thus the square root of -1 is I, having argument pi/2, whereas -I has argument 3*pi/2. The cube root of -1 is 1/2 + I*sqrt(3)/2, having argument pi/3. |
comment:46
Replying to @zimmermann6:
One or three cube roots of -1 exist? |
comment:47
there are three complex numbers I recommend reading the paper "Branch Cuts in Computer Algebra" by Adam Dingle and Richard Fateman. |
comment:48
Replying to @zimmermann6:
I'm not evaluating numerically, |
comment:49
I mean why do I even argument, Jeroen is a better math, so I trust him when he objects. |
comment:50
Paul, maybe the problem is that you transfer the fact that RR is in CC to that "expressions with real variables" behave like "expressions with complex variables"? |
comment:51
Replying to @rwst:
Not sure why you say that. I understand Paul's reasoning. It's hard to tell who is right. If only variables have a domain (as opposed to constants), then |
comment:52
A complex function is not necessarily a complex-variable function, that's maybe the mistake I made. |
comment:53
indeed we cannot know in advance whether |
comment:54
This is messy largely because we have never decided on what
etc. If you ask five different people, you'll get five different answers. I'm wary of any "simplification" that might return an incorrect result to any of those people: simplification should be unambiguous and obviously correct. Any other more-powerful but less-straightforward operation should be called something else, like we've done with |
comment:55
Replying to @rwst:
I just reread that and yes I forgot to add "than me", opening unintended interpretations. |
comment:56
Correct, this whole thread is exactly the same thing. Basically, is |
Changed branch from u/rws/clarify_assumptions_and_domains_in_maxima to |
in Sage 5.7 we get:
This is wrong (consider x=-1 for example). Even:
Previously it was
Note: this invalidates a whole part of our book (in french) about Sage at
http://sagebook.gforge.inria.fr/
Depends on #23325
CC: @orlitzky @burcin @rwst
Component: calculus
Author: Ralf Stephan
Branch/Commit:
e5d5ba0
Reviewer: Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/14305
The text was updated successfully, but these errors were encountered: