@essrt/physics 4.6.0 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@essrt/physics",
3
- "version": "4.6.0",
3
+ "version": "4.8.0",
4
4
  "description": "ESSRT (Expanding Solar System Resonance Theory) physics core \u2014 pure, injectable-constants, no I/O, no globals, no DOM. The complete model incl. fitted coefficients; every published version immutably ships one recorded model identity.",
5
5
  "essrt": {
6
6
  "modelVersion": "v13.0",
@@ -37,6 +37,7 @@
37
37
  "./moon/deep-modes-artifact": "./src/moon/deep-modes-artifact.cjs",
38
38
  "./earth/deep-orbital-history": "./src/earth/deep-orbital-history.cjs",
39
39
  "./earth/sidereal-year-channel": "./src/earth/sidereal-year-channel.cjs",
40
+ "./earth/year-lengths": "./src/earth/year-lengths.cjs",
40
41
  "./moon/month-chain": "./src/moon/month-chain.cjs",
41
42
  "./chain-cycles": "./src/chain-cycles/index.cjs",
42
43
  "./moon/arguments": "./src/moon/arguments.cjs",
@@ -73,6 +73,29 @@ function createChainCycleIntegrator({
73
73
  /** @type {Map<PeriodSecondsAtAge, Float64Array | null>} */
74
74
  const tables = new Map();
75
75
 
76
+ // Exact-argument memo for the year-length integrand of the out-of-range
77
+ // Simpson fallback. Within one animation frame every integrator node
78
+ // (the six-plus Moon chains + the seven planets) integrates the SAME
79
+ // (anchor, currentYear) pair, so the Simpson sample lattice — and with
80
+ // it every tropicalYearSecondsAtAge(tMa) — repeats across chains, up to
81
+ // 13× per sample. Exact-key reuse returns the bit-identical value: pure
82
+ // dedupe, not a resolution change (the sampler-purity trap class is
83
+ // about grids serving NEARBY arguments; this serves only the same one).
84
+ // Bounded by wholesale clear — one frame's lattice is ≤ ~1025 entries.
85
+ /** @type {Map<number, number | null>} */
86
+ const yearSecondsMemo = new Map();
87
+ const YEAR_SECONDS_MEMO_CAP = 4096;
88
+ /** @param {number} tMa @returns {number | null} */
89
+ function tropicalYearSecondsMemo(tMa) {
90
+ let v = yearSecondsMemo.get(tMa);
91
+ if (v === undefined) {
92
+ v = tropicalYearSecondsAtAge(tMa);
93
+ if (yearSecondsMemo.size >= YEAR_SECONDS_MEMO_CAP) yearSecondsMemo.clear();
94
+ yearSecondsMemo.set(tMa, v);
95
+ }
96
+ return v;
97
+ }
98
+
76
99
  /** Lazy cumulative table for one chain; null when the chain is undefined
77
100
  * anywhere in range (→ Simpson fallback).
78
101
  * @param {PeriodSecondsAtAge} periodFnSeconds
@@ -167,7 +190,7 @@ function createChainCycleIntegrator({
167
190
  const tMa = (ageAnchorYear - y) / 1e6;
168
191
  const tPeriodS = periodFnSeconds(tMa);
169
192
  if (tPeriodS === null) return null;
170
- const tYrS = tropicalYearSecondsAtAge(tMa);
193
+ const tYrS = tropicalYearSecondsMemo(tMa);
171
194
  if (tYrS === null) return null;
172
195
  const integrand = tYrS / tPeriodS; // cycles per SI year
173
196
  const w = (i === 0 || i === n) ? 1 : (i % 2 === 1 ? 4 : 2);