72.16.7 problem 7

Internal problem ID [19672]
Book : DIFFERENTIAL EQUATIONS WITH APPLICATIONS AND HISTORICAL NOTES by George F. Simmons. 3rd edition. 2017. CRC press, Boca Raton FL.
Section : Chapter 3. Second order linear equations. Section 23. Operator Methods for Finding Particular Solutions. Problems at page 169
Problem number : 7
Date solved : Thursday, October 02, 2025 at 04:41:13 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-y^{\prime }+y&=x^{3}-3 x^{2}+1 \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 38
ode:=diff(diff(y(x),x),x)-diff(y(x),x)+y(x) = x^3-3*x^2+1; 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{\frac {x}{2}} \sin \left (\frac {\sqrt {3}\, x}{2}\right ) c_2 +{\mathrm e}^{\frac {x}{2}} \cos \left (\frac {\sqrt {3}\, x}{2}\right ) c_1 +x^{3}-6 x -5 \]
Mathematica. Time used: 0.014 (sec). Leaf size: 55
ode=D[y[x],{x,2}]-D[y[x],x]+y[x]==x^3-3*x^2+1; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to x^3-6 x+c_1 e^{x/2} \cos \left (\frac {\sqrt {3} x}{2}\right )+c_2 e^{x/2} \sin \left (\frac {\sqrt {3} x}{2}\right )-5 \end{align*}
Sympy. Time used: 0.124 (sec). Leaf size: 39
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**3 + 3*x**2 + y(x) - Derivative(y(x), x) + Derivative(y(x), (x, 2)) - 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x^{3} - 6 x + \left (C_{1} \sin {\left (\frac {\sqrt {3} x}{2} \right )} + C_{2} \cos {\left (\frac {\sqrt {3} x}{2} \right )}\right ) e^{\frac {x}{2}} - 5 \]