5D Library › Five-Node Cyclic Network Dynamics, Solar-Longitude Ephemeris and Multi-Scale Oscillator Perturbations · 中文

Chapter 6. Mean and True Solar Terms, Unequal-Interval Interpolation and the Drift of Calendar Constants

Back from the model to the tables

The ring of the last four chapters is abstract. This chapter returns to Chapter 1’s Sun and to three concrete numerical problems from the history of the Chinese calendar. Are the twenty-four solar terms an equal division of the year (mean terms, pingqi) or a division by the Sun’s true longitude (true terms, dingqi)? Between terms, how does equal-interval interpolation of the Sun’s position differ from unequal-interval interpolation? And once calendar constants are written as fractions, how do their errors accumulate over the centuries? The book’s programs answer all three directly.

Mean and true terms

Calculation

Two divisions. True terms: the instants at which the Sun’s apparent longitude reaches 270∘+15∘k270^\circ + 15^\circ k. Mean terms: the winter-solstice instant plus kk twenty-fourths of a tropical year. The difference comes from the unevenness of the Sun’s motion — Chapter 1’s Kepler equation.

Calculation

# Chapter 6. p12: Mean solar terms (pingqi) against true solar terms (dingqi).
# True terms: the Sun's apparent longitude reaches 270 + 15k deg (the low-
# precision solar theory of p03). Mean terms: the winter-solstice instant
# plus k times (tropical year / 24), the tropical year 365.2422 days.
# Winter solstice of 2026 to that of 2027. Reported: the gap between the
# two dates of each term, and the length of each true-term interval.
import math

NAMES = ("Winter solstice", "Minor cold", "Major cold", "Spring begins",
         "Rain water", "Insects waken", "Spring equinox", "Pure brightness",
         "Grain rain", "Summer begins", "Grain buds", "Grain in ear",
         "Summer solstice", "Minor heat", "Major heat", "Autumn begins",
         "End of heat", "White dew", "Autumn equinox", "Cold dew",
         "Frost descends", "Winter begins", "Minor snow", "Major snow")

def sun_lon(jd):
    t = (jd - 2451545.0) / 36525
    l0 = 280.46646 + 36000.76983 * t + 0.0003032 * t * t
    m = math.radians(357.52911 + 35999.05029 * t - 0.0001537 * t * t)
    c = ((1.914602 - 0.004817 * t - 0.000014 * t * t) * math.sin(m)
         + (0.019993 - 0.000101 * t) * math.sin(2 * m)
         + 0.000289 * math.sin(3 * m))
    om = math.radians(125.04 - 1934.136 * t)
    return (l0 + c - 0.00569 - 0.00478 * math.sin(om)) % 360

def when(target, jd0):
    lo, hi = jd0, jd0 + 40
    while (sun_lon(hi) - target) % 360 > 180:
        hi += 5
    for _ in range(60):
        mid = (lo + hi) / 2
        if (sun_lon(mid) - target) % 360 < 180:
            hi = mid
        else:
            lo = mid
    return (lo + hi) / 2

if __name__ == "__main__":
    ws = when(270.0, 2461380.5)                  # around 2026 Dec 22
    true, j = [ws], ws
    for k in range(1, 25):
        j = when((270 + 15 * k) % 360, j + 10)
        true.append(j)
    year = 365.2422
    print("winter solstice 2026 at JD {:.4f}; next at JD {:.4f}".format(
        true[0], true[24]))
    print("\n   term               true - mean (days)   interval (days)")
    worst = 0.0
    for k in range(24):
        gap = true[k] - (ws + k * year / 24)
        worst = max(worst, abs(gap))
        print("   {:<18}      {:+6.3f}            {:6.3f}".format(
            NAMES[k], gap, true[k + 1] - true[k]))
    iv = [b - a for a, b in zip(true, true[1:])]
    print("\nlargest gap {:.3f} days".format(worst))
    print("intervals: shortest {:.3f}, longest {:.3f}, mean {:.4f}".format(
        min(iv), max(iv), sum(iv) / 24))
    print("\nReading: equal division of the year misplaces the true terms")
    print("by up to 2.4 days, because the Sun moves fastest near")
    print("perihelion in early January: true terms near the winter")
    print("solstice are under fifteen days apart, those near the summer")
    print("solstice nearly fifteen and three-quarters.")
