28.2.45 problem 45

Internal problem ID [4488]
Book : Differential equations for engineers by Wei-Chau XIE, Cambridge Press 2010
Section : Chapter 4. Linear Differential Equations. Page 183
Problem number : 45
Date solved : Sunday, March 30, 2025 at 03:23:54 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

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