I'm trying to find the time taken for a Hohmann transfer orbit. I've tried using all three of these equations, but when compared against known periods they all evaluate to the same wrong answer, 100 to 1000 times as much as what it should be. The only explanation I can think of is that I'm using the wrong units as input, output, or both. Currently, I'm inputting the semi-major axis and radii in meters, and the standard gravitational parameter in whatever units Wikipedia lists here are called [m^3 s^−2]. I'm interpreting the result as seconds.

$$t_{hoh} = \frac{1}{2} \sqrt{\frac{4 \pi^2 a_H^3}{\mu}} = \pi \sqrt{\frac{(r_1+r_2)^3}{8 \mu}}$$

$$T_{orbit} = 2 \pi \sqrt{\frac{a^3}{\mu}}$$

(original screen shots 1, 2)

Just in case I made some egregious mistake in my code, here it is:

t = (2 * Math.PI * Math.Sqrt(Math.Pow(((rH + rL) / 2), 3) / u)) / 2;
t = (1 / 2) * Math.Sqrt(((4 * Math.Pow(Math.PI, 3)) * (Math.Pow((rH + rL) / 2, 3))) / u);
t = Math.PI * Math.Sqrt(Math.Pow(rH + rL, 3) / (8 * u));

What are the proper input and output units?

  • $\begingroup$ I've converted your equations from screen shots to MathJax and posted an answer, please let me know if it's clear or you need more. Thanks and Welcome to Space! $\endgroup$
    – uhoh
    Commented Jun 17, 2020 at 3:40
  • 1
    $\begingroup$ Meters versus kilometers, and altitude versus radius, are the two common mistakes here, but without seeing what values you're using, it's hard to tell where you're running into trouble. $\endgroup$ Commented Jun 17, 2020 at 3:54
  • 1
    $\begingroup$ Thanks for the Conversion to MathJax and the answer. I checked my three functions myself with earth values like your answer, but I got 9104779397.93403 seconds, or 288 years. I have no idea what the problem is. I didn't intend for this to be a programming question, so thanks again for your help, I'll mark your answer as a solution since you answered the unit question. $\endgroup$
    – user36065
    Commented Jun 17, 2020 at 4:04
  • 1
    $\begingroup$ Interestingly $\sqrt{GM_{Sun}/GM_{Earth}} = 2 \times 288$, I think you used the Earth's mass where you should have used the Sun's, I do that all the time! $\endgroup$
    – uhoh
    Commented Jun 17, 2020 at 9:26
  • 1
    $\begingroup$ Thanks! That was the problem! It's fixed now :) $\endgroup$
    – user36065
    Commented Jun 17, 2020 at 20:47

1 Answer 1


Units are always a challenge, and when you think you've got it right it's also important to check them with dimensional analysis.

Sometimes people calculate orbits in dimensionless units, so for example with $\mu=1$ and $a=1$ the period is just $2 \pi$. If you have two massive bodies then $\mu_1 + \mu_2 = 1$.

But when we're doing thins with real world units, kilograms, meters and seconds (MKS) are the way to go. In that case $\mu = GM$ where $G$ is the gravitational constant of about $6.674 \times 10^{-11}$ m3 kg-1 s-2 and $M$ is the mass of (in this case) the central body in kg.

It is hard to measure $G$ accurately, but by observing the planets and their moons accurately for the last century and longer (ever since we had photographic emulsion and clocks) and then for some by monitoring spacecraft in orbit using delay-doppler techniques we can use astrometry (also in Astronomy SE) and orbital mechanics to obtain the product $GM$ much more precisely than either alone.

This is then called the standard gravitational parameter and for many solar system bodies these are known to ten decimal places or more! For more on that see:

So if you use the semimajor axis of the Earth of $1.49598023 \times 10^{11}$ m and the standard gravitational parameter of the Sun of $1.32712440018 \times 10^{20}$ m3 s-2 and put it into your formula, you get $3.15582442 \times 10^7$ seconds (what I remember as "pi times ten to the seven") which is roughly 365.26 days.

Checking with dimensional analysis:

$$\sqrt{\frac{m^3}{m^3 s^{-2}}} = s$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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