89.23.27 problem 31

Internal problem ID [24831]
Book : A short course in Differential Equations. Earl D. Rainville. Second edition. 1958. Macmillan Publisher, NY. CAT 58-5010
Section : Chapter 10. Nonhomogeneous Equations: Operational methods. Miscellaneous Exercises at page 162
Problem number : 31
Date solved : Thursday, October 02, 2025 at 10:48:25 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} y^{\prime \prime }+3 y^{\prime }+2 y&=4 x^{2} \end{align*}

With initial conditions

\begin{align*} y \left (0\right )&=0 \\ y^{\prime }\left (0\right )&=0 \\ \end{align*}
Maple. Time used: 0.013 (sec). Leaf size: 24
ode:=diff(diff(y(x),x),x)+3*diff(y(x),x)+2*y(x) = 4*x^2; 
ic:=[y(0) = 0, D(y)(0) = 0]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = {\mathrm e}^{-2 x}-8 \,{\mathrm e}^{-x}+2 x^{2}-6 x +7 \]
Mathematica. Time used: 0.01 (sec). Leaf size: 27
ode=D[y[x],{x,2}]+3*D[y[x],{x,1}]+2*y[x]== 4*x^2; 
ic={y[0]==0,Derivative[1][y][0] ==0}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to 2 x^2-6 x+e^{-2 x}-8 e^{-x}+7 \end{align*}
Sympy. Time used: 0.133 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-4*x**2 + 2*y(x) + 3*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {y(0): 0, Subs(Derivative(y(x), x), x, 0): 0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = 2 x^{2} - 6 x + 7 - 8 e^{- x} + e^{- 2 x} \]