32.4.9 problem 9

Internal problem ID [7782]
Book : Engineering Mathematics. By K. A. Stroud. 5th edition. Industrial press Inc. NY. 2001
Section : Program 25. Second order differential equations. Further problems 25. page 1094
Problem number : 9
Date solved : Tuesday, September 30, 2025 at 05:05:23 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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