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

tauq = PAY F(tau)formulasimulation
50.14300.97540.9766
100.32070.99040.9899
150.44120.99050.9896
300.61520.97810.9775
600.70970.91570.9183
1200.74200.74200.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