30.3.24 problem 25

Internal problem ID [7480]
Book : Fundamentals of Differential Equations. By Nagle, Saff and Snider. 9th edition. Boston. Pearson 2018.
Section : Chapter 2, First order differential equations. Section 2.4, Exact equations. Exercises. page 64
Problem number : 25
Date solved : Tuesday, September 30, 2025 at 04:38:13 PM
CAS classification : [_separable]

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

With initial conditions

\begin{align*} y \left (\pi \right )&=1 \\ \end{align*}
Maple. Time used: 0.368 (sec). Leaf size: 23
ode:=y(x)^2*sin(x)+(1/x-y(x)/x)*diff(y(x),x) = 0; 
ic:=[y(Pi) = 1]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = -\frac {1}{\operatorname {LambertW}\left (-{\mathrm e}^{\cos \left (x \right ) x +\pi -\sin \left (x \right )-1}\right )} \]
Mathematica. Time used: 88.465 (sec). Leaf size: 25
ode=( y[x]^2*Sin[x]  )+( 1/x-y[x]/x )*D[y[x],x]==0; 
ic={y[Pi]==1}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\frac {1}{W\left (-e^{-\sin (x)+x \cos (x)+\pi -1}\right )} \end{align*}
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((-y(x)/x + 1/x)*Derivative(y(x), x) + y(x)**2*sin(x),0) 
ics = {y(pi): 1} 
dsolve(ode,func=y(x),ics=ics)