Ask Your Question

Revision history [back]

First update your SageMath to the latest version, so that you get a different error, namely:

NotImplementedError: Maxima was unable to solve this ODE. Consider to set option contrib_ode to True.

Passing the option, we get:

NotImplementedError: Maxima was unable to solve this ODE.

Reading the documentation of desolve, we find:

Solve a 1st or 2nd order linear ODE, including IVP and BVP.

Since your ODE is not 1st or 2nd order, it is understandable that the attempt failed.

You can try solving a system instead. Setting $x_1 = x, x_2 = x'(t), x_3 = x''(t)$, the third order ODE becomes the system of first-order ODE $x_1' = x_2, x_2' = x_3, x_3' = 2x_3 - 5x_2$.

It can be solved with SageMath's desolve_system::

sage: var('t')
sage: x1 = function('x1')(t)
sage: x2 = function('x2')(t)
sage: x3 = function('x3')(t)
sage: sol = desolve_system([diff(x1,t) == x2, diff(x2,t) == x3, diff(x3,t) == 2*x3 - 5*x2], [x1,x2,x3], ics=[0,0,0,1]); sol
[x1(t) == -1/10*(2*cos(2*t) - sin(2*t))*e^t + 1/5,
 x2(t) == 1/2*e^t*sin(2*t),
 x3(t) == 1/2*(2*cos(2*t) + sin(2*t))*e^t]
sage: x = sol[0].rhs(); x
-1/10*(2*cos(2*t) - sin(2*t))*e^t + 1/5
sage: x.subs(t==0), diff(x,t).subs(t==0), diff(x,t,2).subs(t==0)
(0, 0, 1)