ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 30 Jan 2015 01:38:00 -0600Cannot desolve ODEhttps://ask.sagemath.org/question/25632/cannot-desolve-ode/ I'm trying to compute the solution for a first order differential equation using the code below:
var('g, a, v_e, m_0, v_9, k')
m(t) = (m_0 - a*t)
v = function('v', t)
de = m*diff(v, t) == -v_e*diff(m, t) - k*v - m*g
ans = desolve(de, v, ics=[0,0], ivar=t)
This returns the following error:
TypeError: Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(-k/a>0)', see `assume?` for more details)
Running assume(-k/a>0) before desolve does not remove the error. This error does not happen with the k*v term removed. By hand, I was able to solve this DE using integrating factors.
Wed, 28 Jan 2015 17:03:45 -0600https://ask.sagemath.org/question/25632/cannot-desolve-ode/Answer by tmonteil for <p>I'm trying to compute the solution for a first order differential equation using the code below:</p>
<pre><code>var('g, a, v_e, m_0, v_9, k')
m(t) = (m_0 - a*t)
v = function('v', t)
de = m*diff(v, t) == -v_e*diff(m, t) - k*v - m*g
ans = desolve(de, v, ics=[0,0], ivar=t)
</code></pre>
<p>This returns the following error:
TypeError: Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation <em>may</em> help (example of legal syntax is 'assume(-k/a>0)', see <code>assume?</code> for more details)</p>
<p>Running assume(-k/a>0) before desolve does not remove the error. This error does not happen with the k*v term removed. By hand, I was able to solve this DE using integrating factors. </p>
https://ask.sagemath.org/question/25632/cannot-desolve-ode/?answer=25642#post-id-25642You can provide a stronger information than `assume(-k/a>0)`, the following seems to work:
sage: assume(a>0)
sage: assume(k<0)
sage: ans = desolve(de, v, ics=[0,0], ivar=t)
sage: ans
-(a*g*k*t*e^(k*log(-m_0)/a) + g*k*m_0*e^(k*log(a*t - m_0)/a) - g*k*m_0*e^(k*log(-m_0)/a) + ((a^2 - a*k)*e^(k*log(a*t - m_0)/a) - (a^2 - a*k)*e^(k*log(-m_0)/a))*v_e)*e^(-k*log(-m_0)/a)/(a*k - k^2)
Fri, 30 Jan 2015 01:38:00 -0600https://ask.sagemath.org/question/25632/cannot-desolve-ode/?answer=25642#post-id-25642