Solution to Nonlinear ODE $s''( t) s( t) =( s'( t))^{2} +B( s( t))^{2} s'( t) -g\cdot s( t) s'( t)$

I've solved linear ODEs before. This however is something completely new to me. I want to solve it without using approximations or anything.

$s''( t) s( t) =( s'( t))^{2} +B( s( t))^{2} s'( t) -g\cdot s( t) s'( t)$

These are the equations I started with

$ \begin{array}{l} s'( t) =-Bs( t) i( t)\\ r'( t) =g\cdot i( t)\\ i'( t) =i( t)( Bs( t) -g) \end{array}$

The reason I'm solving this particular equation is because I want to solve for all of the functions $(i(t),r(t),s(t))$ from above.

I just figured $s(t)$ might be the place to start. I really don't have any clue where to start here. Any help would be awesome! Thanks!

--edit-- I made a mistake above. In order to fix it I changed $i'( t) =i( t)( Bs( t) -1)$ to this $i'( t) =i( t)( Bs( t) -g)$. My bad...

---Edit---

I might have a step towards the answer.

$ \begin{array}{l} v( s) =s'( t)\\ \Longrightarrow \\ s''( t) =\frac{dv( s)}{dt} =\frac{dv}{ds}\frac{ds}{dt} =v'( s) \cdot \frac{ds}{dt} =v'( s) \cdot v( s)\\ \Longrightarrow \\ v'( s) \cdot v( s) s=v( t)^{2} +Bs^{2} v( t) -g\cdot s\cdot v( t)\\ \Longrightarrow \\ v'( s) \cdot s=v( t) +Bs^{2} -g\cdot s \end{array}$

Wolfram Alpha says that the solution to this differential equation is

$v(s)=Bs^2+c_1s-gsln(s)$

So that means that

$s'(t)=Bs(t)^2+c_1s(t)-gs(t)\ln(s(t))$

This is certainly better than before


Me and my friend got it! (This was also exactly what Sal in the comments suggested doing) $ \begin{array}{l} v( s) =s'( t) \Longrightarrow \\ \frac{dv( s)}{dt} =\frac{dv( s)}{ds} \cdot \frac{ds}{dt} =v'( s) \cdot v( s) \ \text{literally the chain rule}\\ \Longrightarrow \\ v'( s) \cdot v( s) \cdot s=v( s)^{2} +Bs^{2} v( s) -gv( s) s\\ \\ \therefore v'( s) s=v( s) +Bs^{2} -gs \end{array}$

Next find an integrating factor.

$ \begin{array}{l} v'( s) -\frac{v( s)}{s} =Bs-g\\ integrating\ factor\ I=e^{\int \frac{1}{s} ds} =\frac{1}{s} \end{array}$

Multiply both sides of the equation by the integrating factor.

$Iv'( s) -I\frac{1}{s} v( s) =I( Bs-g)$

The really interesting thing that makes this work is $\frac{d} {ds}(Iv(s))=Iv'(s)-I\frac{1}{s}v(s)$

$ \begin{array}{l} \therefore \frac{d( Iv( s))}{dt} =I( Bs-g)\\ \Longrightarrow \\ Iv( s) =\int I( Bs-g) ds=\int \left( B-\frac{g}{s}\right) ds=Bs-ln( s) +c_{1} \end{array}$

So we get

$v( s) =Bs^{2} +c_{1} s-gsln( s) \Longrightarrow s'( t) =Bs( t)^{2} +c_{1} s( t) -gs( t) ln( s( t))$

Next just split the derivative and integrate

$1dt=\frac{1}{Bs( t)^{2} +c_{1} s( t) -gs( t) ln( s( t))} ds \Longrightarrow t+c_{2} =\int \frac{1}{Bs( t)^{2} +c_{1} s( t) -gs( t) ln( s( t))} ds$

Solving for the constants we get

$ \begin{array}{l} at\ t=0\\ s'( 0) =Bs( 0)^{2} +c_{1} s( 0) -gs( 0) ln( s( 0))\\ and\ we\ know\ that\ s'( t) =-Bs( t) i( t)\\ \\ s'( 0) =-Bs( 0) i( 0)\\ \Longrightarrow \\ -Bs_{0} i_{0} =Bs_{0}^{2} +c_{1} s_{0} -gs_{0} ln( s_{0})\\ \Longrightarrow \\ c_{1} =gln( s_{0}) +B( s_{0} -i_{0})\\ c_{2} =\int _{0}^{s( 0)}\frac{1}{B\omega ^{2} +c_{1} \omega -g\omega ln( \omega )} d\omega =\int _{0}^{s_{0}}\frac{1}{B\omega ^{2} +( gln( s_{0}) +B( s_{0} -i_{0})) \omega -g\omega ln( \omega )} d\omega \\ \\ \therefore t=\\ \int\limits _{0}^{s( t)}\frac{1}{B\omega ^{2} +( gln( s_{0}) +B( s_{0} -i_{0})) \omega -g\omega ln( \omega )} d\omega -\int\limits _{0}^{s_{0}}\frac{1}{B\omega ^{2} +( gln( s_{0}) +B( s_{0} -i_{0})) \omega -g\omega ln( \omega )} d\omega \end{array}$

We can combine the integrals because of their limits

$t=\int _{s_{0}}^{s( t)}\frac{1}{B\omega ^{2} +( gln( s_{0}) +B[ s_{0} -i_{0}]) \omega -g\omega ln( \omega )} d\omega $

Desmos graphs this in its current form, but if you wanted $s(t)=$something then the Lagrange Inversion theorem probably works here. enter image description here

Edit... I was actually able to graph all three functions for the SIR model in desmos (green equation is s(t), red i(t) blue r(t)) desmos graph for SIR model enter image description here