Skip to content

Accuracy Validation Report

Independent verification of stem-branch's astronomical computations against three reference sources. This report quantifies residual errors, identifies their physical origins, and establishes the validated operating envelope.

Abstract

We validate stem-branch's astronomical engine — built on VSOP87D analytical theory (2,425 terms) with DE441-fitted polynomial corrections and IAU2000B nutation — against three independent references: JPL Horizons DE441 (primary reference), the Swiss Ephemeris Moshier analytical ephemeris, and sxwnl (寿星万年历, an independent VSOP87D implementation with DE405 corrections).

Five quantities are tested:

QuantityValidated rangeReference(s)Key result
Equation of Time2024 (366 days)JPL DE441Mean 0.012 s, max 0.03 s
Solar term timing209–2493 CE (1,008 terms)JPL DE441, sxwnlMean 1.05 s, max 3.05 s
Extended range−2000 to +5000 CE (10,392 terms)Correction polynomial analysis0 failures; SB ≤ SX for 98.9% of timeline
Four Pillars (四柱)1900–2100 (2,412 dates)sxwnl100% agreement
Planetary longitude1900–2100 (808 epochs)JPL DE441, Swiss Eph.1–14″ mean (VSOP87D planets)
Lunar phase timing2000–2024 (594 phases)JPL DE441Mean 3.6″ elongation error

All comparisons use geocentric apparent coordinates in the ecliptic of date, with no atmospheric refraction applied.


1. Reference Sources and Coordinate Systems

1.1 Sources

SourceMethodEphemerisRole
stem-branchVSOP87D (2,425-term) + DE441 correction + IAU2000B nutationAnalytical theorySubject under test
sxwnl (寿星万年历)VSOP87D (custom truncation) + Chapront ELP/MPP02Analytical theoryCross-validation
Swiss EphemerisMoshier analytical ephemeris (built-in, no external files)Analytical theoryIndependent reference
JPL HorizonsDE441 numerical integrationNumerical integrationPrimary reference

1.2 Coordinate system

All ecliptic longitudes and latitudes are geocentric apparent coordinates in the ecliptic of date (dynamical ecliptic, not the J2000 ecliptic). This means:

  • Heliocentric → geocentric conversion via light-time iteration and annual aberration
  • Nutation applied (IAU2000B 77-term series for stem-branch; full model for JPL)
  • No atmospheric refraction (APPARENT='AIRLESS' for JPL queries)

Right ascension and declination (used for EoT computation) are in the true equator of date (nutation included).

1.3 Reference accuracy

JPL DE441 is a full numerical integration of the solar system fitted to modern observational data (radar ranging, VLBI, spacecraft tracking). For the Sun's geocentric ecliptic longitude over the validated range (209–2493 CE), DE441's intrinsic error is sub-milliarcsecond for modern dates and below 1″ even for ancient dates. All reported residuals are dominated by stem-branch's analytical approximation error, not by DE441 uncertainty.

The Swiss Ephemeris (Moshier analytical ephemeris) agrees with JPL to 0.12–0.95″ mean across all eight planets (§5.1), confirming it as a reliable independent cross-check and ruling out systematic errors in the coordinate conversion pipeline.

1.4 Timescales

  • TT (Terrestrial Time): the uniform timescale used internally by all ephemeris computations (VSOP87D, DE441, ELP/MPP02).
  • UT (Universal Time): the civil timescale. JavaScript Date objects use UTC ≈ UT. All times returned by stem-branch are in UT.
  • ΔT = TT − UT: stem-branch uses Espenak & Meeus polynomials (pre-2016), sxwnl cubic table (2016–2050), and parabolic extrapolation (2050+). For mid-2024, ΔT ≈ 69.1 s. For ancient dates (pre-1000 CE), ΔT uncertainty is on the order of minutes to hours — far exceeding any ephemeris error (see §7.2).

2. Equation of Time

The Equation of Time (EoT) is the difference between apparent solar time and mean solar time: positive when the sundial runs ahead of the clock.

Method: stem-branch computes EoT via Meeus Ch. 28:

EoT = α_app − L₀ + 0.0057183°     (then × 4 min/°)

where α_app is the Sun's apparent right ascension (VSOP87D ecliptic longitude → IAU2000B nutation → true obliquity → RA) and L₀ is the geometric mean Sun longitude. JPL reference values are derived from DE441 apparent RA using the same L₀ polynomial; the comparison therefore isolates the difference in apparent RA computation (VSOP87D analytical theory vs DE441 numerical integration).

2.1 Residual statistics (2024, 366 daily samples at 12:00 TT)

StatisticValue
Mean bias (stem-branch − JPL)+0.0000 min
Mean |residual|0.0002 min (0.012 s)
Standard deviation0.0003 min (0.018 s)
Max |residual|0.0005 min (0.03 s)
P500.0002 min
P950.0005 min
P990.0005 min

