69.17.9 problem 559

Internal problem ID [18345]
Book : A book of problems in ordinary differential equations. M.L. KRASNOV, A.L. KISELYOV, G.I. MARKARENKO. MIR, MOSCOW. 1983
Section : Chapter 2 (Higher order ODEs). Section 15.3 Nonhomogeneous linear equations with constant coefficients. Superposition principle. Exercises page 137
Problem number : 559
Date solved : Thursday, October 02, 2025 at 03:10:41 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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