1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Dynamics of the solar system

  1. Nov 25, 2015 #1
    I'm an undergrad (so my simulation is VERY simple), writing a java program to simulate the solar system. And I'm a bit stuck on how to calculate a couple of important things.

    I'm literally right at the start of this, with just a sun and an earth. Initially I had my earth going round my stationary sun in circles. It worked fine, in the sense that after a year the earth was back where it started - or the same distance away at least.

    Now I've tried to get the earth and sun to orbit a common centre of mass. This has not worked. It was fairly easy to work out where their centre of mass is, and adjust their initial positions so that the centre of mass is at the origin.
    Now it's occurred to me that I don't know what their velocities relative to this centre of mass are. Will Earth's velocity be its orbital velocity? How do I find the velocity of the sun about this common centre of mass? Will the centre of mass stay in the same place?

    Thanks for any help!
  2. jcsd
  3. Nov 25, 2015 #2
    Both the sun and the Earth need to orbit that point once every 365.2475 days. So 2πR / 365.2475 days.
  4. Nov 25, 2015 #3

    Filip Larsen

    User Avatar
    Gold Member

    There are several ways to do this.

    One simple way is to start with the sun at rest at the origin, just like you did before, but now let all bodies (Sun and Earth) accelerate according to Newtons law of gravitation. If you then calculate the center of mass and plot it over time you should see the center of mass move in a straight line to within your error of integration. If it does, you can now simply plot the orbit of the bodies relative to the center of mass. If it doesn't, you know you should check your integration procedure.

    If you want to start with center of mass in the origin and (hopefully) not moving (as you asked for), then from the position and velocity of all bodies relative to the Sun you can calculate the position and velocity of the center of mass (if you don't know how to do this then please write up the equation for center of mass and ask specific questions where you get stuck). You can now just subtract the position and velocity of the center of mass from all other velocities (including the Sun) before you start integration. Now you should observe that the center of mass stays at the origin. Any (accumulated) error in integration will be even more apparent in this case if the center of mass starts to gain a velocity that do no average to zero.
  5. Nov 27, 2015 #4
    Why 365 days? I know it's an earth year obviously, but it's not obvious to me why that should also be the sun's orbital period about this point.
  6. Nov 27, 2015 #5
    How are you going to keep the common center of gravity in the same place if they orbit at different periods?
  7. Nov 27, 2015 #6


    User Avatar
    Gold Member

    Imagine a very large man and a very small woman, arms locked together, pirouetting around each other on a dance floor. If she orbits him once every second, how often will he have to orbit her?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook