What does Solar Terms, Thermal Lag and Seasonal Demand conclude, in numbers, about “The Phase of Demand: Regressing Demand on Temperature, and the Misplaced Nominal Season”?

Answer: Chapter 5 links demand to temperature: a plan that follows the term names passes halfway in week 10 while true demand does so in week 14, exactly a month early; only daylight-driven categories escape the lag.

Scope of the numbers: Parameters in this book are illustrative; all calculations are generated by the book's programs; the book is non-personalised business guidance, and its order dates are demonstrations that promise no sales to any merchant. Chapter 4 shows that "the hottest day" is a statistic dominated by weather noise: in illustrative data the single hottest day misses by 16.81 days, while the harmonic phase from three years of daily data misses by only 1.25 days.

中文版

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: 10, 14

season demand (units)17,488; truth reaches half in week 14
plan lag MAPE half-wk lost % left % mean stock peak
0.00.531 10 2.65 0.00 2.31 4.30
15.00.298 12 0.47 0.00 1.39 2.18
32.50.000 14 0.00 0.00 0.00 0.00
44.00.193 15 7.84 7.50 0.74 5.52
d0.00: plan(l=0) / truth = 1.205
d15.70: plan(l=0) / truth = 1.006
d31.45: plan(l=0) / truth = 0.840
d47.14: plan(l=0) / truth = 0.678
Show the full program
# Chapter 5. p52: ordering by the names of the terms versus the lag
# ILLUSTRATIVE strongly seasonal category (iced drinks sold by the
# case, made-up numbers). Expected daily units
# 30 + 12.0 E[max(0, T - 18)], T normal with sd 3.0 C around the
# seasonal mean 14.0 + 14.0 cos(w (d - L)), d = days after Xiazhi,
# true lag L = 32.5 days. E[max(0, X)] for X normal(mu, s) is
# mu Phi(mu / s) + s phi(mu / s). The season runs 26 weeks from
# d = -60. A plan assumes lag l: l = 0 is "the terms as named"
# (midsummer at Xiazhi). Each week the plan delivers its forecast;
# unsold units carry over, unmet demand is lost. Stock is counted in
# weeks of that week's true demand. All sums by fsum.
import math

YEAR = 365.2422
W = 2 * math.pi / YEAR
TRUE_LAG = 32.5
SD_T = 3.0


def phi(z):
    return math.exp(-0.5 * z * z) / math.sqrt(2 * math.pi)


def cdf(z):
    return 0.5 * (1 + math.erf(z / math.sqrt(2)))


def pos_part(mu, s):
    return mu * cdf(mu / s) + s * phi(mu / s)


def daily(d, lag):
    m = 14.0 + 14.0 * math.cos(W * (d - lag))
    return 30 + 12.0 * pos_part(m - 18, SD_T)


def weekly(lag, first=-60, weeks=26):
    return [math.fsum(daily(first + 7 * w + i, lag) for i in range(7))
            for w in range(weeks)]


def half_week(series):
    total = math.fsum(series)
    for k in range(len(series)):
        if math.fsum(series[:k + 1]) >= total / 2:
            return k
    return len(series) - 1


if __name__ == "__main__":
    truth = weekly(TRUE_LAG)
    total = math.fsum(truth)
    print("season demand (units): {:,.0f}; truth reaches half in week {}"
          .format(total, half_week(truth) + 1))
    print("plan lag  MAPE   half-wk  lost %  left %  mean stock  peak")
    for lag in (0.0, 15.0, 32.5, 44.0):
        plan = weekly(lag)
        mape = math.fsum(abs(p - t) / t for p, t in zip(plan, truth))
        mape /= len(truth)
        stock, lost, peak, held = 0.0, [], 0.0, []
        for p, t in zip(plan, truth):
            stock = stock + p
            sold = min(stock, t)
            lost.append(t - sold)
            stock = stock - sold
            held.append(stock / t)
            peak = max(peak, stock / t)
        print("{:8.1f}  {:5.3f}  {:7d}  {:6.2f}  {:6.2f}  {:10.2f}  {:4.2f}"
              .format(lag, mape, half_week(plan) + 1,
                      100 * math.fsum(lost) / total, 100 * stock / total,
                      math.fsum(held) / len(held), peak))
    for d in (0, 15.7, 31.45, 47.14):
        print("d = {:5.2f}: plan(l=0) / truth = {:.3f}".format(
            d, daily(d, 0.0) / daily(d, TRUE_LAG)))

Single source and citation

Fan, Y. (2026). Temperature Phase Lag across the Twenty-Four Solar Terms, First-Order Thermal Inertia behind the Dog Days and Seasonal Demand Forecasting (Version 1.0.0), Chapter 5: The Phase of Demand: Regressing Demand on Temperature, and the Misplaced Nominal Season. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-232 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026232,
  author    = {Fan, Yafu},
  title     = {Temperature Phase Lag across the Twenty-Four Solar Terms, First-Order Thermal Inertia behind the Dog Days and Seasonal Demand Forecasting},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book