28.1.35 problem 35

Internal problem ID [4341]
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 : 35
Date solved : Sunday, March 30, 2025 at 03:05:57 AM
CAS classification : [[_1st_order, _with_linear_symmetries], _rational]

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

Maple. Time used: 0.005 (sec). Leaf size: 55
ode:=2*y(x)*(x+y(x)+2)+(y(x)^2-x^2-4*x-1)*diff(y(x),x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\begin{align*} y &= -x -2+\frac {c_1}{2}-\frac {\sqrt {12+c_1^{2}+\left (-4 x -8\right ) c_1}}{2} \\ y &= -x -2+\frac {c_1}{2}+\frac {\sqrt {12+c_1^{2}+\left (-4 x -8\right ) c_1}}{2} \\ \end{align*}
Mathematica. Time used: 0.415 (sec). Leaf size: 74
ode=2*y[x]*(x+y[x]+2)+(y[x]^2-x^2-4*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 (-2 x-\sqrt {4 (-4+c_1) x-4+c_1{}^2}-c_1\right ) \\ y(x)\to \frac {1}{2} \left (-2 x+\sqrt {4 (-4+c_1) x-4+c_1{}^2}-c_1\right ) \\ y(x)\to 0 \\ \end{align*}
Sympy. Time used: 2.506 (sec). Leaf size: 70
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((2*x + 2*y(x) + 4)*y(x) + (-x**2 - 4*x + y(x)**2 - 1)*Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = - x - \frac {\sqrt {4 x e^{C_{1}} + e^{2 C_{1}} + 8 e^{C_{1}} + 12}}{2} - \frac {e^{C_{1}}}{2} - 2, \ y{\left (x \right )} = - x + \frac {\sqrt {4 x e^{C_{1}} + e^{2 C_{1}} + 8 e^{C_{1}} + 12}}{2} - \frac {e^{C_{1}}}{2} - 2\right ] \]