12.5.48 problem 47

Internal problem ID [1672]
Book : Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
Section : Chapter 2, First order equations. Transformation of Nonlinear Equations into Separable Equations. Section 2.4 Page 68
Problem number : 47
Date solved : Saturday, March 29, 2025 at 11:25:33 PM
CAS classification : [[_1st_order, _with_linear_symmetries], _Riccati]

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

Maple. Time used: 0.014 (sec). Leaf size: 22
ode:=diff(y(x),x) = y(x)^2*exp(-x)+4*y(x)+2*exp(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {2 \,{\mathrm e}^{x} \left ({\mathrm e}^{x} c_1 -1\right )}{-2+{\mathrm e}^{x} c_1} \]
Mathematica. Time used: 0.28 (sec). Leaf size: 30
ode=D[y[x],x]==y[x]^2*Exp[-x]+4*y[x]+2*Exp[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to -2 e^x+\frac {1}{e^{-x}+c_1} \\ y(x)\to -2 e^x \\ \end{align*}
Sympy. Time used: 0.767 (sec). Leaf size: 20
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-y(x)**2*exp(-x) - 4*y(x) - 2*exp(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {\left (- 2 C_{1} e^{x} + 1\right ) e^{x}}{C_{1} e^{x} - 1} \]