I am building a two body problem simulation in one dimension (plus time). Two masses m1, m2 at rest that start moving because of gravitation attraction and eventually meet.
I read that the problem has no closed form solution, so I opted for a numerical one (leapfrog). However, searching here I found several expressions for the velocity of the bodies (something that I need in order to depict the orthogonal curves to the (spacetime) trajectory of the bodies, which is the ultimate goal of the simulation, hence the title.) For instance:
$$v=\sqrt{\frac{2G(M+m)}{r}-\frac{2G(M+m)}{r_0}}$$
$$v=\sqrt{\int_{r_1}^{r_2} \left(\frac{2 G M}{r^2}+\frac{v_0^2}{r_1-r_2}\right) \, \text{d}r}$$
I may have found one or two more that I can't locate now.
So my question is, is there a non numerical solution for this problem -- and I mean a solution that gives you algebraic equations for x1, x2, v1, v2 that I can use in the simulation (not integrals that may or may not be solvable). If so, what is it? Is any of the above expressions correct? (Please no polar coordinates if possible.)
Responding to the first comment below, the equations I am using are the usual equations for the two body problem:
$$F_1=G\frac{m_1m_2}{(x_1-x_2)^2}$$
therefore
$$\frac{d^2x_1}{dt^2}=G\frac{m2}{(x_1-x_2)^2}$$
As I have mentioned, I am using numerical leapfrog integration.