31.2.8 problem 10.3.9 (a)

Internal problem ID [7693]
Book : Basic Training in Mathematics. By R. Shankar. Plenum Press. NY. 1995
Section : Chapter 10, Differential equations. Section 10.3, ODEs with variable Coefficients. First order. page 315
Problem number : 10.3.9 (a)
Date solved : Tuesday, September 30, 2025 at 04:56:06 PM
CAS classification : [_separable]

\begin{align*} y^{\prime }+x y&=x y^{2} \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 16
ode:=diff(y(x),x)+x*y(x) = x*y(x)^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {1}{1+{\mathrm e}^{\frac {x^{2}}{2}} c_1} \]
Mathematica. Time used: 0.148 (sec). Leaf size: 46
ode=D[y[x],x]+x*y[x]==x*y[x]^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \text {InverseFunction}\left [\int _1^{\text {$\#$1}}\frac {1}{(K[1]-1) K[1]}dK[1]\&\right ]\left [\frac {x^2}{2}+c_1\right ]\\ y(x)&\to 0\\ y(x)&\to 1 \end{align*}
Sympy. Time used: 1.323 (sec). Leaf size: 53
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*y(x)**2 + x*y(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = \frac {\sqrt {e^{2 C_{1} + x^{2}}} - 1}{e^{2 C_{1} + x^{2}} - 1}, \ y{\left (x \right )} = - \frac {\sqrt {e^{2 C_{1} + x^{2}}} + 1}{e^{2 C_{1} + x^{2}} - 1}\right ] \]