Space Science Blog

Bringing You The Future Of Science and Technology


In this tutorial we will use Python and Matplotlib to explore the effects of altitude on the forces of gravity. This is because the gravitational force above the Earth's surface is proportional to 1/R2, where R is your distance from the center of the Earth.

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


Art and Web Design

Contact me for information about rates and availability.

Latest Articles

 Effects of Gravity at Altitude

The planetary weight calculator allows you to calculate your weight while on the planet's surface and assumes that the surface of the planet is of uniform distance from its center. These equations therefore will not accurately reflect the weight of objects in space around Earth, or other planetary body.

Gravity is affected by only two variables and one constant. The universal gravitational constant (6.67408 * 10-11) cannot be changed and Earth's mass (5.98 * 1024) stays pretty much the same, therefore only your distance from the center of the Earth can be changed. Earth's surface is approximately 6378.8 km in radius. When calculating the altitude of spacecraft and satellites, don't forget to add this distance (converted to meters) to the altitude of the spacecraft above the Earth's surface. Also consider that the Earth is not a perfect sphere, but rather appears to be squashed, with more mass distributed around the equator. This means that the gravitational atraction is greater above the equator than at the poles. Due to its squashed appearance, Earth is called an oblate spheroid.

ge = G * Me / d2

The following Python script will allow you to to calculate your weight at any altitude above Earth. Create a new Python file, name it, copy and paste the below code, then save and run.

You can also download the Python sorce code from my GitHub repository at:

G = 6.67408 * 10**-11 #Universal gravitational constant
mass_earth = 5.98 * 10**24 # mass of Earth in kilograms
distance_surface = 6.378 * 10**6 #distance from center of Earth to its surface, in kilometers

print("Calculate your weight at various altitudes on Earth")

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

mass = normal_weight / 9.8 #calculates mass based on weight given in pounds

altitude = float(input("Enter your altitude in kilometers:"))

distance_earth = distance_surface + (altitude * 1000) #calculates the distance from the center of the earth
gravity = G * mass_earth / distance_earth**2 #calculates gravitational acceleration based on the altitude given
calculated_weight = mass * gravity #calculates your weight at the altitude given

print("Your mass is:", "%.2f" % mass)
print("The gravitational force at this altitude is:", "%.2f" % gravity, "m/s^2")
print("Your weight at this altitude is:", "%.0f" % calculated_weight, "lbs")

Johnathan Nicolosi - 13 Jun 2018