2.11.11 problem 16

Internal problem ID [879]
Book : Differential equations and linear algebra, 3rd ed., Edwards and Penney
Section : Section 5.5, Nonhomogeneous equations and undetermined coefficients Page 351
Problem number : 16
Date solved : Tuesday, September 30, 2025 at 04:18:57 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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