37.2.8 problem 10.3.9 (a)

Internal problem ID [6405]
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 : Wednesday, March 05, 2025 at 12:39:16 AM
CAS classification : [_separable]

\begin{align*} y^{\prime }+x y&=x y^{2} \end{align*}

Maple. Time used: 0.003 (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.271 (sec). Leaf size: 31
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 \frac {1}{1+e^{\frac {x^2}{2}+c_1}} \\ y(x)\to 0 \\ y(x)\to 1 \\ \end{align*}
Sympy. Time used: 1.984 (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 ] \]