Creating a Gravitational 2 body simulation

  • Thread starter Arman777
  • Start date
  • #1
1,867
147
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:

Answers and Replies

  • #2
35,127
11,364
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.
 
  • #3
1,867
147
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.
 
  • #4
2,029
419
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 seperate positions you have 6 instead of three equations but the basic principle doesn't change.
 
  • Like
Likes Arman777
  • #5
1,867
147
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 seperate 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.
 
  • #6
pbuk
Science Advisor
Gold Member
1,883
726
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
  • #7
1,867
147
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
 

Related Threads on Creating a Gravitational 2 body simulation

Replies
4
Views
3K
  • Last Post
Replies
9
Views
1K
Replies
3
Views
3K
Replies
7
Views
2K
Replies
3
Views
6K
Replies
6
Views
782
  • Last Post
Replies
1
Views
806
Replies
4
Views
558
  • Last Post
Replies
4
Views
8K
Top