Position of two bodies as a function of time, special case I'm looking for a closed equation like $x=f(t)$ (if there is) for a simplified case of the two bodies problem:
Suppose that we have two point-like objects with the same mass, nothing more than their own gravity is effected on them.
The initial distance between them is $D$. As the gravity force acts on them, they slowly speed up, reaching each other (let's say that they cannot collide), then begin to move away from each other.
The following facts can be considered:


*

*They and their velocity vector are always in a line with their mutual barycenter point.

*The barycenter is always exactly halfway between them.

*The force and the acceleration is increasing to infinity until they reach each other at the barycenter.

*The total energy of the system is constant, the given potential energy transforms to kinetic energy, and vice versa.

*The maximum speed is not infinite, can be calculated easily.

*If there is an $x=f(t)$ function, then $f$ is a periodic function. If $x$ represents the current distance between the two objects, then $0\le x\le D$


Please help me to find the correct formula to calculate the distance $(x)$ in function of time.
If there is no closed-form expression for this, then please suggest another simple way to calculate it.
Thank you!
 A: In a 1D geometry the problem is mostly analytically solvable. Start with the total energy of the system,
$$
\frac12\mu\dot x^2-\frac kx=E,
$$
where $E$ is the total energy, $k$ is the interaction constant, $\mu$ is the reduced mass, $x$ is the relative separation, and the usual variable separation into centre-of-mass and relative coordinates has already been performed. By solving for the velocity,
$$
\frac{\text dx}{\text dt}=\pm\sqrt{\frac{2}{\mu}\left(E+\frac kx\right)},\tag1
$$
dividing by the right-hand side and integrating,
$$
\pm\int_{x_0}^x\frac{\text dx}{\sqrt{\frac{2}{\mu}\left(E+\frac kx\right)}}=\int_{t_0}^t\text dt,
$$
you can obtain a relation between the time $t$ and the position $x$ at that time:
$$
\pm\sqrt{\frac{2}{\mu}}(t-t_0)=\frac{\sqrt{x(Ex+k)}}{E}-\frac{\sqrt{x_0(Ex_0+k)}}{E}-\frac{k}{E^{3/2}}\ln\left(\frac{E\sqrt{x}+\sqrt{E(k+Ex)}}{E\sqrt{x_0}+\sqrt{E(k+Ex_0)}}\right).
$$
Unfortunately, that's as far as analytics go, and this relation cannot be inverted to give $x$ as a function of $t$ as you requested. However, this is enough to make any plot, table or calculation you may want to make quite easy to do.
From the points you list, 1-4 are indeed correct. However, point 5 is not: at the collision time at $x=0$, the velocity in (1) is indeed infinite. Whether the trajectory is periodic or not depends on what you do at the collision point; the equations so far cannot say what happens after that.
However, you can prove that they do meet at a finite time, and provide a closed expression for this. Assuming they start at a distance $D$ at time $t_0=0$ and start approaching, the result becomes
$$
-\sqrt{\frac{2}{\mu}}t=\frac{\sqrt{x(Ex+k)}}{E}-\frac{\sqrt{D(ED+k)}}{E}-\frac{k}{E^{3/2}}\ln\left(\frac{E\sqrt{x}+\sqrt{E(k+Ex)}}{E\sqrt{D}+\sqrt{E(k+ED)}}\right).
$$
At the collision time $t=T$, $x$ will be zero, which means that
$$
T=\int_0^T\text dt=\sqrt{\frac{\mu}{2}}\int_0^D\frac{\text dx}{\sqrt{E+\frac kx}}
=\sqrt{\frac{\mu}{2}\frac{D}{k}}\int_0^D\frac{\sqrt{x}}{\sqrt{D-x}}\text dx
,
$$
since $E=-k/D$. This integrates easily, using the substitution $x=D\sin^2(\theta)$, to
$$
T=\sqrt{\frac{\mu}{8k}}\pi D^{3/2},
$$
which is fully consistent with Kepler's third law. This time $T$ can be one half of the motion's period, in the case where they bounce back elastically, or one-quarter of the period, in the case where they miss each other by an infinitesimal amount (or simply go past each other without a collision) and continue on the other side. This is essentially all that you can get out of the problem.
A: Assuming the force is inverse square law, you could solve a non-linear differential equation of the form
$$m\ddot x + Kx^{-2} = 0$$
For some guidance, see this question and answer at our sister mathematics site.  Also, see this Wikipedia section on one-dimensional central force problem.
A: There is no explicit solution for the position as a function of time. Here are a three related questions: 1, 2 and 3.
This path is basically a Kepler orbit with zero angular momentum. This means that the eccentricity is equal to one and the semi-major axis is your case equal to $\frac{D}{2}$.
From such an orbit you can find an expression for the velocity and other higher derivatives of the position as a function of position.
For example is your case the velocity would be:
$$
v(x)=\sqrt{\frac{\mu\left(2a-x\right)}{ax}}
$$
where $a$ is the semi-major axis and $\mu$ the effective gravitational parameter.
The effective gravitational parameter would in this case be equal to: $\mu=\frac{Gm}{4}$,
where $G$ is gravitational constant and $m$ the mass of each object.
However the velocity will tend to go to infinity when the position/distance goes to zero, so your 6th point will not be satisfied.
