-
-
Notifications
You must be signed in to change notification settings - Fork 561
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
behaviour of gamma strangely sensitive #10849
Comments
comment:1
I'm pretty sure this issue stems from comparison of number field elements. See #6132, #7160, #10064, and http://groups.google.com/group/sage-support/browse_thread/thread/28bbd04a78dadb57/01168722573ff736 |
comment:2
What weirds me out is the side-effect aspect: I could understand getting the same wrong answer, or different answers for equivalent but non-identical inputs, or even random behaviour. I don't see why the gamma(-x-1/2)*g call should change the state so that any element comparison would behave differently, but I understand exactly nothing about Sage internals at this level. |
comment:3
Mike is right and the patch at #10064 resolves this issue. The side effect is a result of GiNaC's reference counted pointers. Whenever two expressions compare equal, GiNaC frees the memory of one, and makes it a pointer to the other. In this example, it replaces
Of course there is a chance that this observation changed the result. :) For
|
This comment has been minimized.
This comment has been minimized.
Author: Burcin Erocal |
Dependencies: #7160 |
comment:5
This is fixed with the patch attached to #7160. Doctests are in attachment: trac_10849-doctests.patch. |
comment:6
I'll set this one to needs work because it depends on a ticket (#7160) that needs work, and it can't be reviewed before that one. |
comment:7
One can also give it positive review and set it to sage-pending like at #10064. That's a little more informative, anyway. |
comment:8
We'll still have to check whether the patch still applies cleanly when the other ticket has been merged (at which point a lot of unrelated changes may have made their way into Sage too). That would keep me from giving it the sort of preliminary positive review you suggest. But if what you're saying is the standard way of handling these things, then I'll raise no objection. |
comment:9
Replying to @tkluck:
Of course you're right! But at least this would mean that modulo those other changes, the patch does what it says. Otherwise we might lose the info of a positive review. How about I set it to sage-pending, and you set it to positive review if you feel that way? :-) |
Attachment: trac_10849-doctests-on_9880.patch.gz |
This comment has been minimized.
This comment has been minimized.
comment:10
Now that #7160 is fixed, this can be reviewed. Patchbot says that the old patch applies without problems on Sage 5.10.beta4 and passes tests. I am attaching a new patch that is rebased on #9880, since both tickets add doctests to the same function and I hope #9880 will go in before this one. :) |
Branch: u/rws/ticket/10849 |
comment:14
This is just a doctest which passes. New commits:
|
Commit: |
Reviewer: Ralf Stephan |
Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:
|
Changed branch from u/rws/ticket/10849 to |
Whether you get the correct result or a spurious ValueError in evaluating some gamma expressions depends upon things it shouldn't.
This comes from a sage-support thread; I looked and couldn't find it here, but possibly it's a duplicate. (I have bad luck with trac.)
See also this worksheet.
Here's a relatively simple test case, in 4.6.1 and 4.6.2.rc0:
That is, merely performing the should-be-irrelevant "gamma(-x-1/2)*g" op makes g(x=0) start working. Instrumenting it shows that that py_doublefactorial gets a -3 the first time instead of the 1 it does the second time, but I couldn't quite follow the calling order to isolate the error.
Apply attachment: trac_10849-doctests-on_9880.patch
Depends on #7160
Depends on #9880
CC: @kcrisman
Component: symbolics
Author: Burcin Erocal
Branch/Commit:
79a0ebd
Reviewer: Ralf Stephan
Issue created by migration from https://trac.sagemath.org/ticket/10849
The text was updated successfully, but these errors were encountered: