23.3.18 problem 18

Internal problem ID [5732]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Part II. Chapter 3. THE DIFFERENTIAL EQUATION IS LINEAR AND OF SECOND ORDER, page 311
Problem number : 18
Date solved : Tuesday, September 30, 2025 at 02:02:14 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y+y^{\prime \prime }&={\mathrm e}^{x} \left (x^{2}-1\right ) \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 24
ode:=y(x)+diff(diff(y(x),x),x) = exp(x)*(x^2-1); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (x^{2}-2 x \right ) {\mathrm e}^{x}}{2}+\cos \left (x \right ) c_1 +\sin \left (x \right ) c_2 \]
Mathematica. Time used: 0.009 (sec). Leaf size: 27
ode=y[x] + D[y[x],{x,2}] == E^x*(-1 + x^2); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {1}{2} e^x (x-2) x+c_1 \cos (x)+c_2 \sin (x) \end{align*}
Sympy. Time used: 0.056 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-(x**2 - 1)*exp(x) + y(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (x \right )} + C_{2} \cos {\left (x \right )} + \frac {x^{2} e^{x}}{2} - x e^{x} \]