Take the 2-minute tour ×
Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It's 100% free, no registration required.

I'm trying to calculate the 'instantaneous' semi-major axis of a binary system with two equal (known) mass stars for an $N$-body simulation. I know their velocities and positions at a given time, but am unsure how best to calculate the semi-major axis. I tried using the vis-viva equation

$$v^2 ~=~ G(M_1 + M_2)\cdot(2/r - 1/a) $$

However I'm not sure if $r$ should be the distance between the two masses or the distance to the centre of mass and whether the $M$'s should be the masses or the sum and the reduced mass? Whatever I try the semi-major axis seems to oscillate over the orbit at around the correct value, but surely it should be constant? Any advice would be brilliant, thanks.

edit: Not allowed to answer my own question yet, but I'm an idiot and wasn't doing relative velocities, thanks guys.

share|improve this question
I find this question very confusing, too. Are you calculating a 2-body problem or an N-body problem for a higher value of N? If it is the latter, the trajectories won't be ellipses, so it makes no sense to talk about the semi-major axes too accurately because these parameters only make sense for ellipses e.g. for a 2-body problem. In the 2-body case, the Wikipedia article clearly answers all your questions. –  LuboŇ° Motl Apr 13 '12 at 14:45
@Mithra: if you figured out your own question, it'd be great if you write up an answer for it and post it once the system allows you to. I think it'll be 8 hours after you asked the question, or something like that. –  David Z Apr 13 '12 at 15:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.