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.


closed as unclear what you're asking by Qmechanic Nov 7 '14 at 15:55

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ 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. $\endgroup$ – Luboš Motl Apr 13 '12 at 14:45
  • 2
    $\begingroup$ @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. $\endgroup$ – David Z Apr 13 '12 at 15:09
  • r is the distance between the two masses
  • v is the relative velocity
  • a is the relative semimajor axis*

* Two bodies orbiting each other trace out two separate ellipses in an inertial frame. The smaller body traces a larger ellipse, and vice versa. The relative semimajor axis (a) is equal to the sum of the semimajor axes of these two ellipses. The relative semimajor axis is also equal to the semimajor axis of the orbital ellipse of one body as seen in the non-inertial frame centered on the other body.


Not the answer you're looking for? Browse other questions tagged or ask your own question.