Opened 12 years ago
Closed 8 years ago
#9421 closed defect (duplicate)
desolve mixes user parameters and integration constants
Reported by: | Paul Zimmermann | Owned by: | Burcin Erocal |
---|---|---|---|
Priority: | major | Milestone: | sage-6.2 |
Component: | calculus | Keywords: | |
Cc: | Robert Marik, Karl-Dieter Crisman | Merged in: | |
Authors: | Paul Zimmermann | Reviewers: | Ralf Stephan |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Consider
sage: var('t') sage: x=function('x',t) sage: var('c') sage: desolve(diff(x,t)+2*x==t^2-2*t+c,x,ivar=t).expand() c*e^(-2*t) + 1/2*t^2 + 1/2*c - 3/2*t + 3/4
Here the first occurrence of c
is an integration constant,
whereas the second one is the parameter in the ODE:
sage: var('d') sage: desolve(diff(x,t)+2*x==t^2-2*t+d,x,ivar=t).expand() c*e^(-2*t) + 1/2*t^2 + 1/2*d - 3/2*t + 3/4
In case the ODE contains c
, desolve should choose another
name for the integration constant.
Attachments (1)
Change History (12)
comment:1 Changed 12 years ago by
Cc: | Robert Marik added |
---|
comment:2 Changed 12 years ago by
Cc: | Karl-Dieter Crisman added |
---|
comment:3 Changed 9 years ago by
Milestone: | sage-5.11 → sage-5.12 |
---|
Changed 9 years ago by
Attachment: | trac_9421.patch added |
---|
comment:4 Changed 9 years ago by
Authors: | → Paul Zimmermann |
---|---|
Status: | new → needs_review |
waiting for the general problem to be solved, the attached patch prints a warning if the given equation contains the variable c
.
Paul
comment:5 Changed 9 years ago by
Milestone: | sage-6.1 → sage-6.2 |
---|
comment:6 Changed 9 years ago by
Reviewers: | → Ralf Stephan |
---|---|
Status: | needs_review → positive_review |
I will OK this if you have a look at #8734 in turn, please 8)
comment:8 Changed 9 years ago by
comment:9 Changed 9 years ago by
You might want to consider this one too:
sage: desolve(diff(f(x),x,x)-f(x),f(x)) k2*e^(-x) + k1*e^x
We can recognize the variables as distinct before they are converted from maxima:
sage: function('f',x) f(x) sage: var('c') c sage: V=diff(f(x),x)-f(x)+c sage: v=maxima_calculus(V) sage: v.ode2(f(x),x) 'f(x)=(c*%e^-x+%c)*%e^x sage: v.ode2(f(x),x).ecl() <ECL: ((MEQUAL SIMP) ((%F SIMP) $X) ((MTIMES SIMP) ((MPLUS SIMP) $%C ((MTIMES SIMP) $C ((MEXPT SIMP) $%E ((MTIMES SIMP) -1 $X)))) ((MEXPT SIMP) $%E $X)))>
so perhaps the right solution is to warn when sage's "forget the %" causes a name collision (with the righter solution being: making sage's "forget the %" more intelligent, so that collisions can be avoided)
comment:10 Changed 9 years ago by
With #16007 the output is now
sage: sage: x=function('x',t) sage: sage: var('c') c sage: sage: desolve(diff(x,t)+2*x==t^2-2*t+c,x,ivar=t).expand() 1/2*t^2 + _C*e^(-2*t) + 1/2*c - 3/2*t + 3/4 sage: desolve(diff(f(x),x,x)-f(x),f(x)) _K2*e^(-x) + _K1*e^x
As that's a simple and fine solution instead of a warning or an extended patch I would be glad if someone could review that one-liner.
comment:11 Changed 8 years ago by
Resolution: | → duplicate |
---|---|
Status: | positive_review → closed |
This is a part of more general problem which has been reported in #6882.