75.16.76 problem 549

Internal problem ID [16978]
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. Trial and error method. Exercises page 132
Problem number : 549
Date solved : Monday, March 31, 2025 at 03:36:58 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-4 y^{\prime }+5 y&={\mathrm e}^{2 x} \left (\sin \left (x \right )+2 \cos \left (x \right )\right ) \end{align*}

Maple. Time used: 0.003 (sec). Leaf size: 27
ode:=diff(diff(y(x),x),x)-4*diff(y(x),x)+5*y(x) = exp(2*x)*(sin(x)+2*cos(x)); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {{\mathrm e}^{2 x} \left (\left (x -2 c_1 -2\right ) \cos \left (x \right )-2 \sin \left (x \right ) \left (c_2 +x \right )\right )}{2} \]
Mathematica. Time used: 0.16 (sec). Leaf size: 65
ode=D[y[x],{x,2}]-4*D[y[x],x]+5*y[x]==Exp[2*x]*(Sin[x]+Cos[x]); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^{2 x} \left (\cos (x) \int _1^x-\sin (K[2]) (\cos (K[2])+\sin (K[2]))dK[2]+\sin (x) \int _1^x\cos (K[1]) (\cos (K[1])+\sin (K[1]))dK[1]+c_2 \cos (x)+c_1 \sin (x)\right ) \]
Sympy. Time used: 0.370 (sec). Leaf size: 22
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-(sin(x) + 2*cos(x))*exp(2*x) + 5*y(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 (\left (C_{1} - \frac {x}{2}\right ) \cos {\left (x \right )} + \left (C_{2} + x\right ) \sin {\left (x \right )}\right ) e^{2 x} \]