Implement the cumulative standard normal Φ(z) with math.erf and reproduce the four table lookups from the lesson to four decimals.
Implement the cumulative standard normal Φ(z) with math.erf and reproduce the four table lookups from the lesson to four decimals.
Answer
import math def Phi(z): """Cumulative standard normal: P(Z <= z), the z-table's cell.""" return 0.5 * (1 + math.erf(z / math.sqrt(2))) print(f"Phi(1.28)={Phi(1.28):.4f}") print(f"Phi(-2.05)={Phi(-2.05):.4f}") print(f"P(Z>0.67)={1 - Phi(0.67):.4f}") print(f"P(-1.5<Z<0.75)={Phi(0.75) - Phi(-1.5):.4f}")
IBS1 §6.2 for the problem types and App. A11 for the contrast (CC BY 4.0 — no lookup transplanted); cumulative convention per the S21 W7 handout (shape only)