# Exercise 3: where does the volcanic arc sit? # Horizontal distance from the trench = depth of slab / tan(dip angle) import math def arc_distance(depth_km, dip_deg): return depth_km / math.tan(math.radians(dip_deg)) for dip in (20, 30, 45, 60): print(f"dip {dip:2d} degrees: arc is {arc_distance(100, dip):4.0f} km from the trench") # A real arc is 150 km from the trench and the slab is 100 km deep there. # Work backwards for the dip: dip = math.degrees(math.atan(100 / 150)) print(f"dip = {dip:.0f} degrees") # Shallow slabs put the arc far inland; steep slabs bring it close to the trench.