What does Live Locks, Bank Matching and Styling CRM conclude, in numbers, about “The Cascade in Closed Form, and Who Goes First”?
Answer: Chapter 2 solves the cascade in closed form: the best lock is 12 minutes (0.9909), and ordering by payment record shortens the wait but shuts out new customers.
Scope of the numbers: Its customers, delays, rates and parameters are illustrative models; all calculations are generated by its programs; the book is not legal, financial, banking or data-protection advice. Marked boxes separate published evidence, runnable Python calculations (16 programs), classical sources and the author's hypotheses.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.9909, 12
| tau | q = PAY F(tau) | formula | simulation |
|---|---|---|---|
| 5 | 0.1430 | 0.9754 | 0.9766 |
| 10 | 0.3207 | 0.9904 | 0.9899 |
| 15 | 0.4412 | 0.9905 | 0.9896 |
| 30 | 0.6152 | 0.9781 | 0.9775 |
| 60 | 0.7097 | 0.9157 | 0.9183 |
| 120 | 0.7420 | 0.7420 | 0.7465 |
| largest gap between formula and simulation: 0.0045 | |||
| best lock on a one-minute grid: 12 minutes, 0.9909 |
Show the full program
# Chapter 2. p03: The cascade in closed form. With a lock of tau
# minutes, the holder pays within the lock with chance
# q = PAY F(tau), where F is the lognormal delay distribution of p01.
# Locks then form a geometric sequence: the piece is paid by L with
# chance 1 - (1 - q)^n plus the chance that the n+1-th holder pays in
# the remaining time, where n = floor(L / tau). We compare the formula
# with the simulation of p01 (repeated here, 20000 sessions), and find
# the best tau on a one-minute grid. Seed 112.
import math
import random
from statistics import NormalDist
PAY, MED, SPREAD, L = 0.75, 12.0, 1.0, 120.0
def F(t):
if t <= 0:
return 0.0
return NormalDist().cdf((math.log(t) - math.log(MED)) / SPREAD)
def formula(tau):
q = PAY * F(tau)
n = int(L // tau)
rest = L - n * tau
return 1 - (1 - q) ** n + (1 - q) ** n * PAY * F(min(rest, tau))
def sim(tau, rng, runs=20000):
hit = 0
for _ in range(runs):
t = 0.0
while t < L:
if rng.random() < PAY:
d = rng.lognormvariate(math.log(MED), SPREAD)
if d <= tau and t + d <= L:
hit += 1
break
t += tau
return hit / runs
if __name__ == "__main__":
print(" tau q = PAY F(tau) formula simulation")
gap = 0.0
for tau in (5, 10, 15, 30, 60, 120):
s = sim(tau, random.Random(112))
gap = max(gap, abs(formula(tau) - s))
print(" {:3d} {:14.4f} {:7.4f} {:10.4f}".format(
tau, PAY * F(tau), formula(tau), s))
print(" largest gap between formula and simulation: {:.4f}".format(
gap))
best = max(range(1, 121), key=formula)
print(" best lock on a one-minute grid: {} minutes, {:.4f}".format(
best, formula(best)))Single source and citation
Fan, Y. (2026). Live-Shopping Flash Inventory Locks, Bayesian Bank-Feed Reconciliation and Personalized Styling CRM (Version 1.0.0), Chapter 2: The Cascade in Closed Form, and Who Goes First. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-112 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026112,
author = {Fan, Yafu},
title = {Live-Shopping Flash Inventory Locks, Bayesian Bank-Feed Reconciliation and Personalized Styling CRM},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · Locks on a Live Shelf: How Long to Hold a Piece
- Chapter 3 · The Same Five Digits Twice: Collisions, Masks and Offsets
- Chapter 4 · Matching Rows to Orders: Likelihoods and the Hungarian Method
- Chapter 5 · A Hybrid Recommender: Taste in Shapes and Colours People Name
- Chapter 6 · Waking the Pool: Blasts, Targets and the Right Day
- Chapter 7 · Permits, Secret Codes and Record Linkage
- Chapter 8 · Practice: One Year of Live Sessions and One Test Protocol