Normal Distribution Calculator
Calculate probabilities and percentiles for the normal (Gaussian) distribution.
Common normal distribution coverages:
| Sigma Range | Coverage | z |
|---|---|---|
| 1Ï | 68.27% | ±1.000 |
| 2Ï | 95.45% | ±2.000 |
| 3Ï | 99.73% | ±3.000 |
| 1.96Ï | 95.00% | ±1.960 |
| 2.576Ï | 99.00% | ±2.576 |
Questions Fréquentes
Implémentation du Code
import math
def norm_cdf(x):
"""Standard normal CDF using math.erfc"""
return 0.5 * math.erfc(-x / math.sqrt(2))
def normal_cdf(x, mu=0, sigma=1):
"""Normal CDF with given mean and std dev"""
return norm_cdf((x - mu) / sigma)
def normal_pdf(x, mu=0, sigma=1):
"""Normal probability density function"""
return (1 / (sigma * math.sqrt(2 * math.pi))) * math.exp(-0.5 * ((x - mu) / sigma) ** 2)
# P(X < 1) for standard normal
print(f"P(X < 1) = {norm_cdf(1):.4%}") # 84.1345%
# P(0 < X < 1) for N(0,1)
print(f"P(0<X<1) = {norm_cdf(1) - norm_cdf(0):.4%}") # 34.1345%
# Using scipy for more features
from scipy import stats
mu, sigma = 100, 15 # IQ scores
print(f"P(IQ < 130) = {stats.norm.cdf(130, mu, sigma):.4%}")
print(f"90th percentile IQ = {stats.norm.ppf(0.90, mu, sigma):.1f}")Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.