This is canonical quantum amplitude estimation: the event's true amplitude is encoded as θ = arcsin(√a). A register of m counting qubits runs quantum phase estimation on the Grover operator Q (reflect about "bad" ∘ reflect about the initial state), which has eigenvalues e±2iθ. Measuring that register after M = 2m total Grover applications yields outcome y with the exact probability derived by Brassard, Høyer, Mosca & Tapp (2002, Theorem 12):
Δ(y) = θ − πy/M
P(y) = sin²(M·Δ(y)) / (M²·sin²(Δ(y))) [P(y)=1 if Δ(y)=0]
â(y) = sin²(πy/M) ← the amplitude estimate read off y
Each round below draws a real outcome y from that exact distribution — genuine weighted random sampling, not a scripted number — then reports â(y) and its error against the true a. Because the distribution's width scales as 1/M, repeated rounds at exponentially growing M trace out the algorithm's real quadratic-speedup envelope:
Quantum (measured): ε ~ O(1/M) M = total Grover oracle calls
Classical (measured): ε ~ O(1/√N) N = total Bernoulli samples
The classical curve on the right is not a formula either — it is the running error of an actual accumulating Monte Carlo estimator: every tick draws a real Bernoulli(a) sample and the plotted point is the true error of the sample mean so far. Both curves are logged on a log-log chart, so the quantum series should visibly fall with roughly twice the slope of the classical one — the same quadratic advantage proposed for pricing derivatives and estimating tail risk (e.g. the probability a portfolio's loss exceeds a Value-at-Risk threshold), where a is the rare "loss" event's true probability.
- True event probability a — the rare tail event being estimated; smaller a needs more rounds/samples for the same relative precision.
- Quantum rounds / s — how often a new canonical-QAE round is drawn; m cycles 0→13 then restarts, so M sweeps repeatedly while total spent queries keeps accumulating.
- Classical samples / s — how fast independent Bernoulli(a) draws accumulate into the running Monte Carlo mean.