Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Also I was surprised to learn that the mass of the Moon is only 1% of Earth mass. I knew surface gravity is one sixth so I guess I sort of assumed that mass would be one sixth.


It's because you have the radius on the denominator (I think)

  def calc_gravity(mass_1: float, mass_2: float, radius: float) -> float:
      G = 6.67408e-11
      return G * mass_1 * mass_2 / radius**2

  earth_mass = 5.972e24
  earth_radius = 6.371e6
  earth_g = calc_gravity(1.0, earth_mass, earth_radius)
  print(f"earth: {earth_g:.2f} m/s^2")

  moon_mass = 7.34767309e22
  moon_radius = 1737.4e3
  moon_g = calc_gravity(1.0, moon_mass, moon_radius)
  print(f"moon: {moon_g:.2f} m/s^2")

  print(f"earth/moon proportion: {(earth_g / moon_g):.2f}")

prints

  earth: 9.82 m/s^2
  moon: 1.62 m/s^2
  earth/moon proportion: 6.04




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: