0% found this document useful (0 votes)
9 views2 pages

3 Body

The document describes how to numerically solve the three-body problem by setting up equations of motion, using numerical methods like Runge-Kutta to solve the equations, and implementing the equations and methods in code like Python.

Uploaded by

이클립스
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

3 Body

The document describes how to numerically solve the three-body problem by setting up equations of motion, using numerical methods like Runge-Kutta to solve the equations, and implementing the equations and methods in code like Python.

Uploaded by

이클립스
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

To numerically solve the three-body problem, we typically follow the following

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 \).

1. **Setting up Equations of Motion**:


The equations of motion are derived based on Newton's Third Law, taking into
account the gravitational forces acting on each body. These equations can be
expressed as follows:

\[
\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 compute_force(r1, r2, r3, m1, m2, m3):


G = 6.67430e-11
force1 = G * m1 * (r2 - r1) / np.linalg.norm(r2 - r1)**3 + G * m3 * (r3 - r1) /
np.linalg.norm(r3 - r1)**3
force2 = G * m2 * (r1 - r2) / np.linalg.norm(r1 - r2)**3 + G * m3 * (r3 - r2) /
np.linalg.norm(r3 - r2)**3
force3 = G * m1 * (r1 - r3) / np.linalg.norm(r1 - r3)**3 + G * m2 * (r2 - r3) /
np.linalg.norm(r2 - r3)**3
return force1, force2, force3

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])

for i in range(1, num_steps):


forces = compute_force(positions[i-1][0], positions[i-1][1], positions[i-1]
[2], m1, m2, m3)
for j in range(3):
velocities[i][j] = velocities[i-1][j] + forces[j] / np.array([m1, m2,
m3])[j] * dt
positions[i][j] = positions[i-1][j] + velocities[i][j] * dt

return positions, velocities


```

You might also like