62.27.4 problem Ex 4

Internal problem ID [12871]
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 : Monday, March 31, 2025 at 07:23:14 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+2 y^{\prime }+y&=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.288 (sec). Leaf size: 71
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]
 
\[ y(x)\to e^{-x} \left (x \int _1^x\left (3 e^{3 K[2]}-e^{K[2]} \cos (K[2])\right )dK[2]+\int _1^xe^{K[1]} \left (\cos (K[1])-3 e^{2 K[1]}\right ) K[1]dK[1]+c_2 x+c_1\right ) \]
Sympy. Time used: 0.242 (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} \]