56.27.4 problem Ex 4

Internal problem ID [14223]
Book : An elementary treatise on differential equations by Abraham Cohen. DC heath publishers. 1906
Section : Chapter VII, Linear differential equations with constant coefficients. Article 50. Method of undetermined coefficients. Page 107
Problem number : Ex 4
Date solved : Thursday, October 02, 2025 at 09:26:53 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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