# Exercise 1: how fast does a tsunami cross the sea? # Shallow-water wave speed: v = sqrt(g * depth) import math G = 9.81 def tsunami_speed_kmh(depth_m): return math.sqrt(G * depth_m) * 3.6 for depth in (50, 200, 1000, 4000): print(f"depth {depth:5d} m -> {tsunami_speed_kmh(depth):6.0f} km/h") distance_km = 150 speed = tsunami_speed_kmh(40) print(f"150 km over a 40 m deep sea takes {distance_km / speed * 60:.0f} minutes") # depth 50 m -> 80 km/h # depth 200 m -> 159 km/h # depth 1000 m -> 357 km/h # depth 4000 m -> 713 km/h # 150 km over a 40 m deep sea takes 126 minutes # The wave slows in shallow water, which is why it piles up higher near the coast. # Real tsunami speeds depend on the sea floor all along the path, so this is only an estimate.