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. /Which density contrast fits the crust?
Earth and Environmental ScienceHardHigh School (11–12)The Earth's Structure and Interior

Which density contrast fits the crust?

A seismic line crossed a mountain belt and measured the thickness of the crust under five places of different height. You will test the Airy picture and find the density contrast between the mantle and the crust that fits the data best.

The idea. In the Airy picture the crust is 35+h (1+ρc/Δρ)35 + h\,(1 + \rho_c/\Delta\rho)35+h(1+ρc​/Δρ) km thick, with hhh the height in km, ρc=2800 kg/m3\rho_c = 2800\ \text{kg/m}^3ρc​=2800 kg/m3 and Δρ=ρm−ρc\Delta\rho = \rho_m - \rho_cΔρ=ρm​−ρc​. The root-mean-square error compares a model with the data.

Your tasks.

  1. In airy_thickness, return the thickness in km for a height and a density contrast.
  2. In rms_error, return the root-mean-square difference between the model and the five measured thicknesses.
  3. In best_contrast, search the contrasts from 300300300 to 800 kg/m3800\ \text{kg/m}^3800 kg/m3 in steps of 101010 and return the one with the smallest error.

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, try a contrast of 500500500 and then 700700700 in rms_error. How much worse is 700700700? What does that say about how well a line of five points fixes the density contrast?

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
← Reducing a line of gravity readingsFitting a geotherm to a borehole →
More onThe Earth's Structure and Interior

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Isostasy and the floating crustGravity, Isostasy and the Shape of the Earth

More labs on this topic

  1. The speed of a drifting continentHard
  2. Fitting a geotherm to a boreholeHard
  3. Reducing a line of gravity readingsHard
  4. Reading the shadow zones from a station listHard
Locating an earthquake from three stationsHard
All labs on this topic →