The near-zero mean bias indicates no systematic offset between the VSOP87D analytical theory and DE441 numerical integration for the Sun's apparent right ascension. The 0.03-second maximum residual represents a ~1,000× improvement over the Spencer (1971) Fourier approximation (~30 s accuracy) previously used in this library.

2.2 Monthly profile

DateJPL EoT (min)stem-branch (min)Δ (min)
Jan 15+9.220+9.220< 0.001
Feb 15+14.109+14.109< 0.001
Mar 15+8.753+8.753< 0.001
Apr 15−0.095−0.095< 0.001
May 15−3.641−3.641< 0.001
Jun 15+0.616+0.616< 0.001
Jul 15+6.058+6.058< 0.001
Aug 15+4.395+4.395< 0.001
Sep 15−4.978−4.978< 0.001
Oct 15−14.350−14.350< 0.001
Nov 15−15.348−15.3470.001
Dec 15−4.660−4.660< 0.001

At the display resolution of 0.001 min (0.06 s), the two sources are indistinguishable for 11 of 12 months. November's 0.001-minute offset corresponds to 0.06 s — consistent with the overall max residual of 0.03 s when accounting for rounding.

2.3 Annual EoT curve

The two curves are visually indistinguishable at monthly resolution — the maximum separation (November) is 0.001 minutes, invisible at this scale. The characteristic double-hump shape reflects the combined effects of Earth's orbital eccentricity and axial obliquity.


3. Solar Term Timing (節氣)

Solar terms are astronomically defined: each of the 24 terms corresponds to the Sun's geocentric apparent ecliptic longitude reaching a specific multiple of 15°. Timing accuracy therefore depends directly on the precision of the ecliptic longitude computation and the root-finding algorithm.

stem-branch uses Newton-Raphson iteration on the VSOP87D solar longitude function (with DE441 polynomial correction) to solve for the exact UT moment of each crossing.

3.1 Wide-range comparison: 209–2493 CE (42 years, 1,008 terms)

42 years sampled across 2,284 years, with all 24 solar terms per year:

  • 12 systematic years at 20-year intervals (1900–2100)
  • 30 pseudo-randomly selected years from 200–2800 CE (seed = 42)

JPL crossing moments are interpolated from ecliptic longitude time series (DE441; hourly resolution for 1900–2100, 3-hour for all other years). JPL TT timestamps are converted to UT via deltaT(). Pre-1582 JPL dates are converted from Julian to proleptic Gregorian calendar.

YearNSB−JPL meanSB−JPL maxSX−JPL meanSX−JPL max
209241.2 s2.9 s
270241.2 s2.3 s
281241.1 s2.5 s
333241.1 s2.5 s
360241.2 s2.5 s
654240.8 s2.1 s
682241.1 s2.2 s
712240.9 s2.3 s
849241.4 s3.0 s
894241.0 s2.6 s
910241.2 s2.6 s
998241.1 s2.4 s
1365240.3 s0.7 s
1424240.3 s0.6 s
1428240.3 s0.7 s
1501240.2 s0.6 s
1569240.2 s0.8 s
1578240.3 s0.8 s
1740241.0 s1.5 s
1762240.9 s1.8 s
1787240.9 s1.5 s
1824241.1 s1.8 s
1900241.6 s2.1 s5.9 s7.2 s
1920241.7 s2.2 s4.4 s5.7 s
1940241.8 s2.3 s2.8 s3.4 s
1941242.0 s2.8 s3.0 s3.9 s
1960242.1 s2.8 s1.2 s2.3 s
1980240.9 s1.5 s1.7 s2.4 s
1985240.7 s1.1 s1.1 s2.1 s
2000240.5 s0.9 s1.0 s2.0 s
2020241.8 s2.3 s1.1 s2.5 s
2024242.0 s2.4 s1.1 s2.3 s
2040241.7 s2.1 s0.4 s1.0 s
2060241.8 s2.3 s1.7 s3.6 s
2080241.6 s2.1 s3.2 s4.1 s
2100241.6 s2.2 s4.9 s6.6 s
2138241.4 s2.1 s
2237240.9 s1.3 s
2377240.2 s0.8 s
2416240.2 s0.6 s
2450240.3 s0.8 s
2493240.2 s0.6 s

SB = stem-branch, SX = sxwnl. sxwnl reference data covers 1900–2100 only; outside that window, validation is stem-branch vs JPL exclusively. stem-branch uses a DE441-fitted even polynomial correction (§3.3); sxwnl uses an older DE405-fitted cubic.

3.2 Aggregate statistics

Modern epoch (1900–2100):

ComparisonNMean |Δ|Max |Δ|P50P95P99
stem-branch vs JPL3361.56 s2.79 s1.68 s2.29 s2.50 s
sxwnl vs JPL3352.38 s7.18 s1.85 s5.71 s6.78 s

Within sxwnl's own 1900–2100 range, stem-branch is closer to JPL on every metric: 1.5× lower mean, 2.6× lower maximum, 2.5× better P95.

Percentile ladder: stem-branch vs sxwnl (against JPL, 1900–2100)

