### Categories

- Conspiracies (0)
- Game Design (0)
- Illustrations (6)
- Random Generators (7)
- Science and Technology (5)
- Secret History (0)
- Tutorials (7)

### Art and Web Design

Contact me for information about rates and availability.

### Latest Articles

### Planetary Weight Calculator

In this tutorial we will use Python code to build a universal weight calculator, which will calculate our weight on each planetary body within our Solar System. Our weight calculator will be based on Newton's universal gravitational constant, or G = 6.674×10^{−11} m^{3} kg^{−1} s^{−2}. Next we must obtain the mass and radius of each planetary body, which can be obtained from NASA. For our application, we used the Planetary Fact Sheet from NASA.

The following calculations will be done using the metric system, except for weight measurements, which should be in pounds (lbs). Don't forget to convert from diameter to radius for each celestial body, if you are using the NASA Planetary Fact Sheet.

### Planetary Data

Planetary statistics can be found in any planetary science book or good physics book, but the internet is also a good place to search for planetary data. NASA offers planetary facts in metric and standard formats. We use the metric system for all scientific computing.

Planetary Body | Mass (kg) | Radius (km) |
---|---|---|

Earth | 5.98 x 10^{24} |
6378 |

Mercury | 3.30 x 10^{23} |
2439 |

Venus | 4.87 x 10^{24} |
6051 |

Mars | 6.42 x 10^{23} |
3393 |

Jupiter | 1.90 x 10^{27} |
71492 |

Saturn | 5.69 x 10^{26} |
60268 |

Uranus | 8.68 x 10^{25} |
25559 |

Neptune | 1.02 x 10^{26} |
24764 |

Sun | 1.99 x 10^{30} |
696000 |

Moon | 7.35 x 10^{22} |
1738 |

To calculate our weight on each planet, we use the gravitational acceleration vector for each planetary body, which is the product of the Universal Gravitational Constant (G) multiplied by the mass (m) of each planetary body (p) divided by the radius (r) of each body, squared.

g

_{p}= G * (m

_{p}/r

_{p}

^{2})

Using the above equation we are able to calculate the gravitational acceleration, or gravity, of each planetary body as charted below.

Planetary Body (p) | Mass (m) | Radius (r) | Gravity (g_{p}) |
---|---|---|---|

Earth | 5.98 x 10^{24} kg |
6378 km | 9.8 N |

Mercury | 3.30 x 10^{23} kg |
2439 km | 3.7 N |

Venus | 4.87 x 10^{24} kg |
6051 km | 8.9 N |

Mars | 6.42 x 10^{23} kg |
3393 km | 3.7 N |

Jupiter | 1.90 x 10^{27} kg |
71492 km | 24.8 N |

Saturn | 5.69 x 10^{26} kg |
60268 km | 10.5 N |

Uranus | 8.68 x 10^{25} kg |
25559 km | 8.9 N |

Neptune | 1.02 x 10^{26} kg |
24764 km | 11.1 N |

Sun | 1.99 x 10^{30} kg |
696000 km | 274.2 N |

Moon | 7.35 x 10^{22} kg |
1738 km | 1.6 N |

Before we can calculate our weight on other planets, let's first take a moment to talk about weight on Earth and how we calculate it. Like most people, you probably stand on a scale to calculate your weight, but scientists have to do it the hard way and calculate their weight by multiplying their mass by the gravitational acceleration of Earth.

w

_{e}= m * g

_{e}

In order to derive your mass from your weight, simply divide your weight (as determined by a digital or analog scale) by Earth's gravitational acceleration of 9.8

m = w/9.8

Knowing your mass allows you to calculate your weight on other planetary bodies using the planetary gravitational acceleration equation by multiplying your mass times the gravitational acceleration of each planet. The same weight equation used above can be used to calculate your weight on any planetary body. The planetary gravitational acceleration equation can be written as:

w

_{p}= m * g

_{p}

### Putting It All Together

The following python code can be cloned or downloaded from my Github repository at: https://github.com/johnathan-nicolosi/RocketScience

##########################################

# universal gravitational constant

