In 1687 Isaac Newton published Philosophiæ Naturalis Principia Mathematica, or Mathematical Principles of Natural Philosophy. It is one of the most important and profound scientific works ever written and includes Newton's Law of Universal Gravitation. This law states that all matter exerts a gravitational attraction on all other matter, and provides a simple formula describing that attraction.

In this post I will use that formula to calculate how much a person would weigh if they were standing on Mars.

This is the formula:

and it tells us that if we know the mass of the two objects we are interested in (for example a planet and a person) and the distance between their centres of mass we can work out the force each exerts on the other. The individual terms are:

- F - the force in Newtons each body exerts on the other
- G - the universal gravitational constant, quite literally constant throughout the universe
- m
_{1}and m_{2}- the masses of the two bodies we are interested in - r - the distance between the centres of mass of the two bodies. Note that this is squared.

I will be using kilograms and metres for masses and distances respectively. However, other units with the same proportions can be used, for example when dealing with two planets it might be more convenient to use tonnes and kilometres, each of which is 1000 times larger than kilograms and metres.

It's important to realise that the formula works in both directions, ie it tells us how much force a planet exerts on a person AND how much force that person exerts on the planet. The two are identical. This can be difficult to comprehend until you realise that the two masses multiplied together are then divided by the distance r SQUARED, therefore the decrease in the force of gravity with distance decreases according to the inverse square law. The bits of the planet 12 feet away from you only exert 25% of the force as those bits 6 feet away, those 24 feet away only exert 12.5% of the force and so on. And even on a small planet like Earth a part of the planet is about 8000 miles away and that part only exerts about one seven millionth as much force as the parts 6 feet away.

This project consists of a single file called martiangravity.py which you can download as a zip, or clone/download the Github repository if you prefer.

Source Code Links

This is the code listing in its entirety.

martiangravity.py

def main():

print("-------------------")

print("| codedrome.com |")

print("| Martian Gravity |")

print("-------------------\n")

planet = "mars"

my_earth_weight_kg = 75 # 165lbs / 11.8st

weights = calculate_weights(planet, my_earth_weight_kg)

print(f"A person weighing {my_earth_weight_kg}kg on Earth would weigh:\n")

print(f" {weights['pounds']:>3.2f}lbs")

print(f" {weights['stones']:>2.2f}st")

print(f" {weights['kilograms']:>3.2f}kg")

print(f"\non {planet.capitalize()}.")

def calculate_weights(planet, my_earth_weight_kg):

planet_details = get_planet_details()

G = 6.67408 * 10**-11

Fg = G * ((planet_details[planet]["mass_kg"] * my_earth_weight_kg)

/ (planet_details[planet]["mean_radius_metres"] ** 2))

weights = newtons_to_weights(Fg)

return weights

def get_planet_details():

planet_details = {}

planet_details["mercury"] = {"mass_kg": 3.3011 * 10**23,

"mean_radius_metres": 2439.7 * 1000}

planet_details["venus"] = {"mass_kg": 4.8675 * 10**24,

"mean_radius_metres": 6051.8 * 1000}

planet_details["earth"] = {"mass_kg": 5.97237 * 10**24,

"mean_radius_metres": 6371 * 1000}

planet_details["mars"] = {"mass_kg": 6.4171 * 10**23,

"mean_radius_metres": 3389.5 * 1000}

planet_details["jupiter"] = {"mass_kg": 1.8982 * 10**27,

"mean_radius_metres": 69911 * 1000}

planet_details["saturn"] = {"mass_kg": 5.6834 * 10**26,

"mean_radius_metres": 58232 * 1000}

planet_details["uranus"] = {"mass_kg": 8.681 * 10**25,

"mean_radius_metres": 25362 * 1000}

planet_details["neptune"] = {"mass_kg": 1.02413 * 10**26,

"mean_radius_metres": 24622 * 1000}

return planet_details

def newtons_to_weights(N):

weights = {}

weights["newtons"] = N

weights["pounds"] = N / 4.4482216

weights["stones"] = weights["pounds"] / 14

weights["kilograms"] = N / 9.80665

return weights

main()

## main

Here we create a couple of variables for values which are then passed to the calculate_weights function. This returns a dictionary which is printed out in a neat and informative way.

## calculate_weights

This function takes as arguments the name of a planet and the weight of a person. Although this project is mainly about Mars it can handle all the other planets including Earth. (But not poor old Pluto, nor yet its possible replacement as the ninth planet...)

Firstly we call a separate function to grab a dictionary of details on the nine planets, and declare a variable G, initialised to the gravitational constant which as you can see is pretty tiny.

Next we implement Sir Isaac's formula, picking out the details from the dictionary for the required planet. As I mentioned the result is the force in Newtons (the SI unit of force) which is fair enough but meaningless to most people so it is passed to newtons_to_weights which returns the equivalent in several more familiar units, this being returned by the function.

## get_planet_details

This is straightforward - it just returns a dictionary of hard-coded weights and radii. There are a couple of things to note here:

- Planets aren't usually exactly spherical but slightly flattened due to the centrifugal source of their rotation. (Astronomy books usually say "like a tangerine".) The radius therefore varies so I am using the mean.
- Strictly speaking we need the distance between the centres of mass of the two objects. However, the size of a human is so insignificant compared to a planet that just using the planet's radius is fine. (If you are trying to land a probe on a tiny asteroid you would need more precision.)

## newtons_to_weights

This is the function I mentioned above which takes a value in Newtons and returns a dictionary containing the original Newton value and its equivalents in pounds, stones and kilograms.

Now let's run the program.

Run

python3.7 martiangravity.py

The output is

Program Output

-------------------

| codedrome.com |

| Martian Gravity |

-------------------

A person weighing 75kg on Earth would weigh:

62.85lbs

4.49st

28.51kg

on Mars.

So if you were to visit the Red Planet you wouldn't weigh much more than a third of your Earth weight. Your mass would be the same but you would be able to make giant leaps for mankind, handy when searching for that missing golf ball.

Follow @CodeDrome