stem-branch (bars) remains bounded below 3 seconds at all percentiles. sxwnl (line) tracks comparably at P50 but diverges sharply in the tail: its P95 is 2.5× higher (5.71 s vs 2.29 s), indicating that its DE405 cubic correction produces occasional large outliers that stem-branch's DE441 even-polynomial avoids.

Full validated range (209–2493 CE):

ComparisonNMean |Δ|Max |Δ|P50P95P99
stem-branch vs JPL1,0081.05 s3.05 s0.97 s2.22 s2.60 s

The full-range mean (1.05 s) is lower than the modern-epoch mean (1.56 s) because the correction polynomial has its minimum residual near ~1400 CE and ~2400 CE, where deviations fall below 0.3 s.

Divergence profile: stem-branch vs sxwnl over time

The contrast is clear: stem-branch (bars) stays in a narrow band of 0.5–2.1 s across the entire epoch, while sxwnl (line) traces a U-shaped curve — accurate near its fitting epoch (~2040) but diverging to 5.9 s at 1900 and 4.9 s at 2100. This asymmetric growth is the signature of the odd-order terms (τ, τ³) in sxwnl's DE405 cubic correction; stem-branch's even-only polynomial (τ², τ⁴, τ⁶) is immune to this by construction.

3.3 Error profile and the DE441 correction polynomial

stem-branch applies an even-polynomial correction to VSOP87D's solar longitude, fitted to DE441 via least-squares over the 1,008 solar-term crossings:

ΔL = c₀ + c₂τ² + c₄τ⁴ + c₆τ⁶   (arcseconds, τ = Julian millennia from J2000)

The restriction to even powers of τ enforces symmetry: the correction produces comparable accuracy for past and future dates. This replaced an earlier DE405-fitted cubic correction (from sxwnl) whose odd-order terms introduced asymmetric error growth — 58-second deviations for 3rd-century dates while remaining well-calibrated near the modern epoch.

Accuracy tiers:

PeriodMean deviationMax deviationContext
1365–2493 CE< 2.1 s< 2.8 sWithin the correction's sweet spot
209–2493 CE (full)1.05 s3.05 sEntire validated range

For calendar applications, where solar term boundaries determine lunisolar month placement and the nearest boundary transition is rarely closer than several hours, a 3-second worst case provides a safety margin exceeding 1,000×.

3.4 Worst 10 terms (stem-branch vs JPL, full range)

RankYearSolar TermΔ (s)
1849白露+3.0
2209寒露+2.9
31941立秋+2.8
41960立秋+2.8
5209立冬+2.7
6209小雪+2.7
7849寒露+2.6
8894霜降+2.6
9209霜降+2.6
10910秋分+2.6

The worst cases are distributed across the full range (209–1960 CE) with no concentration in any single era, confirming that the even-polynomial correction distributes residuals uniformly. The consistently positive sign (stem-branch slightly late) is consistent with VSOP87D's series truncation slightly underestimating the Sun's ecliptic longitude velocity.

3.5 Sampling methodology

30 years were drawn from 200–2800 CE using a seeded PRNG (seed = 42) for reproducibility. Combined with 12 systematic years at 20-year intervals (1900–2100), this yields 42 sample years covering 2,284 years.

Coverage statistics:

  • Total terms compared: 1,008 (42 × 24)
  • Temporal span: 209–2493 CE (2,284 years)
  • Mean gap between sampled years: 54 years
  • Longest gap: 294 years (360–654 CE)
  • Shortest gap: 2 years (1940–1941)
  • Pre-1900 coverage: 22 years (stem-branch vs JPL only)
  • Post-2100 coverage: 6 years (stem-branch vs JPL only)

The error profile's near-uniformity across all 42 years (§3.3) confirms that the sampling is representative and that no discontinuities or outliers appear at unsampled epochs.

3.6 Cross-validation: stem-branch vs sxwnl (4,824 terms, 1900–2100)

The two VSOP87D implementations are cross-validated via the automated test suite (tests/cross-validation.test.ts), covering all 24 terms × 201 years. The divergence reflects the different correction polynomials (DE441 vs DE405), not implementation errors — both are validated independently against JPL.

StatisticValue
Terms compared4,824
Mean deviation3.4 s
Max deviation9.3 s
P503.4 s
P956.8 s
P997.6 s
Within 1 min4,824/4,824 (100.0%)

3.7 Cross-validation deviation distribution

54.3% within 0.5 s; 84.8% within 1 s; 4 terms (0.08%) exceed 2.5 s.

3.8 Cumulative distribution function

The steep initial rise confirms that the bulk of the distribution is concentrated below 1 second. The curve reaches 95% at 1.5 s and 99% at 2.0 s, with only 4 terms (0.08%) in the extreme tail beyond 2.5 s. This well-behaved distribution — no heavy tail, no secondary mode — is consistent with a single smooth systematic divergence (the DE441/DE405 correction gap) rather than implementation errors or data anomalies.

3.9 Deviation by solar term

