22.1.4 problem 4

Internal problem ID [4310]
Book : Differential equations for engineers by Wei-Chau XIE, Cambridge Press 2010
Section : Chapter 2. First-Order and Simple Higher-Order Differential Equations. Page 78
Problem number : 4
Date solved : Tuesday, September 30, 2025 at 07:17:10 AM
CAS classification : [_separable]

\begin{align*} x \left (y^{2}+1\right )+\left (2 y+1\right ) {\mathrm e}^{-x} y^{\prime }&=0 \end{align*}
Maple. Time used: 0.008 (sec). Leaf size: 28
ode:=x*(1+y(x)^2)+(2*y(x)+1)*exp(-x)*diff(y(x),x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \tan \left (\operatorname {RootOf}\left (x \,{\mathrm e}^{x}+\ln \left (2\right )+\ln \left (\frac {1}{\cos \left (2 \textit {\_Z} \right )+1}\right )+\textit {\_Z} -{\mathrm e}^{x}+c_1 \right )\right ) \]
Mathematica. Time used: 0.399 (sec). Leaf size: 43
ode=x*(y[x]^2+1)+(2*y[x]+1)*Exp[-x]*D[y[x],x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \text {InverseFunction}\left [\log \left (\text {$\#$1}^2+1\right )+\arctan (\text {$\#$1})\&\right ]\left [-e^x (x-1)+c_1\right ]\\ y(x)&\to -i\\ y(x)&\to i \end{align*}
Sympy. Time used: 0.266 (sec). Leaf size: 20
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*(y(x)**2 + 1) + (2*y(x) + 1)*exp(-x)*Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ - \left (1 - x\right ) e^{x} + \log {\left (y^{2}{\left (x \right )} + 1 \right )} + \operatorname {atan}{\left (y{\left (x \right )} \right )} = C_{1} \]