public
Created

  • Download Gist
equator_weight.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
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)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.