42.3.14 problem Example 3.43

Internal problem ID [8824]
Book : THEORY OF DIFFERENTIAL EQUATIONS IN ENGINEERING AND MECHANICS. K.T. CHAU, CRC Press. Boca Raton, FL. 2018
Section : Chapter 3. Ordinary Differential Equations. Section 3.5 HIGHER ORDER ODE. Page 181
Problem number : Example 3.43
Date solved : Tuesday, September 30, 2025 at 05:52:58 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+3 y^{\prime }+2 y&=\cos \left (2 x \right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 30
ode:=diff(diff(y(x),x),x)+3*diff(y(x),x)+2*y(x) = cos(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -{\mathrm e}^{-2 x} c_1 +{\mathrm e}^{-x} c_2 -\frac {\cos \left (2 x \right )}{20}+\frac {3 \sin \left (2 x \right )}{20} \]
Mathematica. Time used: 0.084 (sec). Leaf size: 61
ode=D[y[x],{x,2}]+3*D[y[x],x]+2*y[x]==Cos[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-2 x} \left (\int _1^x-e^{2 K[1]} \cos (2 K[1])dK[1]+e^x \int _1^xe^{K[2]} \cos (2 K[2])dK[2]+c_2 e^x+c_1\right ) \end{align*}
Sympy. Time used: 0.134 (sec). Leaf size: 29
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(2*y(x) - cos(2*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 {3 \sin {\left (2 x \right )}}{20} - \frac {\cos {\left (2 x \right )}}{20} \]