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
  • 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. /Decays and thresholds in code
PhysicsMediumHigh School (11–12)Modern Physics › Special Relativity

Decays and thresholds in code

You will write three functions for decays and for making new particles. All energies are rest energies or kinetic energies in MeV.

The idea. A particle of rest energy MMM at rest decays into m1m_1m1​ and m2m_2m2​, and product 1 has E1=(M2+m12−m22)/2ME_1 = (M^2 + m_1^2 - m_2^2)/2ME1​=(M2+m12​−m22​)/2M. Its momentum is pc=E12−m12pc = \sqrt{E_1^2 - m_1^2}pc=E12​−m12​​. On a fixed target, Kth=[(Σm)2−(m1+m2)2]/2m2K_\text{th} = [(\Sigma m)^2 - (m_1 + m_2)^2]/2m_2Kth​=[(Σm)2−(m1​+m2​)2]/2m2​.

Your tasks.

  1. In decay_energy, return E1E_1E1​.
  2. In decay_momentum, return pcpcpc of either product.
  3. In threshold, return the threshold kinetic energy of the beam particle.

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, find the threshold for a photon beam on protons at rest that makes a proton and a neutral pion (use a beam rest energy of 000).

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
← Relativistic energy in codeImpedance and echoes in code →
More onModern Physics › Special Relativity

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Collisions, decays and threshold energiesRelativistic Energy, Momentum, Collisions and Decays

More labs on this topic

  1. Relativistic energy in codeMedium
  2. Velocity addition and the Doppler shift in codeMedium
  3. The Lorentz transformation in codeMedium
  4. Length contraction in codeMedium
Time dilation in codeMedium
All labs on this topic →