78.16.2 problem 2

Internal problem ID [18310]
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 : 2
Date solved : Monday, March 31, 2025 at 05:25:18 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.006 (sec). Leaf size: 31
ode:=diff(diff(y(x),x),x)-y(x) = x^2*exp(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{x} c_2 +{\mathrm e}^{-x} c_1 +\frac {\left (9 x^{2}-24 x +26\right ) {\mathrm e}^{2 x}}{27} \]
Mathematica. Time used: 0.017 (sec). Leaf size: 39
ode=D[y[x],{x,2}]-y[x]==x^2*Exp[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{27} e^{2 x} \left (9 x^2-24 x+26\right )+c_1 e^x+c_2 e^{-x} \]
Sympy. Time used: 0.133 (sec). Leaf size: 29
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2*exp(2*x) - y(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- x} + C_{2} e^{x} + \frac {\left (9 x^{2} - 24 x + 26\right ) e^{2 x}}{27} \]