64.11.36 problem 36

Internal problem ID [13407]
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 : Wednesday, March 05, 2025 at 09:52:31 PM
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,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.045 (sec). Leaf size: 78
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]
 
\[ y(x)\to \frac {1}{2} e^{-x} \left (2 \int _1^x-\frac {3}{2} e^{2 K[1]} K[1]^2dK[1]-2 \int _1^0-\frac {3}{2} e^{2 K[1]} K[1]^2dK[1]+e^{2 x} x^3+3 e^{2 x}-1\right ) \]
Sympy. Time used: 0.162 (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} \]