Saturday, 28 March 2026

The Power of the Point: Decoding Earthquake Magnitudes Through Code

Yesterday, we took a deep dive into the math behind the ground shaking beneath our feet. While we often hear numbers like "7.0" or "8.0" on the news, those small decimals hide a staggering reality of exponential growth.

​Using Python and numpy, we mapped out exactly how much the world moves—and how much energy is released—when the Richter scale ticks upward.

​The Logarithmic Reality

​The Richter scale isn't linear; it’s logarithmic. This means a magnitude 8.0 isn't just "a bit stronger" than a 7.0—it represents significantly more ground displacement and a massive leap in energy.



import numpy as np

def ground_movement(r):
    # Represents relative ground displacement in meters
    return 1e-06 * 10**r
 
def energy_produced(r):
    # Approximation of energy in tons of TNT
    return 3 * 10**(1.5 * (r - 3.5))

ritcher_values = {
    "Hand grenade": 0.2, 
    "1 stick dynamite": 1.2,
    "Chernobyl": 3.9,
    "2010 Quebec": 5.0, 
    "2011 Washington": 5.8, 
    "2010 Haiti": 7.0, 
    "1906 San Francisco": 8.0, 
    "1883 Krakatoa": 8.8, 
    "1964 Anchorage": 9.2,
    "Chicxulub Impact": 12.6
}

# Converting to numpy arrays for vectorized calculations
events = np.array(list(ritcher_values.keys()))
r_magnitudes = np.array(list(ritcher_values.values()))
grnd_movement = ground_movement(r_magnitudes)
energy = energy_produced(r_magnitudes)

# Formatting the Output Table
print(f"{'Event':<20} | {'R':>5} | {'Grnd Move (m)':>15} | {'Energy (Tons TNT)':>18}")
print("-" * 65)

for ev, rm, gm, eng in zip(events, r_magnitudes, grnd_movement, energy):
    # Using scientific notation for ground movement and energy due to the massive range
    print(f"{ev:<20} | {rm:>5.1f} | {gm:>15.2e} | {eng:>18.2e}")
Earthquakes remind us that nature doesn't operate on a simple 1-to-10 scale. It operates on a curve that turns a ripple into a mountain-mover in just a few decimal points.

No comments:

Post a Comment

Visualizing Particle Kinematics with Python

Understanding the relationship between position, velocity, and acceleration is fundamental to physics. However, seeing how these variables e...