Two peaks near the equinoxes (春分/清明 and 秋分/寒露), two valleys near the solstices (夏至/小暑 and 冬至/小寒). This pattern is expected: the Sun's ecliptic longitude changes fastest near the equinoxes (~1.02°/day), so a given longitude offset produces a larger timing difference than near the solstices (~0.95°/day), where the Sun's ecliptic motion is slower.

3.10 Multi-source summary

3.11 Extended range computation: −2000 to +5000 CE (10,392 terms)

To characterize stem-branch's behavior far beyond the JPL-validated window (209–2493 CE), all 24 solar terms were computed for 433 years spanning 7,000 years of human history, with multi-resolution sampling:

Sampling tierRangeStepYears
Ultra-dense1800–2200 CE5 years81
Dense1000–3000 CE10 years201
Medium−500 to 4500 CE25 years201
Sparse−2000 to 5000 CE50 years141

Total (deduplicated): 433 unique years × 24 terms = 10,392 solar terms.

ResultValue
Years computed433/433 (100%)
Total terms10,392
Computation failures0
Chronological order violations0
Spacing anomalies (gap < 10 d or > 20 d)0

Every term was computed successfully with correct chronological ordering and physically reasonable inter-term spacing, confirming numerical stability of the Newton-Raphson solver and VSOP87D evaluation across the full ±3,000-year neighborhood of J2000. The zero-failure result holds even at −2000 CE (τ = −4), where VSOP87D series convergence is weakest.

3.12 Era breakdown: predicted accuracy by correction magnitude

Outside the JPL-validated window (209–2493 CE), accuracy is characterized by the magnitude of each system's correction polynomial — the systematic offset between raw VSOP87D and the reference ephemeris that the polynomial removes. Smaller |ΔL| means less correction is needed and the polynomial's extrapolation is more reliable. For comparison, sxwnl's DE405 correction magnitude |ΔL_SX| is shown alongside stem-branch's DE441 correction |ΔL_SB|.

EraYearsTerms|ΔL_SB| range (″)|ΔL_SX| range (″)SX/SB
Deep past (−2000 to −500)307204.61–135.310.01–1.480.1×
Classical (−500 to 500)409600.46–3.921.52–1.952.4×
Medieval (500–1500)801,9200.25–0.491.07–1.943.9×
Early modern (1500–1800)368640.13–0.240.46–1.054.2×
sxwnl validated (1800–2200)811,9440.11–0.130.00–0.672.4×
Near future (2200–3000)962,3040.13–0.460.70–4.047.4×
Far future (3000–5000)701,6800.46–16.784.18–20.9910.8×

The SX/SB ratio reveals the pattern: outside the narrow 1800–2200 validated window, sxwnl's correction magnitude grows 2× to 11× faster than stem-branch's. In the far future (3000–5000 CE), sxwnl's |ΔL| reaches 21″ while stem-branch stays below 17″ — and stem-branch's even-polynomial ensures symmetric behavior into the past.

Note on the deep past (−2000 to −500 CE): sxwnl's |ΔL| is nominally smaller in this era (0.01–1.48″ vs 4.61–135.31″), but this is misleading. The odd-order terms in sxwnl's DE405 cubic (τ, τ³) happen to pass through zero near τ ≈ −2 (roughly 0 CE), producing small corrections for negative τ by coincidence rather than by calibration. These terms were fitted to DE405 over a modern epoch; their behavior 3,000+ years in the past is mathematical extrapolation, not validated prediction. In any case, sxwnl does not claim validity for this era.

3.13 Century milestones (−2000 to +5000 CE)

Year24 terms|ΔL_SB| (″)|ΔL_SX| (″)SX/SB冬至 (Winter Solstice)
−2000all135.3080.2480.0×−2000-12-19 16:22 UT
−1500all52.8160.3950.0×−1500-12-20 04:59 UT
−1000all16.7851.0100.1×−1000-12-20 17:29 UT
−500all3.9221.5220.4×−500-12-21 06:06 UT
0all0.7461.8572.5×0-12-22 06:42 UT
500all0.4701.9394.1×500-12-21 06:26 UT
1000all0.4581.6953.7×1000-12-21 17:54 UT
1500all0.2421.0494.3×1500-12-22 04:18 UT
2000all0.1070.0730.7×2000-12-21 13:37 UT
2500all0.2421.7467.2×2500-12-21 21:39 UT
3000all0.4584.0458.8×3000-12-22 04:06 UT
3500all0.4707.04415.0×3500-12-22 09:30 UT
4000all0.74610.81814.5×4000-12-21 13:27 UT
4500all3.92215.4413.9×4500-12-21 15:43 UT
5000all16.78520.9901.3×5000-12-21 16:14 UT

The symmetry of stem-branch's correction is visible in the data: |ΔL_SB| at −1000 CE and +5000 CE is identical (16.785″) because both are exactly τ = ±3.0 Julian millennia from J2000, and the even polynomial (c₂τ² + c₄τ⁴ + c₆τ⁶) is invariant under τ → −τ.

