28.1.38 problem 38

Internal problem ID [4344]
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 : 38
Date solved : Tuesday, March 04, 2025 at 06:27:09 PM
CAS classification : [_rational, [_Abel, `2nd type`, `class A`]]

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

Maple. Time used: 0.005 (sec). Leaf size: 63
ode:=y(x)*(x+y(x))+(x+2*y(x)-1)*diff(y(x),x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\begin{align*} y \left (x \right ) &= -\frac {x}{2}+\frac {1}{2}+\frac {\sqrt {{\mathrm e}^{x} \left (\left (x -1\right )^{2} {\mathrm e}^{x}-4 c_{1} \right )}\, {\mathrm e}^{-x}}{2} \\ y \left (x \right ) &= -\frac {x}{2}+\frac {1}{2}-\frac {\sqrt {{\mathrm e}^{x} \left (\left (x -1\right )^{2} {\mathrm e}^{x}-4 c_{1} \right )}\, {\mathrm e}^{-x}}{2} \\ \end{align*}
Mathematica. Time used: 11.798 (sec). Leaf size: 80
ode=y[x]*(x+y[x])+(x+2*y[x]-1)*D[y[x],x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \frac {1}{2} \left (-x-\frac {\sqrt {e^x (x-1)^2+4 c_1}}{\sqrt {e^x}}+1\right ) \\ y(x)\to \frac {1}{2} \left (-x+\frac {\sqrt {e^x (x-1)^2+4 c_1}}{\sqrt {e^x}}+1\right ) \\ \end{align*}
Sympy. Time used: 2.045 (sec). Leaf size: 75
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((x + y(x))*y(x) + (x + 2*y(x) - 1)*Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = - \frac {x}{2} - \frac {\sqrt {C_{1} + x^{2} e^{x} - 2 x e^{x} + e^{x}} e^{- \frac {x}{2}}}{2} + \frac {1}{2}, \ y{\left (x \right )} = - \frac {x}{2} + \frac {\sqrt {C_{1} + x^{2} e^{x} - 2 x e^{x} + e^{x}} e^{- \frac {x}{2}}}{2} + \frac {1}{2}\right ] \]