|
@@ -2,14 +2,11 @@
|
|
|
#
|
|
|
# https://xkcd.com/681/
|
|
|
|
|
|
-fn depth(mass: Mass, radius: Length) -> Length =
|
|
|
- G × mass / (g0 × radius) -> km
|
|
|
-
|
|
|
-let earth_mass = 5.972e24 kg
|
|
|
-let earth_radius = 6371 km
|
|
|
+use extra::astronomy
|
|
|
|
|
|
-let moon_mass = 7.342e22 kg
|
|
|
-let moon_radius = 1737 km
|
|
|
+fn well_depth(mass: Mass, radius: Length) -> Length =
|
|
|
+ G × mass / (g0 × radius) -> km
|
|
|
|
|
|
-assert_eq(depth(earth_mass, earth_radius), 6379 km, 1 km)
|
|
|
-assert_eq(depth(moon_mass, moon_radius), 288 km, 1 km)
|
|
|
+assert_eq(well_depth(earth_mass, earth_radius), 6379 km, 1 km)
|
|
|
+assert_eq(well_depth(mars_mass, mars_radius), 1286 km, 3 km)
|
|
|
+assert_eq(well_depth(lunar_mass, lunar_radius), 288 km, 1 km)
|