3.14 Correction polynomial divergence: −1000 to +5000 CE

Two fundamentally different correction architectures are visible:

  • stem-branch (bars): symmetric U-shape centered on J2000, reaching ~17″ at ±3,000 years. The even-polynomial design (τ², τ⁴, τ⁶) mathematically guarantees this symmetry — the same correction magnitude applies whether looking 1,000 years into the past or 1,000 years into the future.

  • sxwnl (line): monotonically increasing into the future, with no corresponding growth into the past. The odd-order terms (τ, τ³) create an asymmetric correction that happens to be small for negative τ (past dates) but grows without bound for positive τ (future dates).

At +5000 CE, sxwnl's correction is 21″ — 25% larger than stem-branch's 16.8″. More critically, sxwnl's linear growth rate means the gap widens indefinitely, while stem-branch's quartic and sextic terms grow far more slowly in the ±3,000-year neighborhood of J2000.

3.15 Sweet spot: 0 to 4000 CE

Within the 4,000-year sweet spot (0–4000 CE), stem-branch's correction stays below 0.75″ — flatter than a shallow bowl. The mirror symmetry around J2000 is exact: 0.47″ at 500 CE and 0.47″ at 3500 CE; 0.24″ at 1500 CE and 0.24″ at 2500 CE.

sxwnl starts at nearly 2″ in antiquity, dips through its minimum near 2000 CE, then climbs to 10.8″ by 4000 CE. By the year 3000, sxwnl's correction is 9× larger than stem-branch's (4.04″ vs 0.46″).

3.16 Crossover analysis: the 80-year window

Zooming into the modern epoch reveals the only window where sxwnl's correction is smaller: 1933–2012 CE — a span of 80 years out of 7,000. This is the narrow interval where sxwnl's V-shaped minimum (near ~1970 CE, at the deepest point of its DE405 fitting epoch) dips below stem-branch's nearly flat plateau of ~0.107″.

MetricValue
sxwnl correction < stem-branch1933–2012 CE (80 years)
Out of 7,000-year range1.1% of the timeline
stem-branch equal or better98.9% of the timeline

Even within sxwnl's best window, the advantage is marginal: 0.018″ vs 0.107″ at the deepest point near 1980 CE — a difference of 0.089″, corresponding to approximately 0.006 seconds of solar term timing. Outside this window, stem-branch's advantage compounds rapidly: by 2100 CE, sxwnl's correction is already 3.2× larger (0.361″ vs 0.113″).

3.17 Data source validity and coverage

SourceComputed rangeJPL-validatedSweet spotKey design
JPL DE441−13,200 → +17,191(is the reference)N/ANumerical integration
Swiss Ephemeris−13,200 → +17,1911900–2100 (tested)N/AMoshier analytical
stem-branch−2,000 → +5,000209–2,4930–4,000 (|ΔL| < 0.5″)DE441 even polynomial (τ², τ⁴, τ⁶)
sxwnl1,800–2,2001,900–2,1001,933–2,012 (|ΔL| < SB)DE405 cubic (τ, τ², τ³)

The key architectural difference: stem-branch's even polynomial was designed for temporal symmetry; sxwnl's odd-order cubic was designed for modern-epoch precision. Each achieves its design goal — but for applications spanning centuries to millennia, the symmetric design provides uniformly bounded errors across the full range of Chinese calendrical history (roughly 0–4000 CE).


4. Four Pillars (四柱)

Pillar assignment depends on solar term boundaries: 立春 determines the year pillar, and the 12 節 (jiē) terms determine monthly pillars. The solar term validation in §3 confirms the underlying astronomy to within ~2 s for the modern epoch — far below the margin needed to affect pillar assignment.

4.1 Day pillar (日柱)

StatisticValue
Dates tested5,683 (1583–2500 CE)
stem-branch vs sxwnl5,683/5,683 (100.00%)

The day pillar is purely arithmetic (epoch + day count mod 60) and does not depend on any ephemeris computation. Perfect agreement is the expected result.

4.2 Year pillar (年柱)

StatisticValue
Dates tested2,412 (1900–2100 CE)
stem-branch vs sxwnl2,412/2,412 (100.00%)

4.3 Month pillar (月柱)

StatisticValue
Dates tested2,412 (1900–2100 CE)
stem-branch vs sxwnl2,412/2,412 (100.00%)

100% agreement across 2,412 test dates confirms that the sub-second solar term deviations documented in §3 never shift a boundary across midnight. The closest any solar term falls to a midnight boundary within 1900–2100 is several hours, providing a safety margin exceeding 3,600× over the worst-case 2.79-second deviation.


5. Planetary Positions

Geocentric apparent ecliptic longitudes and latitudes for all eight VSOP87D planets (Mercury through Neptune) plus Pluto, validated at 101 epochs per planet (730-day step, 1900–2100 CE).