# winter solstice 2026 at JD 2461396.3675; next at JD 2461761.6092
#
#    term               true - mean (days)   interval (days)
#    Winter solstice         +0.000            14.720
#    Minor cold              -0.498            14.724
#    Major cold              -0.993            14.760
#    Spring begins           -1.451            14.826
#    Rain water              -1.843            14.919
#    Insects waken           -2.142            15.033
#    Spring equinox          -2.328            15.160
#    Pure brightness         -2.386            15.292
#    Grain rain              -2.312            15.421
#    Summer begins           -2.109            15.537
#    Grain buds              -1.791            15.631
#    Grain in ear            -1.379            15.696
#    Summer solstice         -0.901            15.729
#    Minor heat              -0.390            15.725
#    Major heat              +0.116            15.685
#    Autumn begins           +0.583            15.613
#    End of heat             +0.977            15.514
#    White dew               +1.272            15.394
#    Autumn equinox          +1.448            15.264
#    Cold dew                +1.494            15.132
#    Frost descends          +1.408            15.007
#    Winter begins           +1.197            14.898
#    Minor snow              +0.877            14.810
#    Major snow              +0.468            14.750
#
# largest gap 2.386 days
# intervals: shortest 14.720, longest 15.729, mean 15.2184
#
# Reading: equal division of the year misplaces the true terms
# by up to 2.4 days, because the Sun moves fastest near
# perihelion in early January: true terms near the winter
# solstice are under fifteen days apart, those near the summer
# solstice nearly fifteen and three-quarters.

From the 2026 winter solstice to the 2027 one, mean and true terms differ by up to 2.386 days, around Pure Brightness: equal division of the year places it 2.386 days after the true term. Around the autumn equinox the opposite holds, the mean term coming 1.448 to 1.494 days early. The intervals between true terms are not equal: the first after the winter solstice is the shortest, 14.720 days; those around the summer solstice are the longest, 15.729 days; the mean is 15.2184 days, a twenty-fourth of a tropical year. Short intervals fall in winter and long ones in summer because Earth passes perihelion in early January, when the Sun’s apparent motion is fastest.

Equal- and unequal-interval interpolation

A calendar must give the Sun’s position at any moment between terms. The simplest assumption is that the Sun moves evenly within each step; better is quadratic interpolation through three nodes. Liu Zhuo’s Huangji calendar of the Sui introduced equal-interval quadratic interpolation; Yixing’s Dayan calendar of the Tang took true terms as nodes, which are unequally spaced in time, and so needed unequal-interval quadratic interpolation (Needham and Wang 1959; 陈美东 2003).

Calculation

Newton’s divided differences. For three nodes unequally spaced in time, (t0,λ0),(t1,λ1),(t2,λ2)(t_0, \lambda_0), (t_1, \lambda_1), (t_2, \lambda_2), λ(t)≈λ0+[t0,t1](t−t0)+[t0,t1,t2](t−t0)(t−t1),\lambda(t) \approx \lambda_0 + [t_0, t_1](t – t_0) + [t_0, t_1, t_2](t – t_0)(t – t_1), with first divided difference [t0,t1]=(λ1−λ0)/(t1−t0)[t_0, t_1] = (\lambda_1 – \lambda_0)/(t_1 – t_0) and second [t0,t1,t2]=([t1,t2]−[t0,t1])/(t2−t0)[t_0, t_1, t_2] = ([t_1, t_2] – [t_0, t_1])/(t_2 – t_0). With equally spaced nodes it reduces to the equal-interval quadratic formula.

Calculation

