I am trying to create a simulation for a gravitational 2 body problem. But I am kind of having trouble to define the equations that can be solve numerically. From an inertial frame I defined the position of the two objects as the $\vec{r}_1$ and $\vec{r}_2$ with masses $m_1$ and $m_2$.
Let the $\vec{R}_{CM}$ be the position of the CM of the objects. Now from the perspective of the CM, we can write position vectors of the objects in terms of $\vec{r}'_1$ and $\vec{r}'_2$.
In this case
$$\vec{r}'_1 = \frac{-m_2}{m_1 + m_2} \vec{r} \tag{1}$$
and $$\vec{r}'_2 = \frac{m_1}{m_1 + m_2} \vec{r} \tag{2}$$where $\vec{r}= \vec{r}'_2 - \vec{r}'_1$
Now in this case we can use the reduced mass and define the force on this mass. So we have,
$$\vec{F} = \mu \ddot{\vec{r}} = -Gm_1\mu / r^2 \vec{r}$$
Now I need to solve this equation and put back into the (1) and (2) right ?