72.17.10 problem 10

Internal problem ID [14867]
Book : DIFFERENTIAL EQUATIONS by Paul Blanchard, Robert L. Devaney, Glen R. Hall. 4th edition. Brooks/Cole. Boston, USA. 2012
Section : Chapter 4. Forcing and Resonance. Section 4.2 page 412
Problem number : 10
Date solved : Thursday, March 13, 2025 at 05:15:50 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.004 (sec). Leaf size: 27
ode:=diff(diff(y(t),t),t)+2*diff(y(t),t)+y(t) = cos(3*t); 
dsolve(ode,y(t), singsol=all);
 
\[ y = \left (c_{1} t +c_{2} \right ) {\mathrm e}^{-t}-\frac {2 \cos \left (3 t \right )}{25}+\frac {3 \sin \left (3 t \right )}{50} \]
Mathematica. Time used: 0.18 (sec). Leaf size: 57
ode=D[y[t],{t,2}]+2*D[y[t],t]+y[t]==Cos[3*t]; 
ic={}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\[ y(t)\to e^{-t} \left (t \int _1^te^{K[2]} \cos (3 K[2])dK[2]+\int _1^t-e^{K[1]} \cos (3 K[1]) K[1]dK[1]+c_2 t+c_1\right ) \]
Sympy. Time used: 0.211 (sec). Leaf size: 27
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(y(t) - cos(3*t) + 2*Derivative(y(t), t) + Derivative(y(t), (t, 2)),0) 
ics = {} 
dsolve(ode,func=y(t),ics=ics)
 
\[ y{\left (t \right )} = \left (C_{1} + C_{2} t\right ) e^{- t} + \frac {3 \sin {\left (3 t \right )}}{50} - \frac {2 \cos {\left (3 t \right )}}{25} \]