89.22.5 problem 5

Internal problem ID [24793]
Book : A short course in Differential Equations. Earl D. Rainville. Second edition. 1958. Macmillan Publisher, NY. CAT 58-5010
Section : Chapter 10. Nonhomogeneous Equations: Operational methods. Exercises at page 161
Problem number : 5
Date solved : Thursday, October 02, 2025 at 10:48:04 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} y-2 y^{\prime }+y^{\prime \prime }&=x^{2} \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 20
ode:=diff(diff(y(x),x),x)-2*diff(y(x),x)+y(x) = x^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \left (c_1 x +c_2 \right ) {\mathrm e}^{x}+x^{2}+4 x +6 \]
Mathematica. Time used: 0.007 (sec). Leaf size: 26
ode=D[y[x],{x,2}]-2*D[y[x],x]+y[x]== x^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to x^2+x \left (4+c_2 e^x\right )+c_1 e^x+6 \end{align*}
Sympy. Time used: 0.104 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 + y(x) - 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = x^{2} + 4 x + \left (C_{1} + C_{2} x\right ) e^{x} + 6 \]