# Orbital Period Calculator (C++)

Being a tad obsessed with space, I have created a calculator for approximating orbital periods of satellites in our solar system. It is a very straightforward program I wrote in C++.

Based upon Kepler’s Third Law of Planetary Motion, it evaluates the following formula:

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

where:

• $a$ is the orbit’s semi-major axis
• $\mu = GM$ is the standard gravitational parameter
• $G$ is the gravitational constant
• $M$ is the mass of the two bodies

Kepler’s Third Law states: the square of the orbital period of a planet is directly proportional to the cube of the semi-major axis of its orbit. It has been used to describe the relationship between the distance of planets from the Sun, and their orbital periods.

This notion can be generalised to satellites orbiting planets to yield the above equation.

Here, is the program’s interface. I have chosen the International Space Station as the satellite whose orbital period we want to know. We begin by selecting a central body and stating the mass and distance of our satellite.

We see, below, the formula evaluates to 92.6 minutes.

Wikipedia states the International Space Station’s orbital period to be: 92.69 minutes. Great! We now know the C++ algorithm works.

Let’s try the moon.

And Titan.

We can even calculate Arnold Schwarzenegger’s orbit around Mars (assuming a semi-major axis of 5000km).

I wrote this program purely for the fun of it. It has no practical merit. However, should Schwarzenegger ever be launched into an orbit around Mars, I will be the first to know his orbital time!

I may extend the calculator in the future to contain a larger database of planets and satellites. It would be interesting to see other metrics such as average satellite speed.