23.3.74 problem 76

Internal problem ID [5788]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Part II. Chapter 3. THE DIFFERENTIAL EQUATION IS LINEAR AND OF SECOND ORDER, page 311
Problem number : 76
Date solved : Tuesday, September 30, 2025 at 02:03:23 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} 2 y+3 y^{\prime }+y^{\prime \prime }&=\cos \left (a x \right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 76
ode:=2*y(x)+3*diff(y(x),x)+diff(diff(y(x),x),x) = cos(a*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {c_1 \left (-a^{4}-5 a^{2}-4\right ) {\mathrm e}^{-2 x}+c_2 \left (a^{4}+5 a^{2}+4\right ) {\mathrm e}^{-x}-\cos \left (a x \right ) a^{2}+3 a \sin \left (a x \right )+2 \cos \left (a x \right )}{\left (a^{2}+1\right ) \left (a^{2}+4\right )} \]
Mathematica. Time used: 0.062 (sec). Leaf size: 54
ode=2*y[x] + 3*D[y[x],x] + D[y[x],{x,2}] == Cos[a*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {3 a \sin (a x)-\left (a^2-2\right ) \cos (a x)}{a^4+5 a^2+4}+c_1 e^{-2 x}+c_2 e^{-x} \end{align*}
Sympy. Time used: 0.177 (sec). Leaf size: 68
from sympy import * 
x = symbols("x") 
a = symbols("a") 
y = Function("y") 
ode = Eq(2*y(x) - cos(a*x) + 3*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- 2 x} + C_{2} e^{- x} - \frac {a^{2} \cos {\left (a x \right )}}{a^{4} + 5 a^{2} + 4} + \frac {3 a \sin {\left (a x \right )}}{a^{4} + 5 a^{2} + 4} + \frac {2 \cos {\left (a x \right )}}{a^{4} + 5 a^{2} + 4} \]