85.56.1 problem 1 (a)

Internal problem ID [22826]
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 : 1 (a)
Date solved : Thursday, October 02, 2025 at 09:15:02 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y&=x \,{\mathrm e}^{-x}+3 \sin \left (x \right ) \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 27
ode:=diff(diff(y(x),x),x)+y(x) = x*exp(-x)+3*sin(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (x \right ) c_2 +\cos \left (x \right ) c_1 +\frac {{\mathrm e}^{-x} \left (x +1\right )}{2}-\frac {3 \cos \left (x \right ) x}{2} \]
Mathematica. Time used: 0.274 (sec). Leaf size: 40
ode=D[y[x],{x,2}]+ y[x]==x*Exp[-x]+3*Sin[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {1}{4} \left (2 e^{-x} (x+1)+(-6 x+4 c_1) \cos (x)+(3+4 c_2) \sin (x)\right ) \end{align*}
Sympy. Time used: 0.096 (sec). Leaf size: 31
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*exp(-x) + y(x) - 3*sin(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} \sin {\left (x \right )} + \frac {x e^{- x}}{2} + \left (C_{1} - \frac {3 x}{2}\right ) \cos {\left (x \right )} + \frac {e^{- x}}{2} \]