64.2.3 problem 2(b)

Internal problem ID [13192]
Book : Differential Equations by Shepley L. Ross. Third edition. John Willey. New Delhi. 2004.
Section : Chapter 1, section 1.3. Exercises page 22
Problem number : 2(b)
Date solved : Monday, March 31, 2025 at 07:36:41 AM
CAS classification : [[_linear, `class A`]]

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

With initial conditions

\begin{align*} y \left (-1\right )&={\mathrm e}+3 \end{align*}

Maple. Time used: 0.044 (sec). Leaf size: 17
ode:=diff(y(x),x)+y(x) = 2*x*exp(-x); 
ic:=y(-1) = exp(1)+3; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = \left (x^{2}+3 \,{\mathrm e}^{-1}\right ) {\mathrm e}^{-x} \]
Mathematica. Time used: 0.057 (sec). Leaf size: 20
ode=D[y[x],x]+y[x]==2*x*Exp[-x]; 
ic={y[-1]==Exp[1]+3}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^{-x-1} \left (e x^2+3\right ) \]
Sympy. Time used: 0.169 (sec). Leaf size: 14
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*x*exp(-x) + y(x) + Derivative(y(x), x),0) 
ics = {y(-1): E + 3} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (x^{2} + \frac {3}{e}\right ) e^{- x} \]