Skip to content

Base data

http://hyperphysics.phy-astr.gsu.edu/hbase/Solar/soldata2.html

python
import numpy as np

solar_system = {
  "sun": {
    "name": "Sun",
    "diameter_km": 1_392_700,
    "mass_kg": 1.989e30,
  },
  "planets": {
    "mercury": {
      "name": "Mercury",
      "diameter_km": 4_879,
      "distance_from_sun_km": 57_900_000,
      "mass_kg": 3.3e23,
    },
    "venus": {
      "name": "Venus",
      "diameter_km": 12_104,
      "distance_from_sun_km": 108_200_000,
      "mass_kg": 4.87e24,
    },
    "earth": {
      "name": "Earth",
      "diameter_km": 12_756,
      "distance_from_sun_km": 149_600_000,
      "mass_kg": 5.976e24,
    },
    "mars": {
      "name": "Mars",
      "diameter_km": 6_792,
      "distance_from_sun_km": 227_900_000,
      "mass_kg": 6.42e23,
    },
    "jupiter": {
      "name": "Jupiter",
      "diameter_km": 142_984,
      "distance_from_sun_km": 778_600_000,
      "mass_kg": 1.90e27,
    },
    "saturn": {
      "name": "Saturn",
      "diameter_km": 120_536,
      "distance_from_sun_km": 1_427_000_000,
      "mass_kg": 5.68e26,
    },
    "uranus": {
      "name": "Uranus",
      "diameter_km": 51_118,
      "distance_from_sun_km": 2_870_000_000,
      "mass_kg": 8.69e25,
    },
    "neptune": {
      "name": "Neptune",
      "diameter_km": 49_528,
      "distance_from_sun_km": 4_497_000_000,
      "mass_kg": 1.02e26,
    },
  }
}

au_scale = solar_system["planets"]["earth"]["distance_from_sun_km"]

distances_km = np.array([p["distance_from_sun_km"] for p in solar_system["planets"].values()])
distances_au = distances_km / au_scale

for p, au in zip(solar_system["planets"].values(), distances_au):
    p["distance_from_sun_au"] = au

earth_mass_kg = solar_system["planets"]["earth"]["mass_kg"]
for p in solar_system["planets"].values():
    p["mass_earth"] = p["mass_kg"] / earth_mass_kg

# Calculate sun mass in earth masses
solar_system["sun"]["mass_earth"] = solar_system["sun"]["mass_kg"] / earth_mass_kg

print(f"Reference: 1 AU = {au_scale:,} km")
print(f"Reference: 1 Earth Mass = {earth_mass_kg:.3e} kg\n")

from IPython.display import display, Markdown

print("Distances from the Sun:")
for p in solar_system["planets"].values():
    print(f"{p['name']:<10}: {p['distance_from_sun_au']:>5.2f} AU")

display(Markdown("Planetary Masses:  \n" + "  \n".join(
    rf"{p['name']:<10}: {p['mass_earth']:>8.2f} $M_{{\oplus}}$" for p in solar_system["planets"].values()
)))

display(Markdown(rf"Sun Mass: {solar_system['sun']['mass_earth']:,.2f} $M_{{\oplus}}$"))
Reference: 1 AU = 149,600,000 km
Reference: 1 Earth Mass = 5.976e+24 kg

Distances from the Sun:
Mercury   :  0.39 AU
Venus     :  0.72 AU
Earth     :  1.00 AU
Mars      :  1.52 AU
Jupiter   :  5.20 AU
Saturn    :  9.54 AU
Uranus    : 19.18 AU
Neptune   : 30.06 AU

Planetary Masses:
Mercury : 0.06 M
Venus : 0.81 M
Earth : 1.00 M
Mars : 0.11 M
Jupiter : 317.94 M
Saturn : 95.05 M
Uranus : 14.54 M
Neptune : 17.07 M

Sun Mass: 332,831.33 M

Kepler's Laws of Planetary Motion

  1. The orbit of a planet is an ellipse with the Sun at one of the two foci.
  2. A line segment joining a planet and the Sun sweeps out equal areas during equal intervals of time.
  3. The square of a planet's orbital period is proportional to the cube of the length of the semi-major axis of its orbit.