What does The Sleep Debt of Afternoon Tea conclude, in numbers, about “Solving for the Last Cup: Threshold, Quantiles and the Day's Budget”?
Answer: Chapter 5 solves for the last cup by bisection: at a half-life of 5 hours a single cup below 34.5 mg needs no cut-off, and moving coffee from covering half of customers to nine in ten brings its cut-off 6.90 hours earlier.
Scope of the numbers: Except where a source is named, its parameters are illustrative; all calculations are generated by its programs. The book is not medical advice and claims no health effect; anyone planning a self-experiment should first consult a licensed physician.
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: 34.5
| theta | 0.6054 mg/L; bedtime 23:00 |
| hours before bed (latest clock time; * = the day before) | |
| mg fast typical slow v.slow | |
| 30.0 | 0.00 (23:00 ) 0.00 (23:00 ) 0.00 (23:00 ) 0.00 (23:00 ) |
| 47.0 | 1.57 (21:26 ) 2.87 (20:08 ) 5.05 (17:57 ) 7.25 (15:45 ) |
| 107.0 | 5.73 (17:16 ) 8.80 (14:12 ) 13.95 (09:03 ) 19.12 (03:53 ) |
| 150.0 | 7.44 (15:34 ) 11.24 (11:46 ) 17.61 (05:24 ) 23.99 (23:01*) |
| 217.5 | 9.31 (13:41 ) 13.92 (09:05 ) 21.63 (01:22 ) 29.35 (17:39*) |
| doubling the dose adds 5.00 h at t1/2 5 h (= t1/2 x 1) | |
| E peaks 0.30 h after the cup | |
| largest dose with no cut-off at t1/2 5 h | 34.5 mg |
Show the full program
# Chapter 5. p51: solving for the latest cup, dose by metabolic speed
# 反解:求最小提前量 h*,使入睡后前 4 小时平均浓度 E(h*) = theta;
# E 随 h 单调下降(h 足够大时),用二分法。theta 同 p23(咖啡 107 mg、
# 典型半衰期 5 h 时截止 8.8 h)。剂量:绿茶 30(示意)、红茶 47、
# 咖啡 107、浓咖啡 150(示意)、217.5 mg(Gardiner 2023,论文截止 13.2 h)。
# 就寝 23:00。
# 对照:EFSA 2015 称单次 100 mg(约 1.5 mg/kg)临近就寝时可能延长部分成人的
# 入睡潜伏期、缩短睡眠时长。
import math
KA, V, WIN, BED = 3.0, 0.6 * 70.0, 4.0, 23.0
DOSES = [30.0, 47.0, 107.0, 150.0, 217.5]
CLASSES = [("fast", 3.5), ("typical", 5.0), ("slow", 7.5),
("v.slow", 10.0)]
def win_mean(h, dose, th, w=WIN):
ke = math.log(2.0) / th
a = dose * KA / (V * (KA - ke))
pe = (math.exp(-ke * h) - math.exp(-ke * (h + w))) / ke
pa = (math.exp(-KA * h) - math.exp(-KA * (h + w))) / KA
return a * (pe - pa) / w
def peak(th):
grid = [(win_mean(i * 0.01, 1.0, th), i * 0.01) for i in range(400)]
return max(grid)
def cutoff(dose, th, theta):
e1, h1 = peak(th)
if dose * e1 <= theta:
return 0.0
lo, hi = h1, 96.0
for _ in range(200):
mid = (lo + hi) / 2.0
if win_mean(mid, dose, th) > theta:
lo = mid
else:
hi = mid
return (lo + hi) / 2.0
def clock(h):
t = (BED - h) % 24.0
m = int(round(t * 60.0)) % 1440
tag = "*" if h > BED else " "
return "{:02d}:{:02d}{}".format(m // 60, m % 60, tag)
theta = win_mean(8.8, 107.0, 5.0)
print("theta = {:.4f} mg/L; bedtime 23:00".format(theta))
print("hours before bed (latest clock time; * = the day before)")
print(" mg " + "".join("{:>16}".format(n) for n, _ in CLASSES))
for d in DOSES:
cells = []
for _, th in CLASSES:
h = cutoff(d, th, theta)
cells.append("{:>6.2f} ({})".format(h, clock(h)))
print("{:>6.1f} ".format(d) + " ".join("{:>15}".format(c)
for c in cells))
print("doubling the dose adds {:.2f} h at t1/2 5 h (= t1/2 x 1)".format(
cutoff(94.0, 5.0, theta) - cutoff(47.0, 5.0, theta)))
e1, h1 = peak(5.0)
print("E peaks {:.2f} h after the cup".format(h1))
print("largest dose with no cut-off at t1/2 5 h: {:.1f} mg".format(
theta / e1))Single source and citation
Fan, Y. (2026). Caffeine-Theanine Pharmacokinetics, Adenosine-Receptor Half-Lives and the Sleep Debt of Afternoon Tea (Version 1.0.0), Chapter 5: Solving for the Last Cup: Threshold, Quantiles and the Day's Budget. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-186 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026186,
author = {Fan, Yafu},
title = {Caffeine-Theanine Pharmacokinetics, Adenosine-Receptor Half-Lives and the Sleep Debt of Afternoon Tea},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · The Dose Gap: the Theanine in One Cup and Drake's Four Hundred Milligrams
- Chapter 2 · The Bateman Curve: One-Compartment Oral Absorption and One Calibrated Threshold
- Chapter 3 · Fast and Slow: the CYP1A2 Half-Life Distribution and Stacked Doses
- Chapter 4 · Adenosine Receptors: Occupancy, Masked Pressure and Saturation
- Chapter 6 · A Sleep-Debt Ledger: an Interval Bracketed by Three Loss Models
- Chapter 7 · Classics East and West: Lu Yu's Chapter on Drinking and Balzac's Treatise on Modern Stimulants
- Chapter 8 · Closing the Loop: Menu Labels, a Fourteen-Night A/B Test and Pre-Registered Refutation