12.2.7 problem Problem 15.7

Internal problem ID [3490]
Book : Mathematical methods for physics and engineering, Riley, Hobson, Bence, second edition, 2002
Section : Chapter 15, Higher order ordinary differential equations. 15.4 Exercises, page 523
Problem number : Problem 15.7
Date solved : Tuesday, September 30, 2025 at 06:40:43 AM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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