3 Body
3 Body
steps in detail. Here, we consider three bodies with masses \( m_1, m_2, \) and \
( m_3 \), positions \( \mathbf{r}_1, \mathbf{r}_2, \) and \( \mathbf{r}_3 \), and
velocities \( \mathbf{v}_1, \mathbf{v}_2, \) and \( \mathbf{v}_3 \).
\[
\begin{align*}
\frac{{d^2\mathbf{r}_1}}{{dt^2}} &= \frac{{G m_2 (\mathbf{r}_2 - \mathbf{r}_1)}}
{{|\mathbf{r}_2 - \mathbf{r}_1|^3}} + \frac{{G m_3 (\mathbf{r}_3 - \mathbf{r}_1)}}
{{|\mathbf{r}_3 - \mathbf{r}_1|^3}} \\
\frac{{d^2\mathbf{r}_2}}{{dt^2}} &= \frac{{G m_1 (\mathbf{r}_1 - \mathbf{r}_2)}}
{{|\mathbf{r}_1 - \mathbf{r}_2|^3}} + \frac{{G m_3 (\mathbf{r}_3 - \mathbf{r}_2)}}
{{|\mathbf{r}_3 - \mathbf{r}_2|^3}} \\
\frac{{d^2\mathbf{r}_3}}{{dt^2}} &= \frac{{G m_1 (\mathbf{r}_1 - \mathbf{r}_3)}}
{{|\mathbf{r}_1 - \mathbf{r}_3|^3}} + \frac{{G m_2 (\mathbf{r}_2 - \mathbf{r}_3)}}
{{|\mathbf{r}_2 - \mathbf{r}_3|^3}}
\end{align*}
\]
2. **Numerical Analysis**:
We solve the equations of motion using numerical methods. Euler's method or the
Runge-Kutta method can be employed for this purpose. In the case of the Runge-Kutta
method, we update the positions and velocities of each body as follows:
\[
\begin{align*}
\mathbf{r}_{1,\,i+1} &= \mathbf{r}_{1,\,i} + \mathbf{v}_{1,\,i} \cdot \Delta
t \\
\mathbf{v}_{1,\,i+1} &= \mathbf{v}_{1,\,i} + \frac{{\mathbf{F}_1}}{m_1} \cdot \
Delta t \\
\mathbf{r}_{2,\,i+1} &= \mathbf{r}_{2,\,i} + \mathbf{v}_{2,\,i} \cdot \Delta
t \\
\mathbf{v}_{2,\,i+1} &= \mathbf{v}_{2,\,i} + \frac{{\mathbf{F}_2}}{m_2} \cdot \
Delta t \\
\mathbf{r}_{3,\,i+1} &= \mathbf{r}_{3,\,i} + \mathbf{v}_{3,\,i} \cdot \Delta
t \\
\mathbf{v}_{3,\,i+1} &= \mathbf{v}_{3,\,i} + \frac{{\mathbf{F}_3}}{m_3} \cdot \
Delta t \\
\end{align*}
\]
Here, \( \mathbf{F}_1, \mathbf{F}_2, \) and \( \mathbf{F}_3 \) represent the
forces acting on each body.
3. **Code Implementation**:
We implement the above equations and numerical methods using a programming
language such as Python. Below is an example implementation:
```python
import numpy as np
def simulate_motion(r1, r2, r3, v1, v2, v3, m1, m2, m3, dt, num_steps):
positions = np.zeros((num_steps, 3, 3))
velocities = np.zeros((num_steps, 3, 3))
positions[0] = np.array([r1, r2, r3])
velocities[0] = np.array([v1, v2, v3])