85.56.4 problem 1 (d)

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

\begin{align*} y^{\prime \prime }-2 y^{\prime }-y&=x^{2} {\mathrm e}^{x} \end{align*}
Maple. Time used: 0.004 (sec). Leaf size: 32
ode:=diff(diff(y(x),x),x)-2*diff(y(x),x)-y(x) = x^2*exp(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {{\mathrm e}^{x} \left (-2 \,{\mathrm e}^{-x \sqrt {2}} c_1 -2 \,{\mathrm e}^{x \sqrt {2}} c_2 +x^{2}+1\right )}{2} \]
Mathematica. Time used: 0.019 (sec). Leaf size: 47
ode=D[y[x],{x,2}]-2*D[y[x],{x,1}]-y[x]==x^2*Exp[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\frac {1}{2} e^x \left (x^2+1\right )+c_1 e^{x-\sqrt {2} x}+c_2 e^{\left (1+\sqrt {2}\right ) x} \end{align*}
Sympy. Time used: 0.180 (sec). Leaf size: 39
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2*exp(x) - y(x) - 2*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 (1 - \sqrt {2}\right )} + C_{2} e^{x \left (1 + \sqrt {2}\right )} - \frac {x^{2} e^{x}}{2} - \frac {e^{x}}{2} \]