58.11.36 problem 36

Internal problem ID [14767]
Book : Differential Equations by Shepley L. Ross. Third edition. John Willey. New Delhi. 2004.
Section : Chapter 4, Section 4.3. The method of undetermined coefficients. Exercises page 151
Problem number : 36
Date solved : Thursday, October 02, 2025 at 09:50:58 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

With initial conditions

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