22.2.36 problem 36

Internal problem ID [4479]
Book : Differential equations for engineers by Wei-Chau XIE, Cambridge Press 2010
Section : Chapter 4. Linear Differential Equations. Page 183
Problem number : 36
Date solved : Tuesday, September 30, 2025 at 07:33:02 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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