81.11.23 problem 15-22

Internal problem ID [21647]
Book : The Differential Equations Problem Solver. VOL. I. M. Fogiel director. REA, NY. 1978. ISBN 78-63609
Section : Chapter 15. Method of undetermined coefficients. Page 337.
Problem number : 15-22
Date solved : Thursday, October 02, 2025 at 07:59:25 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y^{\prime }-2 y&=2 x -40 \cos \left (2 x \right ) \end{align*}
Maple. Time used: 0.006 (sec). Leaf size: 31
ode:=diff(diff(y(x),x),x)+diff(y(x),x)-2*y(x) = 2*x-40*cos(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-2 x} c_2 +{\mathrm e}^{x} c_1 -x -\frac {1}{2}-2 \sin \left (2 x \right )+6 \cos \left (2 x \right ) \]
Mathematica. Time used: 0.232 (sec). Leaf size: 38
ode=D[y[x],{x,2}]+D[y[x],x]-2*y[x]==2*x-40*Cos[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -x-2 \sin (2 x)+6 \cos (2 x)+c_1 e^{-2 x}+c_2 e^x-\frac {1}{2} \end{align*}
Sympy. Time used: 0.120 (sec). Leaf size: 32
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*x - 2*y(x) + 40*cos(2*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^{- 2 x} + C_{2} e^{x} - x - 2 \sin {\left (2 x \right )} + 6 \cos {\left (2 x \right )} - \frac {1}{2} \]