48.2.5 problem Example 3.22

Internal problem ID [7521]
Book : THEORY OF DIFFERENTIAL EQUATIONS IN ENGINEERING AND MECHANICS. K.T. CHAU, CRC Press. Boca Raton, FL. 2018
Section : Chapter 3. Ordinary Differential Equations. Section 3.3 SECOND ORDER ODE. Page 147
Problem number : Example 3.22
Date solved : Sunday, March 30, 2025 at 12:13:29 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }-3 y^{\prime }+2 y&=x \,{\mathrm e}^{2 x} \end{align*}

Maple. Time used: 0.002 (sec). Leaf size: 26
ode:=diff(diff(y(x),x),x)-3*diff(y(x),x)+2*y(x) = x*exp(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {{\mathrm e}^{x} \left (2 c_2 +\left (x^{2}+2 c_1 -2 x +2\right ) {\mathrm e}^{x}\right )}{2} \]
Mathematica. Time used: 0.027 (sec). Leaf size: 33
ode=D[y[x],{x,2}]-3*D[y[x],x]+2*y[x]==x*Exp[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{2} e^x \left (e^x \left (x^2-2 x+2+2 c_2\right )+2 c_1\right ) \]
Sympy. Time used: 0.281 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*exp(2*x) + 2*y(x) - 3*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} + \left (C_{2} + \frac {x^{2}}{2} - x\right ) e^{x}\right ) e^{x} \]