89.21.15 problem 17

Internal problem ID [24787]
Book : A short course in Differential Equations. Earl D. Rainville. Second edition. 1958. Macmillan Publisher, NY. CAT 58-5010
Section : Chapter 10. Nonhomogeneous Equations: Operational methods. Exercises at page 154
Problem number : 17
Date solved : Thursday, October 02, 2025 at 10:48:01 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-2 y^{\prime }+5 y&={\mathrm e}^{x} \cos \left (2 x \right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 28
ode:=diff(diff(y(x),x),x)-2*diff(y(x),x)+5*y(x) = exp(x)*cos(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {{\mathrm e}^{x} \left (\sin \left (2 x \right ) \left (x +4 c_2 \right )+4 \cos \left (2 x \right ) \left (c_1 +\frac {1}{8}\right )\right )}{4} \]
Mathematica. Time used: 0.02 (sec). Leaf size: 36
ode=D[y[x],{x,2}]-2*D[y[x],{x,1}]+5*y[x]== Exp[x]*Cos[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {1}{16} e^x ((1+16 c_2) \cos (2 x)+4 (x+4 c_1) \sin (2 x)) \end{align*}
Sympy. Time used: 0.185 (sec). Leaf size: 22
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(5*y(x) - exp(x)*cos(2*x) - 2*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 (2 x \right )} + \left (C_{1} + \frac {x}{4}\right ) \sin {\left (2 x \right )}\right ) e^{x} \]