Method: stem-branch computes heliocentric ecliptic coordinates via VSOP87D (2,425 terms per planet), converts to geocentric via light-time iteration and annual aberration, and applies DE441-fitted even-polynomial corrections (c₀ + c₂τ² + c₄τ⁴ + c₆τ⁶) per planet. Pluto uses the Meeus Ch. 37 algorithm (43 periodic terms, valid 1885–2099).

5.1 Ecliptic longitude residuals (arcseconds)

PlanetSB vs JPL meanSB vs JPL maxSwE vs JPL meanSwE vs JPL maxSB vs SwE mean
Mercury1.16″6.38″0.25″1.27″1.06″
Venus2.29″6.35″0.25″1.11″2.25″
Mars11.09″29.18″0.17″0.62″11.03″
Jupiter13.03″23.28″0.15″0.45″13.02″
Saturn13.22″22.51″0.22″0.82″13.18″
Uranus13.55″22.82″0.12″0.39″13.49″
Neptune12.76″22.58″0.63″2.15″12.52″
Pluto2569″5178″0.95″3.55″2569″

The close agreement between Swiss Ephemeris and JPL (0.12–0.95″ mean for all planets) confirms that JPL is a reliable primary reference and that the coordinate conversion pipeline (equatorial ↔ ecliptic, geocentric correction) introduces no systematic error. The SB-vs-SwE residuals closely track SB-vs-JPL residuals (within ±1″), as expected when both references agree to sub-arcsecond precision.

Mean residual by planet (VSOP87D planets only, excluding Pluto)

Two distinct accuracy tiers are visible: inner planets (Mercury, Venus) cluster at 1–2″, while outer planets (Mars–Neptune) plateau at 11–14″. The Swiss Ephemeris line (Moshier analytical ephemeris) hugs zero across all planets, confirming that JPL serves as a reliable primary reference. The step function between Venus and Mars reflects the VSOP87D series' faster convergence for inner planets, where fewer terms are needed to model the shorter-period perturbations.

5.2 Accuracy tiers

TierPlanetsMean |Δλ|Max |Δλ|Dominant error source
HighMercury, Venus1–2″< 7″VSOP87D truncation (well-converged for inner planets)
ModerateMars–Neptune11–14″23–29″VSOP87D truncation at outer-planet distances; polynomial correction captures secular trend but not short-period oscillations
LowPluto~2569″ (~0.71°)~5178″ (~1.44°)Meeus Ch. 37: 43 periodic terms designed for visual identification, not precision astrometry

Inner planets (Mercury, Venus) achieve sub-10″ accuracy. The VSOP87D series converges rapidly for inner planets, and the DE441 polynomial correction effectively removes the residual secular trend.

Outer planets (Mars–Neptune) are limited by VSOP87D series truncation at larger heliocentric distances. The DE441 correction captures the smooth long-period error component but cannot model short-period oscillations with amplitudes of ~10–15″. For the Seven Governors (七政四餘) sidereal astrology application, where mansion boundaries span 5–33° of arc, these residuals are negligible.

Pluto uses the Meeus Ch. 37 algorithm, a simplified periodic series designed to reproduce Pluto's position to ~0.1° for visual identification at the eyepiece. The ~0.71° mean error and ~1.44° maximum are consistent with the algorithm's documented limitations and its restricted validity range (1885–2099). For applications requiring sub-arcminute Pluto positions, a numerical ephemeris (DE441 or equivalent) should be used directly.

Latitude accuracy is uniformly ~4–10″ for all VSOP87D planets (better than longitude) because latitude perturbation terms converge faster in the VSOP87 series expansion.

5.3 Test thresholds

typescript
// Planet validation thresholds (arcseconds, ~50% margin over observed)
mercury: { meanMax: 3,    absMax: 10 }
venus:   { meanMax: 5,    absMax: 10 }
mars:    { meanMax: 16,   absMax: 40 }
jupiter: { meanMax: 18,   absMax: 30 }
saturn:  { meanMax: 18,   absMax: 30 }
uranus:  { meanMax: 18,   absMax: 30 }
neptune: { meanMax: 18,   absMax: 30 }
pluto:   { meanMax: 3500, absMax: 7000 }

6. Lunar Phase Timing

Lunar phase timing validates the Moon ephemeris (ELP/MPP02) by measuring the Sun-Moon ecliptic longitude elongation at JPL-derived new and full moon moments. At a correctly computed new moon, the elongation should be exactly 0°; at a full moon, exactly 180°. The residual elongation at each reference phase time quantifies the combined error of the lunar and solar longitude computations.

Method: JPL Horizons Moon (body 301) and Sun (body 10) apparent RA/Dec are queried at 6-hour intervals (2000–2024), converted to ecliptic longitude via the obliquity of date, and phase crossing times are interpolated from the elongation curve. At each JPL-derived phase time, stem-branch independently computes the Sun-Moon elongation; the deviation from the expected value (0° or 180°) is recorded.

6.1 Results (594 phases, 2000–2024)

