Creating a Gravitational 2 body simulation

AI Thread Summary
The discussion revolves around creating a simulation for the gravitational two-body problem, focusing on defining equations for numerical solutions. The user has established the positions of two objects and their center of mass, using reduced mass to simplify the problem. However, they express difficulty in solving the equations due to the complexity of tracking both position vectors separately. It is noted that while using reduced mass simplifies the equations, it still results in multiple equations that need to be solved. Participants suggest that the user should prioritize learning computational physics and numerical methods for solving ordinary differential equations, recommending formal courses or textbooks. They emphasize the importance of using symplectic methods, like the Verlet algorithm, for accurate energy conservation in simulations of gravitational dynamics. The user acknowledges this advice and mentions studying a relevant physics text.
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
 
Back
Top