85.56.9 problem 2 (c)

Internal problem ID [22834]
Book : Applied Differential Equations. By Murray R. Spiegel. 3rd edition. 1980. Pearson. ISBN 978-0130400970
Section : Chapter 4. Linear differential equations. A Exercises at page 199
Problem number : 2 (c)
Date solved : Thursday, October 02, 2025 at 09:15:32 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y+2 y^{\prime }+y^{\prime \prime }&=\sin \left (3 x \right )+x \,{\mathrm e}^{-x} \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 34
ode:=diff(diff(y(x),x),x)+2*diff(y(x),x)+y(x) = sin(3*x)+x*exp(-x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (x^{3}+6 c_1 x +6 c_2 \right ) {\mathrm e}^{-x}}{6}-\frac {3 \cos \left (3 x \right )}{50}-\frac {2 \sin \left (3 x \right )}{25} \]
Mathematica. Time used: 0.18 (sec). Leaf size: 44
ode=D[y[x],{x,2}]+2*D[y[x],x]+y[x]==Sin[3*x]+x*Exp[-x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {1}{6} e^{-x} \left (x^3+6 c_2 x+6 c_1\right )-\frac {2}{25} \sin (3 x)-\frac {3}{50} \cos (3 x) \end{align*}
Sympy. Time used: 0.252 (sec). Leaf size: 32
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*exp(-x) + y(x) - sin(3*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_{1} + x \left (C_{2} + \frac {x^{2}}{6}\right )\right ) e^{- x} - \frac {2 \sin {\left (3 x \right )}}{25} - \frac {3 \cos {\left (3 x \right )}}{50} \]