89.24.21 problem 30

Internal problem ID [24858]
Book : A short course in Differential Equations. Earl D. Rainville. Second edition. 1958. Macmillan Publisher, NY. CAT 58-5010
Section : Chapter 11. Variation of parameters and other methods. Exercises at page 171
Problem number : 30
Date solved : Thursday, October 02, 2025 at 10:48:45 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+4 y^{\prime }+4 y&=f \left (x \right ) \end{align*}
Maple. Time used: 0.003 (sec). Leaf size: 37
ode:=diff(diff(y(x),x),x)+4*diff(y(x),x)+4*y(x) = f(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-2 x} \left (\int {\mathrm e}^{2 x} f \left (x \right )d x x +c_1 x -\int {\mathrm e}^{2 x} x f \left (x \right )d x +c_2 \right ) \]
Mathematica. Time used: 0.038 (sec). Leaf size: 57
ode=D[y[x],{x,2}]+4*D[y[x],x]+4*y[x]==  f[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-2 x} \left (x \int _1^xe^{2 K[2]} f(K[2])dK[2]+\int _1^x-e^{2 K[1]} f(K[1]) K[1]dK[1]+c_2 x+c_1\right ) \end{align*}
Sympy. Time used: 0.833 (sec). Leaf size: 34
from sympy import * 
x = symbols("x") 
y = Function("y") 
f = Function("f") 
ode = Eq(-f(x) + 4*y(x) + 4*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} + x \left (C_{2} + \int f{\left (x \right )} e^{2 x}\, dx\right ) - \int x f{\left (x \right )} e^{2 x}\, dx\right ) e^{- 2 x} \]