89.19.17 problem 17

Internal problem ID [24745]
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 151
Problem number : 17
Date solved : Thursday, October 02, 2025 at 10:47:37 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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