G = 6.67408 * 10**-11 #Newton-meter^2/kilogram^2

##########################################

# The mass for each celestial body (in kilograms)

mass_earth = 5.98 * 10**24

mass_mercury = 3.30 * 10**23

mass_venus = 4.87 * 10**24

mass_mars = 6.42 * 10**23

mass_jupiter = 1.90 * 10**27

mass_saturn = 5.69 * 10**26

mass_uranus = 8.68 * 10**25

mass_neptune = 1.02 * 10**26

mass_sun = 1.99 * 10**30

mass_moon = 7.35 * 10**22

##########################################

# The radius of each celestial body (in kilometers)

radius_earth = 6378 * 10**3

radius_mercury = 2439 * 10**3

radius_venus = 6051 * 10**3

radius_mars = 3393 * 10**3

radius_jupiter = 71492 * 10**3

radius_saturn = 60268 * 10**3

radius_uranus = 25559 * 10**3

radius_neptune = 24764 * 10**3

radius_sun = 696000 * 10**3

radius_moon = 1738 * 10**3

##########################################

# The gravitational acceleration vector of each celestial body (in Newtons)

gravity_earth = G * mass_earth / radius_earth**2

gravity_mercury = G * mass_mercury / radius_mercury**2

gravity_venus = G * mass_venus / radius_venus**2

gravity_mars = G * mass_mars / radius_mars**2

gravity_jupiter = G * mass_jupiter / radius_jupiter**2

gravity_saturn = G * mass_saturn / radius_saturn**2

gravity_uranus = G * mass_uranus / radius_uranus**2

gravity_neptune = G * mass_neptune / radius_neptune**2

gravity_sun = G * mass_sun / radius_sun**2

gravity_moon = G * mass_moon / radius_moon**2

##########################################

print("Determine your weight on each planet")

normal_weight = float(input("Enter your weight in pounds (lbs):"))

print("")

mass = normal_weight / 9.8

weight_earth = mass * gravity_earth

print("Your mass is:", "%.2f" % mass, "kg")

print("")

print("Your weight on Earth is:", "%.0f" % weight_earth, "lbs")

print("Earth's gravitational acceleration is: ", "%.1f" % gravity_earth)

weight_mercury = mass * gravity_mercury

print("Your weight on Mercury is:", "%.0f" % weight_mercury, "lbs")

print("Mercury's gravitational acceleration is: ", "%.1f" % gravity_mercury)

weight_venus = mass * gravity_venus

print("Your weight on Venus is:", "%.0f" % weight_venus, "lbs")

print("Venus' gravitational acceleration is: ", "%.1f" % gravity_venus)

weight_mars = mass * gravity_mars

print("Your weight on Mars is:", "%.0f" % weight_mars, "lbs")

print("Mars' gravitational acceleration is: ", "%.1f" % gravity_mars)

weight_jupiter = mass * gravity_jupiter

print("Your weight on Jupiter is:", "%.0f" % weight_jupiter, "lbs")

print("Jupiter's gravitational acceleration is: ", "%.1f" % gravity_jupiter)

weight_saturn = mass * gravity_saturn

print("Your weight on Saturn is:", "%.0f" % weight_saturn, "lbs")

print("Saturn's gravitational acceleration is: ", "%.1f" % gravity_saturn)

weight_uranus = mass * gravity_uranus

print("Your weight on Uranus is:", "%.0f" % weight_uranus, "lbs")

print("Uranus's gravitational acceleration is: ", "%.1f" % gravity_uranus)

weight_neptune = mass * gravity_neptune

print("Your weight on Neptune is:", "%.0f" % weight_neptune, "lbs")

print("Neptune's gravitational acceleration is: ", "%.1f" % gravity_neptune)

weight_sun = mass * gravity_sun

print("Your weight on the Sun is:", "%.0f" % weight_sun, "lbs")

print("Sun's gravitational acceleration is: ", "%.1f" % gravity_sun)

weight_moon = mass * gravity_moon

print("Your weight on the Moon is:", "%.0f" % weight_moon, "lbs")

print("Moon's gravitational acceleration is: ", "%.1f" % gravity_moon)