38.3.6 problem 6

Internal problem ID [6484]
Book : Engineering Mathematics. By K. A. Stroud. 5th edition. Industrial press Inc. NY. 2001
Section : Program 25. Second order differential equations. Test Excercise 25. page 1093
Problem number : 6
Date solved : Wednesday, March 05, 2025 at 12:51:51 AM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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

With initial conditions

\begin{align*} y \left (0\right )&=1\\ y^{\prime }\left (0\right )&=-2 \end{align*}

Maple. Time used: 0.012 (sec). Leaf size: 14
ode:=diff(diff(y(x),x),x)+4*diff(y(x),x)+5*y(x) = 2*exp(-2*x); 
ic:=y(0) = 1, D(y)(0) = -2; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = -{\mathrm e}^{-2 x} \left (\cos \left (x \right )-2\right ) \]
Mathematica. Time used: 0.024 (sec). Leaf size: 16
ode=D[y[x],{x,2}]+4*D[y[x],x]+5*y[x]==2*Exp[-2*x]; 
ic={y[0]==1,Derivative[1][y][0] ==-2}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -e^{-2 x} (\cos (x)-2) \]
Sympy. Time used: 0.258 (sec). Leaf size: 12
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),0) 
ics = {y(0): 1, Subs(Derivative(y(x), x), x, 0): -2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (2 - \cos {\left (x \right )}\right ) e^{- 2 x} \]