# 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:

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.