Skip to main content

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​

Activity: Decay trajectory

Run until N=0N=0. Each line: t Delta N (integers). Time starts at t=1t=1 for the first step (no t=0t=0 row).

Input: N0 lambda seed (lambda is a float).

Write-ups​

0/4 solved
4.2b.W1

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”.

0 words/ 4 min

Meet the writing requirements, then you can open the model answer.

Explorers​

Figure 4.7 — stochastic vs exponential decay.

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 λ\lambda 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)

Next: 4.3 Testing random distributions.