🚀 Introduction to Rocket Science

Module 1: Foundations in Math, Physics, and Computation

Welcome to your journey into rocket science! This notebook will teach you the fundamental concepts needed to understand how rockets work.

What You’ll Learn

  1. Basic physics of motion
  2. Newton’s Laws applied to rockets
  3. The Rocket Equation
  4. Simple trajectory calculations

Prerequisites

  • Basic algebra
  • Willingness to learn!

1. Why Do Rockets Work?

Newton’s Third Law: Action and Reaction

Every rocket works because of a simple principle:

“For every action, there is an equal and opposite reaction.”

When a rocket expels hot gas downward (action), the rocket is pushed upward (reaction).

Think About It 🤔

  • A balloon releasing air flies around the room - same principle!
  • An astronaut throwing a wrench would move in the opposite direction
Code
# Let's set up our environment
import numpy as np
import matplotlib.pyplot as plt

# Make plots look nice
plt.style.use('dark_background')
print("✅ Environment ready! Let's learn rocket science!")
✅ Environment ready! Let's learn rocket science!

2. The Rocket Equation: The Most Important Formula

Tsiolkovsky’s Rocket Equation

This equation tells us how much a rocket’s velocity can change:

\[\Delta v = v_e \cdot \ln\left(\frac{m_0}{m_f}\right)\]

Where: - Δv (delta-v) = Change in velocity (m/s) - vₑ = Exhaust velocity (how fast gas leaves the rocket) - m₀ = Initial mass (rocket + fuel) - mf = Final mass (rocket without fuel) - ln = Natural logarithm

Why This Matters

  • To reach orbit, you need about 9,400 m/s of Δv
  • To reach the Moon, you need about 12,000 m/s
  • To reach Mars, you need about 15,000 m/s
Code
def rocket_equation(exhaust_velocity, initial_mass, final_mass):
    """
    Calculate delta-v using the Tsiolkovsky rocket equation.
    
    Parameters:
    -----------
    exhaust_velocity : float - How fast the exhaust leaves the rocket (m/s)
    initial_mass : float - Total mass before burn (kg)
    final_mass : float - Mass after fuel is burned (kg)
    
    Returns: The change in velocity (m/s)
    """
    mass_ratio = initial_mass / final_mass
    delta_v = exhaust_velocity * np.log(mass_ratio)
    return delta_v

# Example: A simple rocket
v_exhaust = 3000  # m/s (typical for RP-1/LOX engines like Falcon 9's Merlin)
m_initial = 1000  # kg (rocket + fuel)
m_final = 100     # kg (just the rocket, fuel burned)

delta_v = rocket_equation(v_exhaust, m_initial, m_final)
print(f"🚀 Delta-v achieved: {delta_v:.0f} m/s")
print(f"📊 Mass ratio: {m_initial/m_final:.1f}:1")
print(f"\n💡 This means 90% of the rocket's mass was fuel!")
🚀 Delta-v achieved: 6908 m/s
📊 Mass ratio: 10.0:1

💡 This means 90% of the rocket's mass was fuel!

🧪 Interactive Exercise: Design Your Own Rocket!

Change the values below to see how delta-v changes. Can you reach orbit (9,400 m/s)?

Code
# ============================================
# TRY CHANGING THESE VALUES!
# ============================================
your_exhaust_velocity = 3500  # Try: 2500, 3000, 3500, 4500
your_initial_mass = 500       # Try: 100, 500, 1000, 10000
your_final_mass = 50          # Must be less than initial mass!
# ============================================

your_delta_v = rocket_equation(your_exhaust_velocity, your_initial_mass, your_final_mass)

print("=" * 50)
print("YOUR ROCKET ANALYSIS")
print("=" * 50)
print(f"Exhaust Velocity: {your_exhaust_velocity} m/s")
print(f"Initial Mass: {your_initial_mass} kg")
print(f"Final Mass: {your_final_mass} kg")
print(f"Fuel Mass: {your_initial_mass - your_final_mass} kg")
print(f"Mass Ratio: {your_initial_mass/your_final_mass:.2f}")
print(f"\n🎯 DELTA-V: {your_delta_v:.0f} m/s")
print("=" * 50)

# Can you reach orbit?
if your_delta_v >= 9400:
    print("✅ Congratulations! You can reach orbit!")
elif your_delta_v >= 7800:
    print("🟡 Almost! You need a bit more delta-v for orbit.")
else:
    print("❌ Not enough delta-v for orbit. Try more fuel or better engines!")
==================================================
YOUR ROCKET ANALYSIS
==================================================
Exhaust Velocity: 3500 m/s
Initial Mass: 500 kg
Final Mass: 50 kg
Fuel Mass: 450 kg
Mass Ratio: 10.00

🎯 DELTA-V: 8059 m/s
==================================================
🟡 Almost! You need a bit more delta-v for orbit.

3. Visualizing the Rocket Equation

Let’s see how different engines compare. Better engines (higher exhaust velocity) get more delta-v from the same amount of fuel!

