64.4.2 problem 2

Internal problem ID [13220]
Book : Differential Equations by Shepley L. Ross. Third edition. John Willey. New Delhi. 2004.
Section : Chapter 2, section 2.2 (Separable equations). Exercises page 47
Problem number : 2
Date solved : Monday, March 31, 2025 at 07:39:50 AM
CAS classification : [_separable]

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

Maple. Time used: 0.002 (sec). Leaf size: 15
ode:=x*y(x)+2*x+y(x)+2+(x^2+2*x)*diff(y(x),x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = -2+\frac {c_1}{\sqrt {x \left (x +2\right )}} \]
Mathematica. Time used: 0.169 (sec). Leaf size: 92
ode=(x*y[x]+2*x+y[x]+2)+(x^2+2*x)*D[y[x],x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \exp \left (\int _1^x-\frac {K[1]+1}{K[1]^2+2 K[1]}dK[1]\right ) \left (\int _1^x-\frac {2 \exp \left (-\int _1^{K[2]}-\frac {K[1]+1}{K[1]^2+2 K[1]}dK[1]\right ) (K[2]+1)}{K[2] (K[2]+2)}dK[2]+c_1\right ) \\ y(x)\to -2 \\ \end{align*}
Sympy. Time used: 0.326 (sec). Leaf size: 14
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*y(x) + 2*x + (x**2 + 2*x)*Derivative(y(x), x) + y(x) + 2,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {C_{1}}{\sqrt {x \left (x + 2\right )}} - 2 \]