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!