Opened 11 years ago
Closed 10 years ago
#9710 closed defect (duplicate)
Assumptions not passed to differential equation solver
Reported by: | kedlaya | Owned by: | burcin |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | calculus | Keywords: | differential equations, assumptions |
Cc: | robert.marik, kcrisman, jdemeyer | Merged in: | |
Authors: | Reviewers: | Karl-Dieter Crisman | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
The assume function doesn't seem to work with the differential equation solver, despite what the documentation for desolve suggests. This returns an error:
sage: x = var('x') sage: k = var('k') sage: y = function('y',x) sage: assume(k>0) sage: print desolve(diff(y,x,x)+k*y-exp(-k*x),[y,x]) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_25.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("eCA9IHZhcigneCcpCmsgPSB2YXIoJ2snKQp5ID0gZnVuY3Rpb24oJ3knLHgpCmFzc3VtZShrPjApCnByaW50IGRlc29sdmUoZGlmZih5LHgseCkrayp5LWV4cCgtayp4KSxbeSx4XSk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> File "/tmp/tmpyNFGr0/___code___.py", line 7, in <module> exec compile(u'print desolve(diff(y,x,x)+k*y-exp(-k*x),[y,x]) File "", line 1, in <module> File "/home/kedlaya/sage-complete/local/lib/python2.6/site-packages/sage/calculus/desolvers.py", line 340, in desolve soln = maxima(cmd) File "/home/kedlaya/sage-complete/local/lib/python2.6/site-packages/sage/interfaces/expect.py", line 1032, in __call__ return cls(self, x, name=name) File "/home/kedlaya/sage-complete/local/lib/python2.6/site-packages/sage/interfaces/expect.py", line 1451, in __init__ raise TypeError, x TypeError: Computation failed since Maxima requested additional constraints (try the command 'assume(k>0)' before integral or limit evaluation, for example): Is k positive, negative, or zero?
Found by Praveen N. and Aashita during Sage Days 25 coding sprint.
Change History (9)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
with #9961:
marik@um-bc107:/opt/sage$ ./sage ---------------------------------------------------------------------- | Sage Version 4.5.3, Release Date: 2010-09-04 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: x=var('x'); f=function('f',x); k=var('k'); assume(k>0) sage: desolve(diff(f,x,2)/f==k,f,ivar=x) k1*e^(sqrt(k)*x) + k2*e^(-sqrt(k)*x)
comment:3 Changed 11 years ago by
In fact, #9835 is sufficient to solve this problem. The patch #9961 which is on the top of #9835 is not necessary. For the problem from the description we have with #9835:
marik@um-bc107:/opt/sage$ ./sage ---------------------------------------------------------------------- | Sage Version 4.5.3, Release Date: 2010-09-04 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: x = var('x') sage: k = var('k') sage: y = function('y',x) sage: assume(k>0) sage: desolve(diff(y,x,x)+k*y-exp(-k*x),[y,x]) k1*sin(sqrt(k)*x) + k2*cos(sqrt(k)*x) + e^(-k*x)/(k^2 + k) sage:
comment:4 Changed 11 years ago by
- Cc robert.marik added
comment:5 follow-up: ↓ 6 Changed 10 years ago by
- Cc kcrisman added
- Milestone set to sage-4.7
- Reviewers set to Karl-Dieter Crisman
- Status changed from new to needs_review
Yup, and still works. Definitely same issue as #8931, which now has positive review.
We could add yet another doctest, but in this case there are already so many tests of it, with another one coming at #8931, that it seems appropriate to simply say this is a dup.
To release manager: please close this ticket.
comment:6 in reply to: ↑ 5 Changed 10 years ago by
- Status changed from needs_review to positive_review
comment:7 Changed 10 years ago by
- Cc jdemeyer added
Sorry, forgot to actually cc: the release manager.
comment:8 Changed 10 years ago by
- Milestone changed from sage-4.7 to sage-duplicate/invalid/wontfix
comment:9 Changed 10 years ago by
- Resolution set to duplicate
- Status changed from positive_review to closed
Observed later: ticket #8931 is similar, possibly enough so for this to be considered a duplicate. Also, I misread the documentation:
So no promise is being made, but nonetheless I think this needs to be fixed.