69.17.21 problem 571

Internal problem ID [18357]
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 : 571
Date solved : Thursday, October 02, 2025 at 03:10:51 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-2 y^{\prime }-3 y&=2 x +{\mathrm e}^{-x}-2 \,{\mathrm e}^{3 x} \end{align*}
Maple. Time used: 0.004 (sec). Leaf size: 37
ode:=diff(diff(y(x),x),x)-2*diff(y(x),x)-3*y(x) = 2*x+exp(-x)-2*exp(3*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {4}{9}+\frac {\left (-1-4 x +16 c_1 \right ) {\mathrm e}^{-x}}{16}+\frac {\left (1-4 x +8 c_2 \right ) {\mathrm e}^{3 x}}{8}-\frac {2 x}{3} \]
Mathematica. Time used: 0.382 (sec). Leaf size: 86
ode=D[y[x],{x,2}]-2*D[y[x],x]-3*y[x]==2*x+Exp[-x]-2*Exp[3*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to e^{-x} \left (\int _1^x\frac {1}{4} \left (-2 e^{K[1]} K[1]+2 e^{4 K[1]}-1\right )dK[1]+e^{4 x} \int _1^x\frac {1}{4} \left (2 e^{-3 K[2]} K[2]+e^{-4 K[2]}-2\right )dK[2]+c_2 e^{4 x}+c_1\right ) \end{align*}
Sympy. Time used: 0.188 (sec). Leaf size: 29
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*x - 3*y(x) + 2*exp(3*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 )} = - \frac {2 x}{3} + \left (C_{1} - \frac {x}{2}\right ) e^{3 x} + \left (C_{2} - \frac {x}{4}\right ) e^{- x} + \frac {4}{9} \]