# Chapter 6. p13: Interpolating the Sun between tabulated nodes.
# Task: the Sun's longitude at any moment of the year, from a table.
#   L  linear between true-term nodes (the Sun moves evenly within each
#      15-degree step)
#   E  equal-interval quadratic: nodes at the mean terms (equal times,
#      the true longitude tabulated there), three nodes at a time - the
#      kind of second-difference scheme Liu Zhuo's Huangji calendar (600)
#      introduced
#   U  unequal-interval quadratic: nodes at the true terms (equal steps
#      in longitude, unequal in time), Newton divided differences on
#      three nodes - the case Yixing's Dayan calendar (727) had to solve
# Truth: the low-precision theory of p03/p12. Error is sampled every
# 0.05 day through the year from the 2026 winter solstice.
import math

def sun_lon(jd):
    t = (jd - 2451545.0) / 36525
    l0 = 280.46646 + 36000.76983 * t + 0.0003032 * t * t
    m = math.radians(357.52911 + 35999.05029 * t - 0.0001537 * t * t)
    c = ((1.914602 - 0.004817 * t - 0.000014 * t * t) * math.sin(m)
         + (0.019993 - 0.000101 * t) * math.sin(2 * m)
         + 0.000289 * math.sin(3 * m))
    om = math.radians(125.04 - 1934.136 * t)
    return (l0 + c - 0.00569 - 0.00478 * math.sin(om)) % 360

def when(target, jd0):
    lo, hi = jd0, jd0 + 40
    for _ in range(60):
        mid = (lo + hi) / 2
        if (sun_lon(mid) - target) % 360 < 180:
            hi = mid
        else:
            lo = mid
    return (lo + hi) / 2

def unwrap(vals):
    out = [vals[0]]
    for v in vals[1:]:
        while v < out[-1] - 180:
            v += 360
        out.append(v)
    return out

def quad(xs, ys, x):
    d1 = (ys[1] - ys[0]) / (xs[1] - xs[0])
    d2 = (ys[2] - ys[1]) / (xs[2] - xs[1])
    dd = (d2 - d1) / (xs[2] - xs[0])
    return ys[0] + d1 * (x - xs[0]) + dd * (x - xs[0]) * (x - xs[1])

def pick(nodes, x):
    i = max(k for k in range(len(nodes) - 1) if nodes[k] <= x)
    i = min(max(i, 1), len(nodes) - 2)
    return i - 1

if __name__ == "__main__":
    ws = when(270.0, 2461380.5)
    true_t = [ws]
    for k in range(1, 27):
        true_t.append(when((270 + 15 * k) % 360, true_t[-1] + 10))
    true_l = [270.0 + 15 * k for k in range(27)]
    step = 365.2422 / 24
    mean_t = [ws + k * step for k in range(27)]
    mean_l = unwrap([sun_lon(t) for t in mean_t])
    err = {"L": 0.0, "E": 0.0, "U": 0.0}
    rms = {"L": 0.0, "E": 0.0, "U": 0.0}
    n, t = 0, ws + 0.05
    while t < ws + 365.0:
        truth = unwrap([270.0, sun_lon(t)])[1]
        while truth < 270.0:
            truth += 360
        i = max(k for k in range(26) if true_t[k] <= t)
        lin = true_l[i] + 15 * (t - true_t[i]) / (true_t[i + 1] - true_t[i])
        j = pick(mean_t, t)
        e = quad(mean_t[j:j + 3], mean_l[j:j + 3], t)
        j = pick(true_t, t)
        u = quad(true_t[j:j + 3], true_l[j:j + 3], t)
        for key, val in (("L", lin), ("E", e), ("U", u)):
            d = (val - truth) * 60          # arcminutes
            err[key] = max(err[key], abs(d))
            rms[key] += d * d
        n += 1
        t += 0.05
    print("   scheme                               max error   rms error")
    for key, name in (("L", "L linear on true terms"),
                      ("E", "E equal-interval quadratic"),
                      ("U", "U unequal-interval quadratic")):
        print("   {:<34}  {:7.3f}'    {:7.3f}'".format(
            name, err[key], math.sqrt(rms[key] / n)))
    print("   (arcminutes; the Sun moves about 59' a day)")
    print("\nReading: treating the Sun as moving evenly inside each step")
    print("costs up to about one arcminute - some 24 minutes of solar")
    print("motion. Either quadratic scheme cuts the error about sevenfold;")
    print("but on the true-term table, whose nodes are unequally spaced in")
    print("time, only the unequal-interval formula applies.")
