38.2.7 problem 7

Internal problem ID [6436]
Book : Engineering Mathematics. By K. A. Stroud. 5th edition. Industrial press Inc. NY. 2001
Section : Program 24. First order differential equations. Further problems 24. page 1068
Problem number : 7
Date solved : Sunday, March 30, 2025 at 10:58:31 AM
CAS classification : [[_homogeneous, `class A`], _rational, [_Abel, `2nd type`, `class B`]]

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

Maple. Time used: 0.012 (sec). Leaf size: 17
ode:=x*y(x)+y(x)^2+(x^2-x*y(x))*diff(y(x),x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\operatorname {LambertW}\left (-\frac {{\mathrm e}^{-2 c_1}}{x^{2}}\right ) x \]
Mathematica. Time used: 2.614 (sec). Leaf size: 25
ode=(x*y[x]+y[x]^2)+(x^2-x*y[x])*D[y[x],x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to -x W\left (-\frac {e^{-c_1}}{x^2}\right ) \\ y(x)\to 0 \\ \end{align*}
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*y(x) + (x**2 - x*y(x))*Derivative(y(x), x) + y(x)**2,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
RecursionError : maximum recursion depth exceeded