Lesson 14 of 15
Law of Large Numbers & CLT
Convergence of Sample Averages
Law of Large Numbers (LLN)
If are i.i.d. with mean , then the sample mean converges to in probability as :
The larger your sample, the closer the average is to the true mean.
Central Limit Theorem (CLT)
Even more remarkable: regardless of the original distribution, the standardized sample mean converges to :
This is why the normal distribution appears everywhere — it is the universal limiting shape of averages.
Box-Muller Transform
To generate from uniform samples :
import math, random
rng = random.Random(42)
u1, u2 = rng.random(), rng.random()
z = math.sqrt(-2 * math.log(u1)) * math.cos(2 * math.pi * u2)
# z is a single standard normal sample
Your Task
Implement sample_mean(n, mu, sigma, seed) using Box-Muller with random.Random(seed). Return the sample mean of draws from , rounded to 2 decimal places.
Pyodide loading...
Loading...
Click "Run" to execute your code.