4.2b Spontaneous decay labs
Source: Lab ideas from Computational Physics (Landau, Páez, Bordeianu), §4.3.4. Rewritten as original drills. Continues 4.2 Spontaneous decay.
Simulate discrete decay with the chapter LCG (r ← (1103515245 r + 12345) % 2³¹, uniform r/2³¹). Each time step, every remaining nucleus decays independently if rnd() < lambda. Stubs fail until you fill them in.
Formula refresh
Warm up: pick the matching equation among lookalikes (same walk as the theory lesson).
Labs
Run until . Each line: t Delta N (integers). Time starts at for the first step (no row).
Input: N0 lambda seed (lambda is a float).
Write-ups
Using “random”, “average”, and “exponential”, explain:
In your own words: how can a process that is spontaneous and random at heart produce exponential decay?
Minimum 4 words. Your answer must include: “random”, “average”, “exponential”.
Meet the writing requirements, then you can open the model answer.
Explorers
Reference sketch — spontaneous decay
Older demos beeped with winsound on Windows each time a nucleus decayed. The loop below is the same physics: each survivor decays with probability per time step. Print a * (or call your own sound API) for each decay — that irregular slowing click train is the Geiger-counter intuition. Graded labs use the fixed LCG, not random.random().
# decay_ref.py — spontaneous decay (reference sketch)
import random
random.seed(None) # or an int for a repeatable run
lam = 0.005
N = 80
t_max = 500
print("t N")
print(0, N)
for t in range(1, t_max + 1):
if N <= 0:
break
still = 0
for _ in range(N):
if random.random() < lam:
# winsound.Beep(600, 100) # optional Geiger click on Windows
print("*", end="", flush=True) # stand-in click
else:
still += 1
N = still
print()
print(t, N)