- #1
Ostsol
- 12
- 0
I am programming an n-body simulation, but to test my program, I decided to start with two bodies. Specifically, I decided to model the Earth-Moon system. The issue I have is that Kepler's laws involve only the motion of one of the two bodies. From my understanding, the other is assumed to be static or of such mass that its motion is insignificant. That leaves me working with Newtonian gravitation and motion.
My problem is the starting conditions. Wikipedia tells me the mass of the Earth and Moon, and the orbital radius and velocity of the Moon. Simply inputting these parameters does not create a stable simulation, though. The entire system slowly moves. I was obvious that I was not accounting for the Earth's motion in my starting conditions. It was not obvious as to how I should determine the Earth's velocity.
Because my maths are effectively pre-calculus (I took single-variable calculus over a decade ago and have forgotten most of it), it is difficult to understand the maths behind celestial mechanics. Eventually, though, after playing with some numbers I found that the velocity of the Earth should be of a proportion to the Moon's that is inverse to the proportion of their masses. Basically:
[itex]v_e{}[/itex]/[itex]v_m{}[/itex]=[itex]m_m{}[/itex]/[itex]m_e{}[/itex]
Where v and m are velocity and mass, respectively; and the subscripts m and e are the Moon and the Earth, respectively. The Earth's velocity obviously points in the opposite direction as the Moon's. This creates a stables simulation regardless of the values input and the distances involved. As long as these proportions remain the same, the bodies trace the same orbital paths each time.
Now I'm sure that this proportion may be derived from the relevant formulae by those who have sufficient competence in the maths involved, but that's not me. I was unable to find this information on Wikipedia or in various Google searches, though perhaps that's not surprising. My questions therefore are: is this proportion documented somewhere and are there any others that I should be aware of?
Thank you.
-Daniel
My problem is the starting conditions. Wikipedia tells me the mass of the Earth and Moon, and the orbital radius and velocity of the Moon. Simply inputting these parameters does not create a stable simulation, though. The entire system slowly moves. I was obvious that I was not accounting for the Earth's motion in my starting conditions. It was not obvious as to how I should determine the Earth's velocity.
Because my maths are effectively pre-calculus (I took single-variable calculus over a decade ago and have forgotten most of it), it is difficult to understand the maths behind celestial mechanics. Eventually, though, after playing with some numbers I found that the velocity of the Earth should be of a proportion to the Moon's that is inverse to the proportion of their masses. Basically:
[itex]v_e{}[/itex]/[itex]v_m{}[/itex]=[itex]m_m{}[/itex]/[itex]m_e{}[/itex]
Where v and m are velocity and mass, respectively; and the subscripts m and e are the Moon and the Earth, respectively. The Earth's velocity obviously points in the opposite direction as the Moon's. This creates a stables simulation regardless of the values input and the distances involved. As long as these proportions remain the same, the bodies trace the same orbital paths each time.
Now I'm sure that this proportion may be derived from the relevant formulae by those who have sufficient competence in the maths involved, but that's not me. I was unable to find this information on Wikipedia or in various Google searches, though perhaps that's not surprising. My questions therefore are: is this proportion documented somewhere and are there any others that I should be aware of?
Thank you.
-Daniel