86.11.2 problem 2

Internal problem ID [23196]
Book : An introduction to Differential Equations. By Howard Frederick Cleaves. 1969. Oliver and Boyd publisher. ISBN 0050015044
Section : Chapter 9. The operational method. Exercise 9c at page 137
Problem number : 2
Date solved : Thursday, October 02, 2025 at 09:24:14 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} x^{\prime \prime }-3 x^{\prime }+2 x&=5 \cos \left (t \right ) \end{align*}

With initial conditions

\begin{align*} x \left (0\right )&=0 \\ x^{\prime }\left (0\right )&=0 \\ \end{align*}
Maple. Time used: 0.015 (sec). Leaf size: 23
ode:=diff(diff(x(t),t),t)-3*diff(x(t),t)+2*x(t) = 5*cos(t); 
ic:=[x(0) = 0, D(x)(0) = 0]; 
dsolve([ode,op(ic)],x(t), singsol=all);
 
\[ x = 2 \,{\mathrm e}^{2 t}+\frac {\cos \left (t \right )}{2}-\frac {3 \sin \left (t \right )}{2}-\frac {5 \,{\mathrm e}^{t}}{2} \]
Mathematica. Time used: 0.013 (sec). Leaf size: 27
ode=D[x[t],{t,2}]-3*D[x[t],t]+2*x[t]==5*Cos[t]; 
ic={x[0]==0,Derivative[1][x][0] ==0}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)&\to \frac {1}{2} \left (e^t \left (4 e^t-5\right )-3 \sin (t)+\cos (t)\right ) \end{align*}
Sympy. Time used: 0.140 (sec). Leaf size: 27
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(2*x(t) - 5*cos(t) - 3*Derivative(x(t), t) + Derivative(x(t), (t, 2)),0) 
ics = {x(0): 0, Subs(Derivative(x(t), t), t, 0): 0} 
dsolve(ode,func=x(t),ics=ics)
 
\[ x{\left (t \right )} = 2 e^{2 t} - \frac {5 e^{t}}{2} - \frac {3 \sin {\left (t \right )}}{2} + \frac {\cos {\left (t \right )}}{2} \]