PhaseNMean |Δ|σMax |Δ|P50P95P99
New moon2970.0010° (3.6″)0.0007°0.0027° (9.7″)0.0009°0.0021°0.0023°
Full moon2970.0010° (3.6″)0.0006°0.0025° (9.0″)0.0009°0.0021°0.0024°

6.2 Interpretation

The mean elongation error of 0.001° (3.6″) at both new and full moons indicates that stem-branch's combined Sun + Moon ecliptic longitude computation is accurate to approximately 4 arcseconds over the 2000–2024 interval. Since the solar longitude is independently validated to ~2″ accuracy against JPL (§2), the residual implies a lunar longitude error of comparable magnitude (~2–4″), consistent with the ELP/MPP02 theory's expected performance.

At the Moon's mean elongation rate of ~12.2°/day, a 0.001° elongation error corresponds to approximately 7 seconds of time. For Chinese calendar applications, where the relevant time unit is the 時辰 (shíchén, ~2 hours), this provides a safety margin exceeding 1,000×.

The maximum elongation error of 0.0027° (9.7″) is well below the 1° test threshold in the automated suite. The 1° threshold was set conservatively to accommodate the 6-hour interpolation granularity of the JPL reference data; the actual performance exceeds this threshold by a factor of ~370×.

Note on reference data granularity: the JPL phase crossing times are interpolated linearly between 6-hour data points, introducing an interpolation uncertainty of order minutes in the crossing time. However, the elongation residual measured at that interpolated time reflects the true accuracy of stem-branch's ephemeris — if the ephemeris were inaccurate, the elongation at the reference time would deviate measurably from 0° or 180° regardless of the crossing time's precision.


7. Error Budget and Limitations

7.1 Error sources by magnitude

SourceMagnitudeAffectsCharacter
VSOP87D series truncation1–14″ (planets), ~1 s (solar terms)All ecliptic longitudesSystematic: smooth, predictable trend removed by polynomial correction; short-period residual (~10–15″ for outer planets)
DE441 correction residual~1 s (solar terms), ~10″ (outer planets)Corrected quantitiesQuasi-random: short-period oscillations not captured by the smooth polynomial
IAU2000B vs IAU2000A nutation< 1 masAll coordinatesSystematic: negligible for all applications
ΔT model uncertainty< 0.1 s (modern), minutes–hours (pre-1000 CE)UT timestamps onlySystematic: grows monotonically with distance from modern epoch
ELP/MPP02 truncation~2–4″Moon longitudeMixed: truncation (systematic) + perturbation modeling (quasi-random)
Meeus Ch. 37 limitations~0.71° meanPluto onlySystematic: inherent limitation of 43-term periodic series
JPL reference interpolation~minutes (crossing time)Phase fixture timestampsRandom: linear interpolation between 6-hour or hourly data points

Error budget breakdown (modern epoch, approximate)

For modern dates (1900–2100), VSOP87D series truncation and the residual after DE441 polynomial correction together account for roughly two-thirds of the total error budget. For ancient dates (pre-1000 CE), the ΔT slice would dominate the pie entirely — but this reflects our limited knowledge of historical Earth rotation, not any deficiency in the ephemeris computation.

7.2 What this validation does not cover

  1. Dates outside 209–2493 CE: VSOP87D's validity is formally ±4,000 years from J2000, and the DE441 correction polynomial was fitted over the 209–2493 range. Extended range computation (§3.11) confirms successful computation of all 24 solar terms across −2000 to +5000 CE (10,392 terms, zero failures), but direct JPL comparison is available only for 209–2493. Outside this window, the correction polynomial magnitude (§3.12) provides an accuracy proxy: |ΔL| < 0.5″ for 0–4000 CE, growing to ~17″ at ±3,000 years from J2000.

  2. ΔT for ancient dates: for dates before ~1000 CE, ΔT uncertainty (minutes to hours) dominates all other error sources. The sub-second ephemeris accuracy documented here applies to the TT timescale; conversion to UT for ancient events is limited by our knowledge of historical Earth rotation, not by ephemeris precision.

  3. Topocentric corrections: all computations are geocentric. Topocentric parallax (significant for the Moon at ~1°, negligible for the Sun and planets) is not applied.

  4. Atmospheric refraction: not modeled. All comparisons use airless apparent coordinates.

  5. Gravitational light deflection: light-time correction and annual aberration are included; gravitational deflection near the Sun (up to ~1.75″ at the limb) is not. This affects positions within ~1° of the Sun.

  6. Pluto beyond 2099: Meeus Ch. 37 is valid only for 1885–2099. Outside this range, Pluto positions are unreliable.

  7. Non-VSOP87D bodies: the Four Remainders (四餘) of the Seven Governors system — Rahu (羅睺), Ketu (計都), Purple Qi (紫氣), and Yuebei (月孛) — use mean orbital element models, not precision ephemerides. Their accuracy is documented separately in docs/seven-governors.md.


8. Methodology

8.1 Computational pipeline

