Skip to content

Instantly share code, notes, and snippets.

@dougmcnally
Created May 24, 2016 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dougmcnally/f3818ece80ca692ea422c8406d439289 to your computer and use it in GitHub Desktop.
Save dougmcnally/f3818ece80ca692ea422c8406d439289 to your computer and use it in GitHub Desktop.
# plot F_g vs. separation distance
import numpy
import pylab
m_earth = 5.972e24 #kg
r_earth = 6.371e6 #m
m_person = 80 #kg
G = 6.67408e-11 #m^3 / (kg * s^2)
# average separation between Mars and Earth = 225e9 m
# http://www.universetoday.com/14824/distance-from-earth-to-mars/
# ISS approximate distance from surface of Earth = 4e5 m
max_dist = 4e5 #m
dists = numpy.arange(0, max_dist, max_dist / 1000)
F_g = list()
for r in dists:
F_g.append(G * m_earth * m_person / (r+r_earth)**2)
print "F_g at the Earth's surface is %.2f N" % F_g[0]
print "F_g at %.2f m is %.2f N" % (dists[-1], F_g[-1])
#plotting stuff:
pylab.xlabel("y (m)", fontsize=18)
pylab.ylabel("$F_g$ (N)", fontsize=18)
pylab.title("Weight vs. Separation Distance from Earth ($m = " + str(m_person) + "$ kg)")
pylab.plot(dists, F_g)
pylab.ylim(ymax=10*m_person, ymin=0)
pylab.savefig("F_gvsy_spacestation.png",bbox_inches="tight",dpi=600)
pylab.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment