#6816 closed defect (duplicate)
[with patch, needs review] sage/maxima hang when doing an indefinite integral
Reported by: | was | Owned by: | burcin |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | calculus | Keywords: | |
Cc: | mhansen | Merged in: | |
Authors: | Karl-Dieter Crisman | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Integration sometimes hangs in sage-4.1.1.
flat:~ wstein$ sage ---------------------------------------------------------------------- | Sage Version 4.1.1, Release Date: 2009-08-14 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: var('t,theta') (t, theta) sage: integrate(t * cos(-theta*t), (t,-oo,oo)) [.. and it hangs forever ..]
In fact, in Maxima what is happening is the following:
(%i6) integrate(t*cos(-theta*t),t,-inf,inf); Is theta positive, negative, or zero? positive <--- i type this. ; (%o6) 0 (%i7)
For some reason the question "Is theta positive, negative, or zero?" is not getting seen by pexpect as it should. Argh!
This works in Maxima:
(%i1) assume(theta>0); (%o1) [theta > 0] (%i2) integrate(t*cos(-theta*t),t,-inf,inf); (%o2) 0
The same doesn't work in Sage though, which is very weird:
sage: var('t,theta') (t, theta) sage: assume(theta>0) sage: integrate(t * cos(-theta*t), (t,-oo,oo))
Attachments (1)
Change History (13)
comment:1 Changed 6 years ago by kcrisman
comment:2 Changed 5 years ago by kcrisman
- Milestone changed from sage-4.1.3 to sage-duplicate/invalid/wontfix
This ticket is invalid.
sage: var('t,theta') (t, theta) sage: integrate(t*cos(-theta*t),t,-oo,oo) 0
In fact, ANY sage integration attempted with the syntax provided by the originator of the ticket will fail!!! That's because (for better or for worse) we don't have #1221 or #2787 in Sage. But those tickets already exist.
comment:3 Changed 5 years ago by was
- Milestone changed from sage-duplicate/invalid/wontfix to sage-4.1.3
comment:4 Changed 5 years ago by kcrisman
Good point.
comment:5 Changed 5 years ago by kcrisman
- Summary changed from sage/maxima hang when doing an indefinite integral to [with patch, needs review] sage/maxima hang when doing an indefinite integral
I am fixing the error, but not actually adding documentation (other than in testing) that this works, because I view that as the proper place of the afore-mentioned tickets, which still need to resolve how backwards-incompatibility will be dealt with and probably have much better ways of dealing with it than my hackish solution. I'm also not accepting lists, just tuples, which I think is reasonable given the syntax of all the other calculus functions.
comment:6 Changed 5 years ago by was
I read it and it looks good. If it passes tests I would give it a positive review.... I don't have time right now.
comment:7 Changed 5 years ago by kcrisman
Rebased, otherwise should be fine.
comment:8 Changed 5 years ago by kcrisman
Now that #7327 has been opened, one of these two is a duplicate.
comment:9 Changed 5 years ago by jason
- Status changed from needs_review to needs_work
Hmm...that code looks pretty long. Why not just:
if 1<=len(v)<=3: return integral(expression,*v)
and take care of all three cases in one swoop?
Also, it completely ignores the rest of the parameters in the function call, like algorithm, etc.
comment:10 Changed 5 years ago by kcrisman
- Cc mhansen added
To release manager: please close this as a duplicate of #7327, where a patch including the doctests for the specific bug above resides.
comment:11 Changed 5 years ago by mhansen
- Milestone changed from sage-4.2.1 to sage-duplicate/invalid/wontfix
- Resolution set to duplicate
- Status changed from needs_work to closed
comment:12 Changed 5 years ago by kcrisman
- Report Upstream set to N/A
Just an update - it turns out the original integral reported here is not, in fact, convergent - it is an odd function, so the limit of the indefinite integral evaluated at N and -N is 0, though. Fixing this doctest so something mathematically correct happens will be done in #7745, since Maxima 5.20.1 simply returns that integral now, as opposed to giving 0.
Just an update; in Maxima 5.19.1 (in Sage, in fact from maxima_console() ) this particular example does not even ask a question but returns zero.
But it still hangs in Sage. That is really strange. Note that the indefinite integral works fine in Sage.