MTC Chapter 10 — Information, Discovery, and Awareness¶
Part III · Week 9 · Seed 20261001
The Actuary's Theorem: a diversified portfolio of $n$ systems converges to $\pi^*$ at rate $1/\sqrt n$. Diversification prices what enumeration cannot.
In [1]:
import sys, os
sys.path.insert(0, r"/home/claude/mtc/mtc-course/downloads/engine_lib")
sys.path.insert(0, r"/home/claude/mtc/nbbuild")
from mtcplot import apply_style, MTC_RED, BRASS, SLATE, MTC_RED_LITE, MTC_RED_DARK
import matplotlib.pyplot as plt
import numpy as np
apply_style()
Convergence of the portfolio premium to $\pi^*$¶
The batched Monte-Carlo estimate lands on $\pi^*=10$ with standard error shrinking as the portfolio grows.
In [2]:
from engines import mtc_engine_ch10 as e
ps = e.pi_star()
sizes = [50,100,250,500,1000,2000,4000]
ests, ses = [], []
for nn in sizes:
r = e.portfolio_premium(n=nn, seed=20261001, batch=250)
ests.append(r["estimate"]); ses.append(r["std_error"])
fig, ax = plt.subplots()
ax.errorbar(sizes, ests, yerr=[1.96*s for s in ses], fmt="-o", color=MTC_RED, ecolor=BRASS, capsize=4, lw=2)
ax.axhline(ps, color=MTC_RED_DARK, ls="--"); ax.text(sizes[-1]*0.6, ps+0.15, f"$\\pi^* = {ps:g}$", color=MTC_RED_DARK, fontweight="bold")
ax.set_xscale("log"); ax.set_xlabel("portfolio size $n$"); ax.set_ylabel("premium estimate ± 95% CI")
ax.set_title("Diversification prices the unenumerable: estimate → $\\pi^*$")
plt.tight_layout(); plt.show()
print("pi* =", ps, " estimate at n=4000 =", round(ests[-1],4), " SE =", round(ses[-1],4))
pi* = 10.0 estimate at n=4000 = 10.0734 SE = 0.0464
Validation¶
Every number above is reproduced by the seeded engine; the checks below must all pass.
In [3]:
from engines import mtc_engine_ch10 as _e
v = _e.validation_checks(); v.pop("_values", None)
for k, val in v.items():
print(f" {k}: {val}")
assert v["ALL_PASS"], "validation failed"
print("\nALL_PASS — matches notebook + workbook + API")
V1_pi_star_formula: True V2_pi_star_value_10: True V3_mc_within_5pct_of_pistar: True V4_se_below_tenth_pistar: True V5_rent_full_when_secret: True V6_rent_zero_when_disclosed: True V7_rent_halved_shared_capacity: True V8_mc_positive: True ALL_PASS: True ALL_PASS — matches notebook + workbook + API