Skip to content

Instantly share code, notes, and snippets.

@jimweirich
Created June 7, 2013 06:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jimweirich/5727372 to your computer and use it in GitHub Desktop.
printf "Latitude? "
latitude_degrees = gets.to_f
latitude = latitude_degrees * Math::PI / 180.0
angular_velocity = 2 * Math::PI / (24 * 60 * 60) # Radians per second
radius_at_equator = 6_371_000 # meters
radius_at_latitude = radius_at_equator * Math.cos(latitude)
centripetal_at_equator = angular_velocity**2 * radius_at_equator
centripetal_at_latitude = angular_velocity**2 * radius_at_latitude
acceleration_at_equator = 9.8 - centripetal_at_equator
acceleration_at_latitude = 9.8 - centripetal_at_latitude
ratio = acceleration_at_equator / acceleration_at_latitude
weight_at_latitude = 100
weight_at_equator = weight_at_latitude * ratio
printf "If you weight 100 pounds at latitude %0.2f\n", latitude_degrees
printf "Then you will weight %0.2f pounds at the equator\n", weight_at_equator
printf "Which is %0.2f pounds lighter.\n", (weight_at_latitude - weight_at_equator)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment