10.6.15 problem 15

Internal problem ID [1232]
Book : Elementary differential equations and boundary value problems, 10th ed., Boyce and DiPrima
Section : Miscellaneous problems, end of chapter 2. Page 133
Problem number : 15
Date solved : Saturday, March 29, 2025 at 10:48:34 PM
CAS classification : [_separable]

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

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