64.11.43 problem 43

Internal problem ID [13422]
Book : Differential Equations by Shepley L. Ross. Third edition. John Willey. New Delhi. 2004.
Section : Chapter 4, Section 4.3. The method of undetermined coefficients. Exercises page 151
Problem number : 43
Date solved : Monday, March 31, 2025 at 07:53:51 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+4 y^{\prime }+5 y&={\mathrm e}^{-2 x} \left (1+\cos \left (x \right )\right ) \end{align*}

Maple. Time used: 0.003 (sec). Leaf size: 28
ode:=diff(diff(y(x),x),x)+4*diff(y(x),x)+5*y(x) = exp(-2*x)*(cos(x)+1); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (\left (2 c_1 +1\right ) \cos \left (x \right )+2+\left (2 c_2 +x \right ) \sin \left (x \right )\right ) {\mathrm e}^{-2 x}}{2} \]
Mathematica. Time used: 0.084 (sec). Leaf size: 70
ode=D[y[x],{x,2}]+4*D[y[x],x]+5*y[x]==Exp[-2*x]*(1+Cos[x]); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^{-2 x} \left (\cos (x) \int _1^x-2 \cos ^2\left (\frac {K[2]}{2}\right ) \sin (K[2])dK[2]+\sin (x) \int _1^x2 \cos ^2\left (\frac {K[1]}{2}\right ) \cos (K[1])dK[1]+c_2 \cos (x)+c_1 \sin (x)\right ) \]
Sympy. Time used: 0.383 (sec). Leaf size: 22
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-(cos(x) + 1)*exp(-2*x) + 5*y(x) + 4*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{2} \cos {\left (x \right )} + \left (C_{1} + \frac {x}{2}\right ) \sin {\left (x \right )} + 1\right ) e^{- 2 x} \]