#    scheme                               max error   rms error
#    L linear on true terms                0.978'      0.507'
#    E equal-interval quadratic            0.143'      0.067'
#    U unequal-interval quadratic          0.134'      0.067'
#    (arcminutes; the Sun moves about 59' a day)
#
# Reading: treating the Sun as moving evenly inside each step
# costs up to about one arcminute - some 24 minutes of solar
# motion. Either quadratic scheme cuts the error about sevenfold;
# but on the true-term table, whose nodes are unequally spaced in
# time, only the unequal-interval formula applies.

Treating the Sun as moving evenly within each solar-term step gives a largest error of 0.978 arcminutes and a root-mean-square error of 0.507; the Sun moves about 59 arcminutes a day, so this is some 24 minutes of solar motion. Equal-interval quadratic interpolation brings the largest error down to 0.143 arcminutes and unequal-interval quadratic interpolation to 0.134; both cut the error about sevenfold, with the same root-mean-square error of 0.067.

The two quadratic schemes are equally accurate; what differs is the table they apply to. A table with mean terms as nodes is equally spaced and takes the equal-interval formula; a table with true terms as nodes is unequally spaced in time and takes only the unequal-interval one. Yixing used true terms as nodes and so needed the unequal-interval method — an example of the mathematical form following the structure of the table.

Calendar constants: fractions and drift

Calculation

# Chapter 6. p14: Calendar constants as rational numbers, and their drift.
# Each calendar fixed a year and a month as fractions of a day:
#   Santong (Liu Xin, Han)   year 365 + 385/1539,  month 29 + 43/81
#   Sifen (85 CE)            year 365 + 1/4,       month 29 + 499/940
#   Dayan (Yixing, 727)      year 1110343/3040,    month 89773/3040
#   Shoushi (1281)           year 365.2425,        month 29.530593
# Modern mean values (near 2000): tropical year 365.24219 days, synodic
# month 29.530589 days (they change slowly; this is a first-order
# comparison). Drift = error x elapsed years (or months), in days per
# century. The 19-year, 235-month cycle (zhang) error is also shown.
from fractions import Fraction as F

YEAR, MONTH = 365.24219, 29.530589
CAL = (("Santong", F(365) + F(385, 1539), F(29) + F(43, 81)),
       ("Sifen", F(365) + F(1, 4), F(29) + F(499, 940)),
       ("Dayan", F(1110343, 3040), F(89773, 3040)),
       ("Shoushi", F(3652425, 10000), F(29530593, 1000000)))

if __name__ == "__main__":
    print("   calendar   year (days)    month (days)   year drift  month"
          " drift")
    print("   " + " " * 41 + "(d/century) (d/century)")
    for name, y, m in CAL:
        dy = (float(y) - YEAR) * 100
        dm = (float(m) - MONTH) * 100 * 12.368
        print("   {:<9}  {:11.6f}    {:11.7f}     {:+7.3f}     {:+7.3f}"
              .format(name, float(y), float(m), dy, dm))
    print("\n   19 years versus 235 months, modern values: {:+.4f} days"
          .format(235 * MONTH - 19 * YEAR))
    s_y, s_m = CAL[0][1], CAL[0][2]
    print("   Santong: 235 months - 19 years = {} days exactly".format(
        235 * s_m - 19 * s_y))
    print("   Santong drift from 104 BCE to 85 CE (188 years): {:+.2f}"
          " days".format((float(s_y) - YEAR) * 188))
    print("\nReading: the Han Santong year is long by about 0.8 days a")
    print("century, so its solstices fell visibly late within two")
    print("centuries; the Dayan constants are good to about a fifth of a")
    print("day a century, and the Shoushi year to a thirtieth. Built into")
    print("Santong's fractions, 235 months equal 19 years exactly - the")
    print("cycle is a definition there, not an approximation.")
