40.11.3 problem 28

Internal problem ID [6737]
Book : Schaums Outline. Theory and problems of Differential Equations, 1st edition. Frank Ayres. McGraw Hill 1952
Section : Chapter 16. Linear equations with constant coefficients (Short methods). Supplemetary problems. Page 107
Problem number : 28
Date solved : Sunday, March 30, 2025 at 11:21:02 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

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