85.61.6 problem 6

Internal problem ID [22860]
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 208
Problem number : 6
Date solved : Thursday, October 02, 2025 at 09:15:52 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y+2 y^{\prime }+y^{\prime \prime }&=x^{2} {\mathrm e}^{-x}+1 \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 23
ode:=diff(diff(y(x),x),x)+2*diff(y(x),x)+y(x) = x^2*exp(-x)+1; 
dsolve(ode,y(x), singsol=all);
 
\[ y = 1+\frac {\left (x^{4}+12 c_1 x +12 c_2 \right ) {\mathrm e}^{-x}}{12} \]
Mathematica. Time used: 0.063 (sec). Leaf size: 32
ode=D[y[x],{x,2}]+2*D[y[x],{x,1}]+y[x]==x^2*Exp[-x]+1; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {1}{12} e^{-x} \left (x^4+12 e^x+12 c_2 x+12 c_1\right ) \end{align*}
Sympy. Time used: 0.190 (sec). Leaf size: 17
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)) - 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} + x \left (C_{2} + \frac {x^{3}}{12}\right )\right ) e^{- x} + 1 \]