4.5.6 \(x y'(x)=y(x)-\cot ^2(y(x))\)

ODE
\[ x y'(x)=y(x)-\cot ^2(y(x)) \] ODE Classification

[_separable]

Book solution method
Homogeneous equation

Mathematica
cpu = 89.6717 (sec), leaf count = 48

\[\left \{\left \{y(x)\to \text {InverseFunction}\left [\int _1^{\text {$\#$1}} \frac {\cos (2 K[1])-1}{-K[1]+K[1] \cos (2 K[1])+\cos (2 K[1])+1} \, dK[1]\& \right ]\left [c_1+\log (x)\right ]\right \}\right \}\]

Maple
cpu = 0.204 (sec), leaf count = 24

\[ \left \{ \ln \relax (x ) -\int ^{y \relax (x ) }\! \left (- \left (\cot \left ({\it \_a} \right ) \right ) ^{2}+{\it \_a} \right ) ^{-1}{d{\it \_a}}+{\it \_C1}=0 \right \} \] Mathematica raw input

DSolve[x*y'[x] == -Cot[y[x]]^2 + y[x],y[x],x]

Mathematica raw output

{{y[x] -> InverseFunction[Integrate[(-1 + Cos[2*K[1]])/(1 + Cos[2*K[1]] - K[1] +
 Cos[2*K[1]]*K[1]), {K[1], 1, #1}] & ][C[1] + Log[x]]}}

Maple raw input

dsolve(x*diff(y(x),x) = y(x)-cot(y(x))^2, y(x),'implicit')

Maple raw output

ln(x)-Intat(1/(-cot(_a)^2+_a),_a = y(x))+_C1 = 0