Lesson 12 of 15
Normal Distribution
The Bell Curve
is the most important distribution in probability. Its PDF is:
Standard Normal
. Any normal can be standardized: .
CDF via Error Function
The CDF has no closed form in elementary functions, but Python provides it via math.erf:
import math
def normal_cdf(mu, sigma, x):
return 0.5 * (1 + math.erf((x - mu) / (sigma * math.sqrt(2))))
def normal_pdf(mu, sigma, x):
return (1 / (sigma * math.sqrt(2 * math.pi))) * math.exp(-0.5 * ((x - mu) / sigma)**2)
The 68-95-99.7 Rule
| Range | Probability |
|---|---|
| 68.27% | |
| 95.45% | |
| 99.73% |
Why It's Everywhere
The Central Limit Theorem (next lesson) guarantees that the sum of many independent random variables converges to a normal distribution, regardless of the original distribution.
Your Task
Implement normal_full(mu, sigma, x) that prints CDF then PDF of , each rounded to 4 decimal places.
Pyodide loading...
Loading...
Click "Run" to execute your code.