81.11.15 problem 15-14

Internal problem ID [21639]
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-14
Date solved : Thursday, October 02, 2025 at 07:59:20 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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