Code
# Compare different engine types
fig, ax = plt.subplots(figsize=(12, 6))

engines = {
    'Solid Rocket Motor': 2500,
    'Merlin (Falcon 9)': 3050,
    'RS-25 (Space Shuttle)': 4400,
    'Raptor (Starship)': 3600,
}

mass_ratios = np.linspace(1.5, 15, 100)
colors = ['#ff6b6b', '#feca57', '#48dbfb', '#00d4ff']

for (name, v_e), color in zip(engines.items(), colors):
    delta_vs = v_e * np.log(mass_ratios)
    ax.plot(mass_ratios, delta_vs/1000, label=f'{name} ({v_e} m/s)', 
            color=color, linewidth=2.5)

# Reference lines
ax.axhline(y=9.4, color='white', linestyle='--', alpha=0.5, label='LEO (~9.4 km/s)')
ax.axhline(y=11.2, color='lime', linestyle='--', alpha=0.5, label='Earth Escape (11.2 km/s)')

ax.set_xlabel('Mass Ratio (Initial/Final)', fontsize=12)
ax.set_ylabel('Delta-V (km/s)', fontsize=12)
ax.set_title('🚀 The Tyranny of the Rocket Equation', fontsize=14, color='#00d4ff')
ax.legend(loc='lower right', fontsize=9)
ax.grid(True, alpha=0.3)
ax.set_xlim(1, 15)
ax.set_ylim(0, 15)

plt.tight_layout()
plt.show()

print("\n📚 KEY INSIGHT: Higher exhaust velocity = more delta-v for same fuel!")
print("   Notice how the curves flatten out at high mass ratios.")
print("   This is the 'tyranny' - you need exponentially more fuel for linear gains.")


📚 KEY INSIGHT: Higher exhaust velocity = more delta-v for same fuel!
   Notice how the curves flatten out at high mass ratios.
   This is the 'tyranny' - you need exponentially more fuel for linear gains.

4. Understanding Gravity

Newton’s Law of Universal Gravitation

\[F = G \cdot \frac{m_1 \cdot m_2}{r^2}\]

  • G = 6.674 × 10⁻¹¹ m³/(kg·s²) - the gravitational constant
  • r = distance between centers of the two objects

At Earth’s surface: g = 9.81 m/s²

A Common Misconception ❌

Many people think astronauts float because there’s “no gravity” in space. Wrong!

At the International Space Station (400 km altitude), gravity is still 89% as strong as on Earth’s surface. Astronauts float because they’re in free fall - constantly falling around Earth!

Code
# Constants
G = 6.674e-11       # Gravitational constant
M_EARTH = 5.972e24  # Earth's mass (kg)
R_EARTH = 6.371e6   # Earth's radius (m)

def gravity_at_altitude(altitude_km):
    """Calculate gravitational acceleration at a given altitude."""
    r = R_EARTH + (altitude_km * 1000)
    g = G * M_EARTH / r**2
    return g

# Calculate gravity at different altitudes
locations = [
    (0, "Earth's Surface"),
    (10, "Cruising Airplane"),
    (100, "Karman Line (edge of space)"),
    (400, "ISS Orbit"),
    (35786, "Geostationary Orbit"),
    (384400, "Moon's Distance"),
]

print("🌍 GRAVITY AT DIFFERENT ALTITUDES")
print("=" * 60)
for alt, name in locations:
    g = gravity_at_altitude(alt)
    percent = (g / 9.81) * 100
    print(f"{name:30} | g = {g:8.4f} m/s² ({percent:5.1f}%)")

print("\n💡 Key insight: Gravity decreases with the SQUARE of distance!")
print("   Double the distance = 1/4 the gravity")
🌍 GRAVITY AT DIFFERENT ALTITUDES
============================================================
Earth's Surface                | g =   9.8195 m/s² (100.1%)
Cruising Airplane              | g =   9.7888 m/s² ( 99.8%)
Karman Line (edge of space)    | g =   9.5184 m/s² ( 97.0%)
ISS Orbit                      | g =   8.6936 m/s² ( 88.6%)
Geostationary Orbit            | g =   0.2243 m/s² (  2.3%)
Moon's Distance                | g =   0.0026 m/s² (  0.0%)

💡 Key insight: Gravity decreases with the SQUARE of distance!
   Double the distance = 1/4 the gravity

🎓 Key Takeaways

  1. Rockets work by Newton’s Third Law - Push gas out, rocket goes up

  2. The Rocket Equation is fundamental - Δv = vₑ × ln(m₀/mf)

  3. Mass ratio matters - More fuel = more delta-v (but logarithmically!)

  4. Exhaust velocity is key - Better engines = more efficient rockets

  5. Gravity never stops - Even in orbit, you’re still being pulled by Earth


📚 Next Steps

Continue to 02_Orbital_Mechanics_Basics.ipynb to learn: - How orbits work - Circular vs elliptical orbits - How satellites stay in orbit - The vis-viva equation


“The Earth is the cradle of humanity, but mankind cannot stay in the cradle forever.” — Konstantin Tsiolkovsky