78.16.18 problem 18

Internal problem ID [18326]
Book : DIFFERENTIAL EQUATIONS WITH APPLICATIONS AND HISTORICAL NOTES by George F. Simmons. 3rd edition. 2017. CRC press, Boca Raton FL.
Section : Chapter 3. Second order linear equations. Section 23. Operator Methods for Finding Particular Solutions. Problems at page 169
Problem number : 18
Date solved : Monday, March 31, 2025 at 05:25:39 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+2 y^{\prime }+y&=2 x^{2} {\mathrm e}^{-2 x}+3 \,{\mathrm e}^{2 x} \end{align*}

Maple. Time used: 0.004 (sec). Leaf size: 35
ode:=diff(diff(y(x),x),x)+2*diff(y(x),x)+y(x) = 2*x^2*exp(-2*x)+3*exp(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left ({\mathrm e}^{4 x}+\left (3 c_1 x +3 c_2 \right ) {\mathrm e}^{x}+6 x^{2}+24 x +36\right ) {\mathrm e}^{-2 x}}{3} \]
Mathematica. Time used: 0.19 (sec). Leaf size: 42
ode=D[y[x],{x,2}]+2*D[y[x],x]+y[x]==2*x^2*Exp[-2*x]+3*Exp[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{3} e^{-2 x} \left (6 \left (x^2+4 x+6\right )+e^{4 x}+3 e^x (c_2 x+c_1)\right ) \]
Sympy. Time used: 0.340 (sec). Leaf size: 34
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*x**2*exp(-2*x) + y(x) - 3*exp(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_{1} + x \left (C_{2} + 8 e^{- x}\right )\right ) e^{- x} + 2 \left (x^{2} + 6\right ) e^{- 2 x} + \frac {e^{2 x}}{3} \]