HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Python Labs
  2. /Locating an earthquake from three stations
Earth and Environmental ScienceHardHigh School (11–12)The Earth's Structure and Interior

Locating an earthquake from three stations

Three seismometers recorded a local earthquake. You will turn their S minus P lags into distances, and find the epicentre that fits all three.

The idea. Each lag gives a distance d=Δt vPvS/(vP−vS)d = \Delta t\,v_P v_S/(v_P - v_S)d=ΔtvP​vS​/(vP​−vS​). The epicentre is the point whose distances to the three stations match the three values as well as possible. A search over a grid of points finds it.

Your tasks.

  1. In distance, return the distance in km from the lag, with vP=6.0 km/sv_P = 6.0\ \text{km/s}vP​=6.0 km/s and vS=3.5 km/sv_S = 3.5\ \text{km/s}vS​=3.5 km/s.
  2. In misfit, return the sum, over the three stations, of the squared difference between the distance from the point (x,y)(x, y)(x,y) to the station and the distance from its lag.
  3. In locate, return the grid point (x,y)(x, y)(x,y), in steps of 0.5 km0.5\ \text{km}0.5 km, with the smallest misfit.

Run it first, just as it is. The checker at the end prints FAIL for each task. Then do the tasks one at a time, and run the program again after each one. A Hint appears under every check that still fails.

When every line says PASS, change the lag at station C to 7.4. How far does the epicentre move? What does that say about reading the lags to 0.1 s0.1\ \text{s}0.1 s?

StemPy LabContributed by StemPy Lab
python
Loading Python runtime…

A worked solution

Run your code once to unlock the worked solution.

Have you tried it?

Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.

Log in to save
← All Labs
← Warning, evacuation and cost in codeReading the shadow zones from a station list →
More onThe Earth's Structure and Interior

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. How rock carries wavesSeismic Waves and the Layers of the Earth

More labs on this topic

  1. The speed of a drifting continentHard
  2. Fitting a geotherm to a boreholeHard
  3. Which density contrast fits the crust?Hard
  4. Reducing a line of gravity readingsHard
Reading the shadow zones from a station listHard
All labs on this topic →