35.8.14 problem 14

Internal problem ID [6221]
Book : Mathematical Methods in the Physical Sciences. third edition. Mary L. Boas. John Wiley. 2006
Section : Chapter 8, Ordinary differential equations. Section 13. Miscellaneous problems. page 466
Problem number : 14
Date solved : Wednesday, March 05, 2025 at 12:25:37 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.003 (sec). Leaf size: 20
ode:=diff(diff(y(x),x),x)+4*diff(y(x),x)+5*y(x) = 2*exp(-2*x)*cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-2 x} \left (\left (c_{2} +x \right ) \sin \left (x \right )+\cos \left (x \right ) c_{1} \right ) \]
Mathematica. Time used: 0.048 (sec). Leaf size: 26
ode=D[y[x],{x,2}]+4*D[y[x],x]+5*y[x]==2*Exp[-2*x]*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^{-2 x} ((1+c_2) \cos (x)+(x+c_1) \sin (x)) \]
Sympy. Time used: 0.349 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(5*y(x) + 4*Derivative(y(x), x) + Derivative(y(x), (x, 2)) - 2*exp(-2*x)*cos(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{2} \cos {\left (x \right )} + \left (C_{1} + x\right ) \sin {\left (x \right )}\right ) e^{- 2 x} \]