Space Science Blog

Bringing You The Future Of Science and Technology

PLANETARY WEIGHT CALCULATOR


We will build a universal planetary weight calculator in Python. Using the mass and radius of each planetary body along with the universal gravitational constant we will calculate your weight on each celestial object.

Artificial Intelligence | DIY Electronics Projects | Game Design Workshop | Gallery | Random Generators | Planetary Science | Rocket Science


Categories

Art and Web Design

Contact me for information about rates and availability.


Latest Articles

 Planetary Weight Calculator


To calculate your weight on each planet, 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.

gp = G * (mp/rp2)

This can be written in Python as:

# Calculate the gravitational acceleration for Mercury
mass_mercury = [3.30 * 10**23]
radius_mercury = [2439]
gravity_mercury = [gravitational_constant * (mass_mercury / radius_mercury**2)]

Using the above equation we are able to calculate the gravitational acceleration, or gravity, of each planetary body as charted below. Using the gravitational acceleration for each planetary body you can calculate your weight, or the weight of an interplanetary spacecraft, in orbit around, or on the surface of, each planetary body. Knowing your mass allows you to calculate your weight on other planetary bodies using the planetary gravitational acceleration equation. Do this by multiplying the mass of the spacecraft by 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:

wp = m * gp

This can be written in Python as:

# Enter the mass of the object
mass = int(input("Enter mass of object (in kg):")

# Calculate the gravitational acceleration for each planet
weight_planet = mass * gravity_planet[0]

To determine an object's mass you could use the following Python script:

normal_weight = float(input("Enter your weight in pounds (lbs):"))
mass = normal_weight * 0.4536
newton_lbf = mass * 0.22480894309971 # Convert from Newtons to pounds (lbf)
force = mass * gravity_earth

print("Your mass is:", "%.2f" % mass, "kg")
print("The force exerted by your mass is:", "%.1f" % force, "N")


Certain variables, such as the gravitational acceleration of each planet, can be calculated as variables and the values can be calculated upon execution of the script:

# The mass for each celestial body (in kilograms)
mass_mercury = 3.30 * 10**23
mass_venus = 4.87 * 10**24
mass_earth = 5.98 * 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_mercury = 2439 * 10**3
radius_venus = 6051 * 10**3
radius_earth = 6378 * 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_mercury = gravitational_constant * mass_mercury / radius_mercury**2
gravity_venus = gravitational_constant * mass_venus / radius_venus**2
gravity_earth = gravitational_constant * mass_earth / radius_earth**2
gravity_mars = gravitational_constant * mass_mars / radius_mars**2
gravity_jupiter = gravitational_constant * mass_jupiter / radius_jupiter**2
gravity_saturn = gravitational_constant * mass_saturn / radius_saturn**2
gravity_uranus = gravitational_constant * mass_uranus / radius_uranus**2
gravity_neptune = gravitational_constant * mass_neptune / radius_neptune**2
gravity_sun = gravitational_constant * mass_sun / radius_sun**2
gravity_moon = gravitational_constant * mass_moon / radius_moon**2

# Create a list of planetary masses named mass_planets
mass_planets = [mass_mercury, mass_venus, mass_earth mass_mars, mass_jupiter, mass_saturn, mass_uranus, mass_neptune, mass_sun, mass_moon]

# Create a list containing the radius of each planetary body named radius_planets
radius_planets = [radius_mercury, radius_venus, radius_earth, radius_mars, radius_jupiter, radius_saturn, radius_uranus, radius_neptune, radius_sun, radius_moon]

# Create a list of planetary gravitational fields by calculating each field and then saving each variable to a list named gravity_planets
gravity_planets = [gravity_mercury, gravity_venus, gravity_earth, gravity_mars, gravity_jupiter, gravity_saturn, gravity_uranus, gravity_neptune, gravity_sun, gravity_moon]

# Print the list of planetary data
print("Planetary Fact Sheet + Gravitational Acceleration")
print("Planetary Body (p)", " ", " Mass (m) ", " ", " Radius (r) ", " ", " Gravity (gp)")
print(planets[0], mass_planets[0], "kg ", radius_planets[0], "km ", gravity_planets[0], "N"
print(planets[1], mass_planets[1], "kg ", radius_planets[1], "km ", gravity_planets[1], "N"
print(planets[2], mass_planets[2], "kg ", radius_planets[2], "km ", gravity_planets[2], "N"
print(planets[3], mass_planets[3], "kg ", radius_planets[3], "km ", gravity_planets[3], "N"
print(planets[4], mass_planets[4], "kg ", radius_planets[4], "km ", gravity_planets[4], "N"
print(planets[5], mass_planets[5], "kg ", radius_planets[5], "km ", gravity_planets[5], "N"
print(planets[6], mass_planets[6], "kg ", radius_planets[6], "km ", gravity_planets[6], "N"
print(planets[7], mass_planets[7], "kg ", radius_planets[7], "km ", gravity_planets[7], "N"
print(planets[8], mass_planets[8], "kg ", radius_planets[8], "km ", gravity_planets[8], "N"
print(planets[9], mass_planets[9], "kg ", radius_planets[9], "km ", gravity_planets[9], "N"


Note that the above code will calculate the mass for each planet and return the unformatted floatting numbers. You can save each of the planetary features as strings, however, doing so will not allow you to perform calculations using the data. For example, the following Python code will store the values as a string of text instead of an interger, which can be used in various scientific calculations.

mass_planets = ['3.30 x 1023 kg', '4.87 x 1024 kg', '5.98 x 1024 kg', '6.42 x 1023 kg', '1.90 x 1027 kg', '5.69 x 1026 kg', '8.68 x 1025 kg', '1.02 x 1026 kg', '1.99 x 1030 kg', '7.35 x 1022 kg']

Johnathan Nicolosi - 13 Jun 2018