2.100   ODE No. 100

\[ a+x y'(x)+x y(x)^2=0 \] Mathematica : cpu = 0.0812626 (sec), leaf count = 199

DSolve[a + x*y[x]^2 + x*Derivative[1][y][x] == 0,y[x],x]
 

\[\left \{\left \{y(x)\to -\frac {\frac {i \sqrt {a} \operatorname {BesselY}\left (1,2 \sqrt {a} \sqrt {x}\right )}{\sqrt {x}}+i a \left (\operatorname {BesselY}\left (0,2 \sqrt {a} \sqrt {x}\right )-\operatorname {BesselY}\left (2,2 \sqrt {a} \sqrt {x}\right )\right )+c_1 \left (\frac {\sqrt {a} \operatorname {BesselJ}\left (1,2 \sqrt {a} \sqrt {x}\right )}{2 \sqrt {x}}+\frac {1}{2} a \left (\operatorname {BesselJ}\left (0,2 \sqrt {a} \sqrt {x}\right )-\operatorname {BesselJ}\left (2,2 \sqrt {a} \sqrt {x}\right )\right )\right )}{-2 i \sqrt {a} \sqrt {x} \operatorname {BesselY}\left (1,2 \sqrt {a} \sqrt {x}\right )-\sqrt {a} c_1 \sqrt {x} \operatorname {BesselJ}\left (1,2 \sqrt {a} \sqrt {x}\right )}\right \}\right \}\] Maple : cpu = 0.046 (sec), leaf count = 59

dsolve(x*diff(y(x),x)+x*y(x)^2+a = 0,y(x))
 

\[y \left (x \right ) = \frac {\sqrt {a}\, \left (\operatorname {BesselJ}\left (0, 2 \sqrt {a}\, \sqrt {x}\right ) c_{1}+\operatorname {BesselY}\left (0, 2 \sqrt {a}\, \sqrt {x}\right )\right )}{\sqrt {x}\, \left (c_{1} \operatorname {BesselJ}\left (1, 2 \sqrt {a}\, \sqrt {x}\right )+\operatorname {BesselY}\left (1, 2 \sqrt {a}\, \sqrt {x}\right )\right )}\]

Hand solution

\begin {align*} xy^{\prime }+xy^{2}+a & =0\\ y^{\prime } & =-\frac {a}{x}-y^{2} \end {align*}

This is Riccati first order non-linear. Let \(y=-\frac {u^{\prime }}{uR}=\frac {u^{\prime }}{u}\), hence \(y^{\prime }=\frac {u^{\prime \prime }}{u}-\frac {\left ( u^{\prime }\right ) ^{2}}{u^{2}}\). Equating this to RHS of the above gives\begin {align*} \frac {u^{\prime \prime }}{u}-\frac {\left ( u^{\prime }\right ) ^{2}}{u^{2}} & =-\frac {a}{x}-\left ( \frac {u^{\prime }}{u}\right ) ^{2}\\ \frac {u^{\prime \prime }}{u} & =-\frac {a}{x}\\ u^{\prime \prime }+\frac {a}{x}u & =0 \end {align*}

This is linear second order, an Emden Fowler ODE, with removal singularity. Solved using power series method. The solution is\[ u=C_{1}\sqrt {x}\operatorname {BesselJ}\left ( 1,2\sqrt {ax}\right ) +C_{2}\sqrt {x}\operatorname {BesselY}\left ( 1,2\sqrt {ax}\right ) \] But \[ \frac {d}{dx}\operatorname {BesselJ}\left ( 1,2\sqrt {ax}\right ) =\frac {\sqrt {a}}{\sqrt {x}}\left ( \operatorname {BesselJ}\left ( 0,2\sqrt {ax}\right ) -\frac {1}{2}\frac {1}{\sqrt {ax}}\operatorname {BesselJ}\left ( 1,2\sqrt {ax}\right ) \right ) \] And\[ \frac {d}{dx}\operatorname {BesselY}\left ( 1,2\sqrt {ax}\right ) =\frac {\sqrt {a}}{\sqrt {x}}\left ( \operatorname {BesselY}\left ( 0,2\sqrt {ax}\right ) -\frac {1}{2}\frac {1}{\sqrt {ax}}\operatorname {BesselY}\left ( 1,2\sqrt {ax}\right ) \right ) \] Therefore, \begin {align*} u^{\prime } & =C_{1}\left ( \frac {1}{2\sqrt {x}}\operatorname {BesselJ}\left ( 1,2\sqrt {a}\sqrt {x}\right ) +\sqrt {x}\frac {\sqrt {a}}{\sqrt {x}}\left ( \operatorname {BesselJ}\left ( 0,2\sqrt {a}\sqrt {x}\right ) -\frac {1}{2}\frac {1}{\sqrt {ax}}\operatorname {BesselJ}\left ( 1,2\sqrt {a}\sqrt {x}\right ) \right ) \right ) \\ & +C_{2}\left ( \frac {1}{2\sqrt {x}}\operatorname {BesselY}\left ( 1,2\sqrt {a}\sqrt {x}\right ) +\sqrt {x}\frac {\sqrt {a}}{\sqrt {x}}\left ( \operatorname {BesselY}\left ( 0,2\sqrt {ax}\right ) -\frac {1}{2}\frac {1}{\sqrt {ax}}\operatorname {BesselY}\left ( 1,2\sqrt {a}\sqrt {x}\right ) \right ) \right ) \end {align*}

Which is simplified to\[ u^{\prime }=C_{1}\sqrt {a}\operatorname {BesselJ}\left ( 0,2\sqrt {a}\sqrt {x}\right ) +C_{2}\sqrt {a}\operatorname {BesselY}\left ( 0,2\sqrt {a}\sqrt {x}\right ) \] Therefore, from \(y=\frac {u^{\prime }}{u}\), the solution is\[ y=\frac {C_{1}\sqrt {a}\operatorname {BesselJ}\left ( 0,2\sqrt {a}\sqrt {x}\right ) +C_{2}\sqrt {a}\operatorname {BesselY}\left ( 0,2\sqrt {a}\sqrt {x}\right ) }{C_{1}\sqrt {x}\operatorname {BesselJ}\left ( 1,2\sqrt {a}\sqrt {x}\right ) +C_{2}\sqrt {x}\operatorname {BesselY}\left ( 1,2\sqrt {a}\sqrt {x}\right ) }\] Let \(C=\frac {C_{1}}{C_{2}}\), hence\[ y=\frac {C\sqrt {a}\operatorname {BesselJ}\left ( 0,2\sqrt {a}\sqrt {x}\right ) +\ \sqrt {a}\operatorname {BesselY}\left ( 0,2\sqrt {a}\sqrt {x}\right ) }{C\sqrt {x}\operatorname {BesselJ}\left ( 1,2\sqrt {a}\sqrt {x}\right ) +\ \sqrt {x}\operatorname {BesselY}\left ( 1,2\sqrt {a}\sqrt {x}\right ) }\] Verification

restart; 
ode:=x*diff(y(x),x)+x*y(x)^2+a=0; 
num:=_C1*sqrt(a)*BesselJ(0,2*sqrt(a)*sqrt(x))+sqrt(a)*BesselY(0,2*sqrt(a)*sqrt(x)); 
den:=_C1*sqrt(x)*BesselJ(1,2*sqrt(a)*sqrt(x))+sqrt(x)*BesselY(1,2*sqrt(a)*sqrt(x)); 
my_solution:=num/den; 
odetest(y(x)=my_solution,ode); 
0