15.14.15 problem 15

Internal problem ID [3187]
Book : Differential Equations by Alfred L. Nelson, Karl W. Folley, Max Coral. 3rd ed. DC heath. Boston. 1964
Section : Exercise 23, page 106
Problem number : 15
Date solved : Tuesday, March 04, 2025 at 04:05:31 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.006 (sec). Leaf size: 29
ode:=diff(diff(y(x),x),x)+diff(y(x),x)-2*y(x) = x*exp(-x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (4 c_2 \,{\mathrm e}^{3 x}+\left (-2 x +1\right ) {\mathrm e}^{x}+4 c_{1} \right ) {\mathrm e}^{-2 x}}{4} \]
Mathematica. Time used: 0.021 (sec). Leaf size: 34
ode=D[y[x],{x,2}]+D[y[x],x]-2*y[x]==x*Exp[-x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{4} e^{-x} (1-2 x)+c_1 e^{-2 x}+c_2 e^x \]
Sympy. Time used: 0.195 (sec). Leaf size: 24
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*exp(-x) - 2*y(x) + Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- 2 x} + C_{2} e^{x} + \frac {\left (1 - 2 x\right ) e^{- x}}{4} \]