#    calendar   year (days)    month (days)   year drift  month drift
#                                             (d/century) (d/century)
#    Santong     365.250162     29.5308642      +0.797      +0.340
#    Sifen       365.250000     29.5308511      +0.781      +0.324
#    Dayan       365.244408     29.5305921      +0.222      +0.004
#    Shoushi     365.242500     29.5305930      +0.031      +0.005
#
#    19 years versus 235 months, modern values: +0.0868 days
#    Santong: 235 months - 19 years = 0 days exactly
#    Santong drift from 104 BCE to 85 CE (188 years): +1.50 days
#
# Reading: the Han Santong year is long by about 0.8 days a
# century, so its solstices fell visibly late within two
# centuries; the Dayan constants are good to about a fifth of a
# day a century, and the Shoushi year to a thirtieth. Built into
# Santong's fractions, 235 months equal 19 years exactly - the
# cycle is a definition there, not an approximation.

Calendars write the tropical year and the synodic month as fractions. The Han Santong calendar took a year of 3653851539365\frac{385}{1539} days and a month of 29438129\frac{43}{81} days; its year is 0.797 days a century longer than the modern mean, so over the 188 years from the Taichu reform (104 BCE) to the Sifen calendar (85 CE) the solstice would have drifted about 1.50 days late. The Tang Dayan calendar’s year of 365.244408 days is long by only 0.222 days a century, and its month is almost exact (0.004 days a century). The Yuan Shoushi calendar’s year of 365.2425 days is long by just 0.031 days a century.

The Santong fractions have a structural feature too: with its year and month, 235 months equal 19 years exactly, a difference of 0. With modern values they differ by 0.0868 days. That is, the nineteen-year cycle with seven intercalary months is a definition in the Santong calendar, not an approximation; the approximation error is pushed into the year and month themselves.

Note

Sources and checking. The constants of the Santong, Sifen, Dayan and Shoushi calendars are the standard values in the history-of-science literature (Cullen 2017; 陈美东 2003; Sivin 2009); the modern mean tropical year and synodic month are values for around 2000 CE. Both change slowly over time, so the drifts here are first-order comparisons only. The Dayan year and month use the common denominator 3040, and their numerators (1110343 for the year, 89773 for the month) agree with the calendar treatise of the Xin Tangshu.

Hypothesis · not established

The author’s hypothesis (not yet tested): the improvement of calendar constants over the dynasties came mainly from longer observational baselines rather than finer fractions: plotted against the span of observations each was based on, the error of each calendar’s year falls roughly in inverse proportion to the span. What would show it wrong: the error is unrelated to the observational span, or is driven mainly by the size of the denominator.

Summary

Mean terms from an equal division of the year and true terms from the Sun’s true longitude differ by up to 2.386 days, and true-term intervals range from 14.720 to 15.729 days. Between terms, either quadratic scheme locates the Sun about seven times better than the even-motion assumption; with true terms as nodes the spacing is unequal and Yixing’s unequal-interval formula is required. The Santong year is long by 0.797 days a century, the Dayan by 0.222 and the Shoushi by 0.031; the Santong fractions make 235 months exactly 19 years.

References

Cullen, Christopher. 2017. The Foundations of Celestial Reckoning: Three Ancient Chinese Astronomical Systems. Routledge.
Needham, Joseph, and Ling Wang. 1959. Science and Civilisation in China, Volume 3: Mathematics and the Sciences of the Heavens and the Earth. Cambridge University Press.
Sivin, Nathan. 2009. Granting the Seasons: The Chinese Astronomical Reform of 1280. Springer.
陈美东. 2003. 中国科学技术史·天文学卷. 科学出版社.

Fan, Y. (2026). Five-Node Cyclic Network Dynamics, Solar-Longitude Ephemeris and Multi-Scale Oscillator Perturbations: Rock-Paper-Scissors-Lizard-Spock Lotka-Volterra Graphs, Equation-of-Time Keplerian Mechanics and Jacobian Sensitivity Bounds [五节点循环网络动力学、黄经历表与多尺度振子扰动] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090168 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).