stem-branch computes from first principles:

  • VSOP87D (2,425 terms) for heliocentric ecliptic longitude in the ecliptic of date
  • DE441-fitted even polynomial correction (4 coefficients: c₀, c₂τ², c₄τ⁴, c₆τ⁶) to compensate for VSOP87D series truncation
  • IAU2000B nutation (77-term lunisolar series) for true ecliptic coordinates
  • ELP/MPP02 for lunar ecliptic longitude and latitude
  • ΔT from Espenak & Meeus (pre-2016), sxwnl cubic table (2016–2050), parabolic extrapolation (2050+)
  • Newton-Raphson root-finding for solar term crossing moments

sxwnl uses its own VSOP87D implementation with corrections fitted to DE405. Reference fixtures were generated by running sxwnl's algorithms and recording UTC timestamps for all 24 solar terms across 1900–2100.

Swiss Ephemeris (Moshier variant) is a standalone analytical ephemeris that requires no external data files. It serves as an independent cross-check on both the coordinate conversion pipeline and the planetary position accuracy.

JPL Horizons uses DE441, a full numerical integration of the solar system fitted to modern observations (radar, VLBI, spacecraft tracking). DE441's intrinsic positional uncertainty is sub-milliarcsecond for modern dates.

8.2 JPL Horizons query parameters

COMMAND='10'           (Sun) / '301' (Moon) / '199'–'999' (planets)
EPHEM_TYPE='OBSERVER'
CENTER='500@399'       (Geocentric)
QUANTITIES='2'         (Apparent RA/Dec, for EoT and lunar phase)
QUANTITIES='31'        (Observer ecliptic lon/lat, for solar terms and planets)
APPARENT='AIRLESS'     (No atmospheric refraction)
ANG_FORMAT='DEG'
EXTRA_PREC='YES'
TIME_TYPE='TT'

Calendar note: JPL Horizons uses the Julian calendar for dates before 1582-Oct-15. The comparison scripts convert Julian dates to proleptic Gregorian via Julian Day Number roundtrip before comparing with stem-branch, which uses the proleptic Gregorian calendar throughout.


9. Test Thresholds

The automated cross-validation suite (tests/cross-validation.test.ts) compares stem-branch vs sxwnl over 1900–2100. Because the two implementations use different correction polynomials (DE441 vs DE405), thresholds accommodate the known inter-correction divergence:

typescript
// Solar term precision (stem-branch vs sxwnl, includes DE441/DE405 gap)
expect(p50).toBeLessThan(0.07);          // P50 < 4.2 s
expect(maxDevMinutes).toBeLessThan(0.17); // Max < 10.2 s
expect(avgDevMinutes).toBeLessThan(0.07); // Avg < 4.2 s
expect(failed).toBe(0);                  // No computation failures

// Pillar accuracy
expect(mismatches).toBe(0);             // 100% match required

The primary accuracy validation is against JPL DE441 (§3.2): mean 1.05 s, max 3.05 s across the full 209–2493 CE range.


10. Reproducibility

10.1 Scripts

ScriptPurpose
scripts/jpl-comparison.mjsEoT comparison (stem-branch vs JPL, 2024)
scripts/jpl-3way-solar-terms.mjsMulti-source solar term comparison (209–2493 CE)
scripts/fit-de441-planet-corrections.mjsDE441 correction polynomial fitting
scripts/generate-planet-fixtures.mjsPlanet position fixture generation (JPL)
scripts/generate-sweph-fixtures.mjsPlanet position fixture generation (Swiss Ephemeris)
scripts/generate-lunar-fixtures.mjsLunar phase fixture generation
scripts/4way-planet-comparison.mjsMulti-source planet comparison report
scripts/long-range-analysis.mjsDense extended range analysis (−2000 to +5000 CE, all 24 terms)

10.2 Reference data

FileContents
scripts/jpl-ra-2024.txtJPL apparent RA (366 daily samples, 2024)
scripts/jpl-eclon-*-hourly.txtJPL ecliptic longitude (hourly, 12 systematic years)
scripts/jpl-eclon-*-3h.txtJPL ecliptic longitude (3-hour, 30 random years)
tests/fixtures/jpl-planet-positions.json808 planet reference positions (8 planets × 101 epochs)
tests/fixtures/sweph-planet-positions.json808 Swiss Ephemeris reference positions
tests/fixtures/jpl-lunar-phases.json594 lunar phase reference times (2000–2024)

Hourly and 3-hour JPL data files are gitignored (total ~7 MB). Re-fetch via:

bash
node scripts/jpl-3way-solar-terms.mjs     # Fetches from JPL API if missing

10.3 Running the validation suite

bash
node scripts/jpl-comparison.mjs           # EoT analysis (2024)
node scripts/jpl-3way-solar-terms.mjs     # Multi-source solar terms (42 years)
npx vitest run tests/cross-validation.test.ts  # SB vs sxwnl (1900–2100)
npx vitest run tests/planet-validation.test.ts # Planets vs JPL + SwE (8 planets)
npx vitest run tests/moon-validation.test.ts   # Lunar phase timing vs JPL