# Solving simple mass-spring ODE system

Been a long time since I've solved ODE's analytically, and having trouble solving this simple system:

\begin{align} \frac{dx}{dt} &= v \\ \frac{dv}{dt} &= -\frac{k}{m}\frac{\ln(x)}{x} \\ x(0) &= x_0, \ v(0) = v_0 \end{align}

My approach:

\begin{align} \frac{dv}{dt} &= \frac{dv}{dx}\frac{dx}{dt} \quad \quad \text{chain rule} \\ \implies \frac{dv}{dt} &= v\frac{dv}{dx} \quad \quad \text{definition of dx/dt} \\ \implies v\frac{dv}{dx} &= -\frac{k}{m}\frac{\ln(x)}{x} \quad \quad \text{definition of dv/dt} \\ \implies v dv &= -\frac{k}{m} \frac{\ln(x)}{x}dx \quad \quad \text{multiply each side by dx} \\ \implies \int vdv &= -\frac{k}{m} \int \frac{\ln(x)}{x} dx \quad \quad \text{integrate each side} \\ \implies \frac{v^2}{2} &= -\frac{k}{m} \frac{\ln^2(x)}{2} + C \quad \quad \text{result of integral} \\ \implies v &= \pm \sqrt{-\frac{k}{m} \ln^2(x)} + C \quad \quad \text{multiply each side by 2, take square root of each side} \end{align}

The result clearly isn't right as the velocity is complex for all (real) displacements. Also checked by substituting in my numerical solution for $x$ and comparing the $v$ determined above to the numerical solution of $v$. Of course they are quite different.

Anyways, was wondering if anyone could point out where I've gone wrong or give a hint as to a better way to determine $x$ and $v$. Thank you!

• The square root in the line $v = \pm \dots$ should encompass the $+ C$. In which case you get complex solutions iff $C < -\frac{k}{m} \ln^{2} x$. – mattos Nov 15 '17 at 3:51

First of all, I'm not sure how the $+C$ escaped from inside the square root in your solution $$v(x) = \pm \sqrt{C- (k/m) \log^2 x};$$
And in particular $v_0^2 = C - \frac{k}{m}\log^2 x_0,$ so $$v(x) = \pm \sqrt{v_0^2 + (k/m)\left(\log^2 x_0 - \log^2 x\right)}.$$
Now you originally wanted to solve for $x$ and $v$ as a function of time, so you still need to solve $$\frac{dx}{dt} = \pm \sqrt{v_0^2 + (k/m)\left(\log^2 x_0 - \log^2 x\right)};$$ this is a separable ODE but there seems to be slim chance of an analytic solution.