What does Attribution, Bandits and Customer Lifetime Value conclude, in numbers, about “Reading the Classics: *Shi* and *Jie* in the *Sunzi*”?
Answer: With goodwill depreciating 1 % a day (half-life 69 days), the last 7 days take only 29.0 % of the budget, and the result hardly differs from even spending (goodwill on the event day is only 0.4 % higher); at 5 % a day (half-life 13.5 days), the last 7 days take 53.7 % and goodwill is 9.1 % higher than with even spending; at 15 %, the last 7 days take 89.7 % and goodwill is 57.2 % higher; at 40 % (half-life 1.4 days), almost the whole budget falls in the last week and goodwill is 2.739 times that of even spending. A numerical search agrees with the analytic solution at both depreciation rates checked (ratio 1.0000).
Scope of the numbers: Which advertising channel should a sale be credited to? When may an A/B test stop? What is a customer still worth? This book presents mathematical models for teaching and research and is not marketing, investment or legal advice. Marked boxes separate published evidence, runnable Python calculations (16 programs), classical sources and the author's models and hypotheses; all data in the book are fictional or simulated.
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.4, 1.0000, 1.4, 13.5, 2.739, 29.0
| daily decay last 7 days' share of budget stock: optimal / even search check | |
| 0.01 | 29.0% 1.004 |
| 0.05 | 53.7% 1.091 1.0000 |
| 0.15 | 89.7% 1.572 |
| 0.40 | 99.9% 2.739 1.0000 |
| half-life of goodwill (days) | 0.01: 69.0, 0.05: 13.5, 0.15: 4.3, 0.4: 1.4 |
Show the full program
# THE AUTHOR'S MODEL, an analogy for Sunzi's "shi" (stored force) and "jie" (short,
# well-timed release). A goodwill stock (Nerlove & Arrow 1962) decays by a fraction
# delta a day: G_{t+1} = (1 - delta) G_t + sqrt(A_t) (diminishing daily returns). A
# 30-day budget B is spent to maximise the stock on day 30, when a one-day sales event
# converts a fixed share of it. Lagrange: A_t proportional to (1 - delta)^(2 (30 - t)),
# checked by a numerical search. Output: share of the budget spent in the last 7 days
# and the stock relative to spending evenly, for slow and fast decay.
import math
DAYS, B = 30, 30_000.0
def stock(A, delta):
G = 0.0
for a in A:
G = (1 - delta) * G + math.sqrt(a)
return G
def optimal(delta):
w = [(1 - delta) ** (2 * (DAYS - 1 - t)) for t in range(DAYS)]
return [B * x / sum(w) for x in w]
def search(delta, sweeps=200):
A = [B / DAYS] * DAYS # pairwise transfers keep the budget fixed
step = B / DAYS / 2
while step > 1e-3:
improved = False
for i in range(DAYS):
for j in range(DAYS):
if i != j and A[i] >= step:
C = A[:]; C[i] -= step; C[j] += step
if stock(C, delta) > stock(A, delta) + 1e-12:
A, improved = C, True
if not improved:
step /= 2
return A
if __name__ == "__main__":
print("daily decay last 7 days' share of budget stock: optimal / even"
" search check")
for delta in (0.01, 0.05, 0.15, 0.40):
A = optimal(delta); even = [B / DAYS] * DAYS
share = sum(A[-7:]) / B
chk = None
if delta in (0.05, 0.40):
chk = stock(search(delta), delta) / stock(A, delta)
print(f" {delta:5.2f} {share:6.1%} "
f"{stock(A, delta) / stock(even, delta):5.3f}"
+ (f" {chk:.4f}" if chk else ""))
print("half-life of goodwill (days): " + ", ".join(
f"{d}: {math.log(0.5) / math.log(1 - d):.1f}" for d in (0.01, 0.05, 0.15, 0.40)))Single source and citation
Fan, Y. (2026). Algorithmic Marketing, Multi-Touch Shapley Attribution and Stochastic Control of Acquisition Funnels (Version 1.0.0), Chapter 7: Reading the Classics: *Shi* and *Jie* in the *Sunzi*. 5D Library. https://doi.org/10.5281/zenodo.23836264
DOI: 10.5281/zenodo.23836264 · Read the monograph · 5DL-B-048 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026048,
author = {Fan, Yafu},
title = {Algorithmic Marketing, Multi-Touch Shapley Attribution and Stochastic Control of Acquisition Funnels},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
doi = {10.5281/zenodo.23836264},
url = {https://doi.org/10.5281/zenodo.23836264}
}Other chapter answers in this book
- Chapter 1 · Attribution Is Not Incrementality: Last Click, Potential Outcomes and Randomised Holdouts
- Chapter 2 · Shapley Values and Markov Removal Effects: Exact Allocations of an Inexact Question
- Chapter 3 · The Price of Peeking: Optional Stopping, Group-Sequential Designs and Always-Valid Inference
- Chapter 4 · Learning While Earning: Thompson Sampling and the Bias of Adaptive Experiments
- Chapter 5 · What Is a Customer Still Worth? BG/NBD, Gamma-Gamma and the Illusion of Rising Retention
- Chapter 6 · Diffusion and Spend: the Bass Model, the Dorfman–Steiner Condition and Whole-Life Budgets
- Chapter 8 · Practice and a Pre-Registered Test