89.24.18 problem 18

Internal problem ID [24855]
Book : A short course in Differential Equations. Earl D. Rainville. Second edition. 1958. Macmillan Publisher, NY. CAT 58-5010
Section : Chapter 11. Variation of parameters and other methods. Exercises at page 171
Problem number : 18
Date solved : Thursday, October 02, 2025 at 10:48:43 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-4 y^{\prime }-3 y&=\cos \left ({\mathrm e}^{-x}\right ) \end{align*}
Maple. Time used: 0.004 (sec). Leaf size: 78
ode:=diff(diff(y(x),x),x)-4*diff(y(x),x)-3*y(x) = cos(exp(-x)); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {{\mathrm e}^{-\left (-2+\sqrt {7}\right ) x} \left (-{\mathrm e}^{2 x \sqrt {7}} \int \cos \left ({\mathrm e}^{-x}\right ) {\mathrm e}^{-\left (2+\sqrt {7}\right ) x}d x \sqrt {7}-14 c_2 \,{\mathrm e}^{2 x \sqrt {7}}+\sqrt {7}\, \int \cos \left ({\mathrm e}^{-x}\right ) {\mathrm e}^{\left (-2+\sqrt {7}\right ) x}d x -14 c_1 \right )}{14} \]
Mathematica. Time used: 1.247 (sec). Leaf size: 116
ode=D[y[x],{x,2}]-4*D[y[x],x]-3*y[x]==  Cos[Exp[-x]]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-\left (\left (\sqrt {7}-2\right ) x\right )} \left (\int _1^x-\frac {e^{\left (-2+\sqrt {7}\right ) K[1]} \cos \left (e^{-K[1]}\right )}{2 \sqrt {7}}dK[1]+e^{2 \sqrt {7} x} \int _1^x\frac {e^{-\left (\left (2+\sqrt {7}\right ) K[2]\right )} \cos \left (e^{-K[2]}\right )}{2 \sqrt {7}}dK[2]+c_2 e^{2 \sqrt {7} x}+c_1\right ) \end{align*}
Sympy. Time used: 74.699 (sec). Leaf size: 104
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-3*y(x) - cos(exp(-x)) - 4*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^{x \left (2 - \sqrt {7}\right )} + C_{2} e^{x \left (2 + \sqrt {7}\right )} - \frac {\sqrt {7} e^{x \left (2 - \sqrt {7}\right )} \int e^{- 2 x} e^{\sqrt {7} x} \cos {\left (e^{- x} \right )}\, dx}{14} + \frac {\sqrt {7} e^{x \left (2 + \sqrt {7}\right )} \int e^{- 2 x} e^{- \sqrt {7} x} \cos {\left (e^{- x} \right )}\, dx}{14} \]