#10923 closed defect (fixed)
Bad sign in integral()
Reported by: | tmonteil | Owned by: | burcin |
---|---|---|---|
Priority: | major | Milestone: | sage-5.0 |
Component: | calculus | Keywords: | integral sd35.5 |
Cc: | mjo | Merged in: | sage-5.0.beta3 |
Authors: | Thierry Monteil, Michael Orlitzky | Reviewers: | Benjamin Jones, Karl-Dieter Crisman |
Report Upstream: | Fixed upstream, in a later stable release. | Work issues: | |
Branch: | Commit: | ||
Dependencies: | #12094 | Stopgaps: |
Description (last modified by benjaminfjones)
Here is the problem (tested on 4.6.2) :
sage: i = integral(e^(-1/x^2),x,0,1) sage: i.numerical_approx() -0.0890738558907803
This should be a positive number since the map is positive.
Apply:
- sage-trac_10923.patch to Sage library
Attachments (2)
Change History (24)
comment:1 Changed 4 years ago by kcrisman
comment:2 Changed 4 years ago by tmonteil
Thanks for reporting this to Maxima.
By the way, here is a direct link to the related maxima bug).
comment:3 Changed 4 years ago by kcrisman
- Report Upstream changed from N/A to Fixed upstream, but not in a stable release.
Apparently this is now fixed. See the bug report above.
So this will need a doctest when we upgrade our Maxima.
comment:4 Changed 4 years ago by tmonteil
As you suggested, i added a doctest to ensure that the correct integral is computed.
comment:5 Changed 4 years ago by kcrisman
- Status changed from new to needs_info
Great. Once we get a Maxima in with this, I'll be sure to review the patch :)
Putting as 'needs info' because of waiting for that, which will likely be a little while since we just upgraded.
comment:6 Changed 4 years ago by mjo
- Cc mjo added
- Dependencies set to #12094
- Report Upstream changed from Fixed upstream, but not in a stable release. to Fixed upstream, in a later stable release.
I've confirmed that this is fixed in maxima-5.24.0.
comment:7 Changed 4 years ago by kcrisman
- Keywords sd35.5 added
This does not apply on sage-4.8.alpha5. We just tried it at Sage Days 35.5.
comment:8 Changed 4 years ago by mjo
We don't get such a nice answer, anyway, so the doctest from the patch would fail. With maxima-5.24,
sage: integral(e^(-1/x^2),x,0,1).full_simplify() ((e*erf(1) - e)*sqrt(pi) + 1)*e^(-1)
I can update the patch; should we test that the numerical approximation is close to what it should be, or should we check for the symbolic result?
comment:9 Changed 4 years ago by kcrisman
So are you participating remotely at Sage Days 35.5?
We should probably test both, though of course this is not as pretty.
sage: ((e*erf(1) - e)*sqrt(pi) + 1)*e^(-1) ((e*erf(1) - e)*sqrt(pi) + 1)*e^(-1) sage: _.n() 0.0890738558907804
I never know what incomplete gamma is supposed to give in terms of "normal" functions.
comment:10 Changed 4 years ago by mjo
Is "participating remotely" the same thing as "goofing off at work"? If so, I'm doing it. One more question: is there a good way to test almost-equals, for the numerical approximation? Or do I just do abs(x - y) < epsilon?
comment:11 follow-up: ↓ 12 Changed 4 years ago by kcrisman
Hmm. Yes, there is something new to do this much better. See #10952.
comment:12 in reply to: ↑ 11 Changed 4 years ago by mjo
comment:13 Changed 4 years ago by mjo
- Status changed from needs_info to needs_review
There you go. I threw in a few orders of magnitude more tolerance than I think we need to account for platform differences.
comment:14 follow-up: ↓ 15 Changed 4 years ago by benjaminfjones
Michael, can you post the location of your Maxima-5.24 spkg so we can test this patch?
comment:15 in reply to: ↑ 14 Changed 4 years ago by mjo
Replying to benjaminfjones:
Michael, can you post the location of your Maxima-5.24 spkg so we can test this patch?
Yup:
comment:16 Changed 4 years ago by benjaminfjones
- Reviewers set to Benjamin Jones
I can verify that the issue is solved after building the maxima-5.24 spkg that Michael provided and then applying the patch sage-trac_10923.patch.
sage: i = integral(e^(-1/x^2),x,0,1) sage: i.numerical_approx() 0.0890738558907802
Doctests in the affected file all pass. I'm running all tests now, but pending that, I give the ticket a positive review.
comment:17 Changed 4 years ago by benjaminfjones
- Description modified (diff)
comment:18 Changed 4 years ago by benjaminfjones
OK, make ptestlong finished. There were failures, but none of them are due to this ticket specifically as far as I can tell. They are all due to the maxima-5.24 spkg I believe. I need to look into #12094 to be sure but it's too late to do that tonight..
comment:19 Changed 4 years ago by kcrisman
- Reviewers changed from Benjamin Jones to Benjamin Jones, Karl-Dieter Crisman
- Status changed from needs_review to positive_review
Yes, this all works fine.
comment:20 Changed 4 years ago by jdemeyer
- Merged in set to sage-5.0.beta3
- Resolution set to fixed
- Status changed from positive_review to closed
comment:21 Changed 4 years ago by mstreng
Something in this patch seems to trigger a doctesting bug. Try
./sage -t -only-optional=magma "devel/sage/sage/symbolic/integration/integral.py"
See sage release
comment:22 Changed 4 years ago by kcrisman
See #12493 for followup.
This is probably a bug in Maxima.
So probably a minus sign got in there somehow.
This is now Maxima bug 3211937.