71.6.12 problem 12

Internal problem ID [14347]
Book : Ordinary Differential Equations by Charles E. Roberts, Jr. CRC Press. 2010
Section : Chapter 2. The Initial Value Problem. Exercises 2.3.2, page 63
Problem number : 12
Date solved : Monday, March 31, 2025 at 12:18:43 PM
CAS classification : [_separable]

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

Maple. Time used: 0.004 (sec). Leaf size: 34
ode:=2*x*y(x)*diff(y(x),x)+y(x)^2 = -1; 
dsolve(ode,y(x), singsol=all);
 
\begin{align*} y &= \frac {\sqrt {x \left (-x +c_1 \right )}}{x} \\ y &= -\frac {\sqrt {x \left (-x +c_1 \right )}}{x} \\ \end{align*}
Mathematica. Time used: 0.297 (sec). Leaf size: 98
ode=2*x*y[x]*D[y[x],x]+y[x]^2==-1; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to -\frac {\sqrt {-x+e^{2 c_1}}}{\sqrt {x}} \\ y(x)\to \frac {\sqrt {-x+e^{2 c_1}}}{\sqrt {x}} \\ y(x)\to -i \\ y(x)\to i \\ y(x)\to \frac {\sqrt {-x}}{\sqrt {x}} \\ y(x)\to \frac {\sqrt {x}}{\sqrt {-x}} \\ \end{align*}
Sympy. Time used: 0.476 (sec). Leaf size: 22
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(2*x*y(x)*Derivative(y(x), x) + y(x)**2 + 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = \sqrt {\frac {C_{1}}{x} - 1}, \ y{\left (x \right )} = - \sqrt {\frac {C_{1}}{x} - 1}\right ] \]