Creating a Gravitational 2 body simulation

Click For Summary
SUMMARY

This discussion focuses on creating a gravitational two-body simulation, specifically addressing the numerical solution of the governing equations. The participants discuss the use of position vectors, reduced mass, and gravitational forces, emphasizing the equations of motion for both bodies: $$m_1\ddot{\mathbf{r}}_1=-\frac{Gm_1m_2(\mathbf{r}_1-\mathbf{r}_2)}{|\mathbf{r}_1-\mathbf{r}_2|^3}$$ and $$m_2\ddot{\mathbf{r}}_2=-\frac{Gm_1m_2(\mathbf{r}_2-\mathbf{r}_1)}{|\mathbf{r}_2-\mathbf{r}_1|^3}$$. The discussion highlights the complexity of solving these equations and suggests a focus on computational physics and numerical methods for ordinary differential equations (ODEs) as essential next steps.

PREREQUISITES
  • Understanding of gravitational physics and two-body problems
  • Familiarity with position vectors and reduced mass concepts
  • Knowledge of ordinary differential equations (ODEs)
  • Basic computational physics skills
NEXT STEPS
  • Study numerical methods for solving ordinary differential equations
  • Research symplectic methods such as the Verlet integration technique
  • Explore computational physics resources, including Mark Newman’s "Computational Physics"
  • Implement a simple two-body simulation using Python or MATLAB
USEFUL FOR

Students and professionals in physics, particularly those interested in computational physics, numerical simulations, and gravitational dynamics.

Arman777
Insights Author
Gold Member
Messages
2,163
Reaction score
191
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##.

$$\vec{r'}_1 = \frac{-m_2}{m_1 + m_2} \vec{r}~~(1)$$

and $$\vec{r'}_2 = \frac{m_1}{m_1 + m_2} \vec{r}~~(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{\hat{r}} = -\frac{Gm_1m_2}{r^2} \hat{r}##Now I need to solve this equation and put back into the (1) and (2) right ?
 
Last edited:
Technology news on Phys.org
If you want to keep track of both position vectors separately then using the real gravitational force is more useful. The reduced mass is great if you want to treat it as one-body problem.
 
mfb said:
If you want to keep track of both position vectors separately then using the real gravitational force is more useful.
$$m_1\ddot{\mathbf{r}}_1=-\frac{Gm_1m_2(\mathbf{r}_1-\mathbf{r}_2)}{|\mathbf{r}_1-\mathbf{r}_2|^3}\tag{1}$$

$$m_2\ddot{\mathbf{r}}_2=-\frac{Gm_1m_2(\mathbf{r}_2-\mathbf{r}_1)}{|\mathbf{r}_2-\mathbf{r}_1|^3}\tag{2}.$$

I am new at this topic and in the above equations the left side has ##r1## but right has ##r2## and ##r1##, so It seemed harder for me to solve it in this way. Thats kind of why I tried to use reduced mass.
 
Arman777 said:
I am new at this topic and in the above equations the left side has ##r1## but right has ##r2## and ##r1##, so It seemed harder for me to solve it in this way.

It seems but it isn't. Even using the reduced mass you actually have three equations - one for each component of the displacement vector. In each of these equations you have one component on the left side but all three components on the right side. With separate positions you have 6 instead of three equations but the basic principle doesn't change.
 
  • Like
Likes Arman777
DrStupid said:
It seems but it isn't. Even using the reduced mass you actually have three equations - one for each component of the displacement vector. In each of these equations you have one component on the left side but all three components on the right side. With separate positions you have 6 instead of three equations but the basic principle doesn't change.
I see...I guess before jumping into these topics I should focus on the computational physics part, solving DE equations on computer.
 
I see you are a university undergraduate: can you take a course in numerical methods for solving ordinary differential equations? Or take a book in that subject out of the library? I wouldn't advise finding your way through this topic yourself. As a last resort, use a search engine with that topic , but be careful where you go from there; this one looks OK, although it doesn't seem to go far enough to cover the importance of simplectic methods (e.g. Verlet) in modelling physical systems (TL;DR the methods you cover earlier do not conserve energy, which is obviously quite important for modelling gravitational dynamics).

 
  • Like
Likes DEvens
pbuk said:
I see you are a university undergraduate: can you take a course in numerical methods for solving ordinary differential equations? Or take a book in that subject out of the library? I wouldn't advise finding your way through this topic yourself. As a last resort, use a search engine with that topic , but be careful where you go from there; this one looks OK, although it doesn't seem to go far enough to cover the importance of simplectic methods (e.g. Verlet) in modelling physical systems (TL;DR the methods you cover earlier do not conserve energy, which is obviously quite important for modelling gravitational dynamics).
Thanks for your thought. I ll look into them. I am studying Mark Newman Compt physics, which seems good enough for me
 

Similar threads

Replies
3
Views
1K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 11 ·
Replies
11
Views
1K
  • · Replies 19 ·
Replies
19
Views
2K
Replies
1
Views
1K
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K