universal-physics-tensor 0.4.6 → 0.5.1

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.
Files changed (73) hide show
  1. package/dist/bridges/equations/be-37-shapiro-delay.d.ts.map +1 -1
  2. package/dist/bridges/equations/be-37-shapiro-delay.js +7 -9
  3. package/dist/bridges/equations/be-37-shapiro-delay.js.map +1 -1
  4. package/dist/bridges/gravitational-lensing.d.ts +13 -2
  5. package/dist/bridges/gravitational-lensing.d.ts.map +1 -1
  6. package/dist/bridges/gravitational-lensing.js +17 -6
  7. package/dist/bridges/gravitational-lensing.js.map +1 -1
  8. package/dist/bridges/perihelion-precession.d.ts +18 -3
  9. package/dist/bridges/perihelion-precession.d.ts.map +1 -1
  10. package/dist/bridges/perihelion-precession.js +22 -8
  11. package/dist/bridges/perihelion-precession.js.map +1 -1
  12. package/dist/core/constants.d.ts +50 -0
  13. package/dist/core/constants.d.ts.map +1 -0
  14. package/dist/core/constants.js +50 -0
  15. package/dist/core/constants.js.map +1 -0
  16. package/dist/dimensional/connection-validators.d.ts +60 -2
  17. package/dist/dimensional/connection-validators.d.ts.map +1 -1
  18. package/dist/dimensional/connection-validators.js +76 -2
  19. package/dist/dimensional/connection-validators.js.map +1 -1
  20. package/dist/dimensional/curvature.d.ts +361 -0
  21. package/dist/dimensional/curvature.d.ts.map +1 -0
  22. package/dist/dimensional/curvature.js +299 -0
  23. package/dist/dimensional/curvature.js.map +1 -0
  24. package/dist/dimensional/validator.d.ts +5 -3
  25. package/dist/dimensional/validator.d.ts.map +1 -1
  26. package/dist/dimensional/validator.js +58 -1
  27. package/dist/dimensional/validator.js.map +1 -1
  28. package/dist/index.d.ts +9 -2
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +23 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/numerical/be37-covariant-eikonal.d.ts +112 -39
  33. package/dist/numerical/be37-covariant-eikonal.d.ts.map +1 -1
  34. package/dist/numerical/be37-covariant-eikonal.js +219 -40
  35. package/dist/numerical/be37-covariant-eikonal.js.map +1 -1
  36. package/dist/numerical/curvature-lowering-helpers.d.ts +189 -0
  37. package/dist/numerical/curvature-lowering-helpers.d.ts.map +1 -0
  38. package/dist/numerical/curvature-lowering-helpers.js +412 -0
  39. package/dist/numerical/curvature-lowering-helpers.js.map +1 -0
  40. package/dist/numerical/engine-registry.js +4 -4
  41. package/dist/numerical/engine-registry.js.map +1 -1
  42. package/dist/numerical/errors.d.ts +16 -0
  43. package/dist/numerical/errors.d.ts.map +1 -1
  44. package/dist/numerical/errors.js +20 -0
  45. package/dist/numerical/errors.js.map +1 -1
  46. package/dist/numerical/gl4-integrator.d.ts +213 -0
  47. package/dist/numerical/gl4-integrator.d.ts.map +1 -0
  48. package/dist/numerical/gl4-integrator.js +307 -0
  49. package/dist/numerical/gl4-integrator.js.map +1 -0
  50. package/dist/numerical/index.d.ts +8 -0
  51. package/dist/numerical/index.d.ts.map +1 -1
  52. package/dist/numerical/index.js +4 -0
  53. package/dist/numerical/index.js.map +1 -1
  54. package/dist/numerical/lowering.d.ts.map +1 -1
  55. package/dist/numerical/lowering.js +180 -3
  56. package/dist/numerical/lowering.js.map +1 -1
  57. package/dist/numerical/mathts-engine.js +8 -8
  58. package/dist/numerical/mathts-engine.js.map +1 -1
  59. package/dist/numerical/metric-inverse.d.ts.map +1 -1
  60. package/dist/numerical/metric-inverse.js +28 -0
  61. package/dist/numerical/metric-inverse.js.map +1 -1
  62. package/dist/numerical/null-ray-integrator.d.ts.map +1 -1
  63. package/dist/numerical/null-ray-integrator.js +6 -3
  64. package/dist/numerical/null-ray-integrator.js.map +1 -1
  65. package/dist/numerical/pderiv.d.ts +27 -3
  66. package/dist/numerical/pderiv.d.ts.map +1 -1
  67. package/dist/numerical/pderiv.js +44 -12
  68. package/dist/numerical/pderiv.js.map +1 -1
  69. package/dist/numerical/perihelion-finder.d.ts +111 -0
  70. package/dist/numerical/perihelion-finder.d.ts.map +1 -0
  71. package/dist/numerical/perihelion-finder.js +288 -0
  72. package/dist/numerical/perihelion-finder.js.map +1 -0
  73. package/package.json +1 -1
@@ -1,51 +1,175 @@
1
1
  /**
2
- * v0.4.0 BE-37 covariant-eikonal STRUCTURAL PREVIEW.
2
+ * v0.5.0 BE-37 covariant-eikonal numerical evaluator.
3
3
  *
4
4
  * Provides `evaluateBE37CovariantEikonalNumerical`, which encodes the
5
5
  * covariant-eikonal equation
6
6
  *
7
7
  * g^μν ∇_μ ∇_ν S = 0
8
8
  *
9
- * via the connection layer added in Tasks 2-3 + 12-14. In v0.4.0 the
10
- * eikonal residual is **0 by construction**: the null wave-covector
9
+ * via the connection layer (Tasks 2-3 + 12-14 of v0.4.0). The eikonal
10
+ * residual is **0 by construction**: the null wave-covector
11
11
  *
12
12
  * k_μ = ∂_μ S = (E, E, 0, 0) (energy + radial component only)
13
13
  *
14
14
  * satisfies g^μν k_μ k_ν = 0 identically for the +,−,−,− Schwarzschild
15
- * metric. No numerical integration is performed for this quantity.
15
+ * metric. No numerical integration is performed for this quantity.
16
16
  *
17
- * The `shapiroDelaySec` field is an **intentional v0.4.0 stub** (returns 0).
18
- * The full geodesic-integrated Shapiro cross-check comparing
19
- * `shapiroDelaySec` against `evaluateShapiroDelay` is the v0.5.0
20
- * deliverable; it requires wiring `integrateGeodesic` end-to-end through
21
- * the covariant-eikonal path, which is deferred.
17
+ * `shapiroDelaySec` is computed by **GL4-driven null-geodesic integration**
18
+ * on the canonical (x, p) state in the Schwarzschild spacetime (v0.5.0 Task
19
+ * 12, Phase 2c). The photon propagates from `r = R_far_m` down to
20
+ * `r = R_near_m`; coordinate time at the endpoint minus the flat-space
21
+ * straight-line transit time is returned as the Shapiro delay.
22
22
  *
23
- * @see tests/dimensional/covariant-derivative-preview.test.ts (Task 17 [U])
24
- * @see docs/planning/v0.4.0-Implementation-Plan.md Task 17
23
+ * For the default radial geometry (impact parameter `b_m = 0`) the
24
+ * integrator reproduces the closed-form `(2GM/c³) · ln(R_far/R_near)`
25
+ * (Task 11 cross-checks this to ±2×10⁻³).
26
+ *
27
+ * @see tests/numerical/be37-covariant-eikonal-real.test.ts (Task 12 [U])
28
+ * @see tests/dimensional/covariant-derivative-preview.test.ts (Task 17 [U]/Task 11 [U])
29
+ * @see docs/planning/v0.5.0-Implementation-Plan.md Task 12
25
30
  * @module numerical/be37-covariant-eikonal
26
31
  * @public
27
32
  */
33
+ import { integrateGeodesicGL4 } from './gl4-integrator.js';
34
+ import { C_SI, G_SI } from '../core/constants.js';
35
+ // ─── Physical constants (canonical CODATA 2018 + exact-SI definitions) ────
36
+ // Imported from src/core/constants.ts (v0.5.1 PC-1 canonicalization).
37
+ const c_SI = C_SI;
38
+ const c2_SI = c_SI * c_SI;
28
39
  /**
29
- * v0.4.0 structural preview returns the eikonal residual (exactly 0 by
30
- * construction for a null ray) and a stub Shapiro delay (0 in v0.4.0).
40
+ * Schwarzschild radius `r_s = 2GM/c²`.
31
41
  *
32
- * Does NOT use the CovariantDerivativeNode or lowering infrastructure —
33
- * see the file-level module docstring for the structural rationale. The
34
- * domain guards (M_kg > 0, R_far_m > 0, R_near_m ∈ (0, R_far_m]) are
35
- * enforced for API consistency with evaluateShapiroDelay; the constants 0
36
- * do not depend on the inputs.
42
+ * Mirrors `tests/fixtures/schwarzschild.ts` (kept private here to avoid
43
+ * a src→tests dependency).
37
44
  *
38
- * The full geodesic-integrated Shapiro cross-check (wiring integrateGeodesic
39
- * through this path) is the v0.5.0 deliverable. Until then, both return
40
- * values are structural constants, not computed results.
45
+ * @internal
46
+ */
47
+ function schwarzschildRs(M_kg) {
48
+ return (2 * G_SI * M_kg) / c2_SI;
49
+ }
50
+ /**
51
+ * Returns the contravariant Schwarzschild metric closure g^{μν}(x).
41
52
  *
42
- * @param inputs - Source mass + far/near radii (validated; unused in stub).
43
- * @returns `{eikonalResidual: 0, shapiroDelaySec: 0}`.
53
+ * SI convention with on `g_{tt}` mirrors the test fixture so the
54
+ * coordinate time `t = x^0` carries seconds and `p_t = −c²` produces
55
+ * `dt/dτ ≈ 1` (τ ≈ coord time far from horizon).
56
+ *
57
+ * @internal
58
+ */
59
+ function buildGInverseFn(M_kg) {
60
+ const r_s = schwarzschildRs(M_kg);
61
+ return function gInverse(x) {
62
+ const r = x[1];
63
+ const theta = x[2];
64
+ const f = 1 - r_s / r;
65
+ const sinT = Math.sin(theta);
66
+ const gInv = [
67
+ [0, 0, 0, 0],
68
+ [0, 0, 0, 0],
69
+ [0, 0, 0, 0],
70
+ [0, 0, 0, 0],
71
+ ];
72
+ gInv[0][0] = -1 / (f * c2_SI);
73
+ gInv[1][1] = f;
74
+ gInv[2][2] = 1 / (r * r);
75
+ gInv[3][3] = 1 / (r * r * sinT * sinT);
76
+ return gInv;
77
+ };
78
+ }
79
+ /**
80
+ * Returns ∂_λ g^{μν}(x) with index order `dg[λ][μ][ν]`.
81
+ *
82
+ * Only ∂_r and ∂_θ entries are non-zero (static, axisymmetric metric).
83
+ * Sign of `dg[1][0][0] = ∂_r g^{tt} = +r_s/(r²(1−r_s/r)²c²)` matches the
84
+ * Task 0 fixture fix (positive — incorrectly negative in the v0.5.0
85
+ * pre-Task-3 fixture; reversal would push the photon outward).
86
+ *
87
+ * @internal
88
+ */
89
+ function buildDgInverseFn(M_kg) {
90
+ const r_s = schwarzschildRs(M_kg);
91
+ return function dgInverse(x) {
92
+ const r = x[1];
93
+ const theta = x[2];
94
+ const sinT = Math.sin(theta);
95
+ const cosT = Math.cos(theta);
96
+ const f = 1 - r_s / r;
97
+ const dg = Array.from({ length: 4 }, () => Array.from({ length: 4 }, () => [0, 0, 0, 0]));
98
+ // ∂_r entries (axis 1)
99
+ dg[1][0][0] = r_s / (r * r * f * f * c2_SI);
100
+ dg[1][1][1] = r_s / (r * r);
101
+ dg[1][2][2] = -2 / (r * r * r);
102
+ dg[1][3][3] = -2 / (r * r * r * sinT * sinT);
103
+ // ∂_θ entry (axis 2)
104
+ dg[2][3][3] = (-2 * cosT) / (r * r * sinT * sinT * sinT);
105
+ return dg;
106
+ };
107
+ }
108
+ /**
109
+ * v0.5.0 BE-37 covariant-eikonal numerical evaluator.
110
+ *
111
+ * Returns:
112
+ * - `eikonalResidual = 0` by construction (null wave-covector identity).
113
+ * - `shapiroDelaySec`: GL4-integrated coordinate-time delay relative to
114
+ * the flat-space straight-line transit, in seconds.
115
+ *
116
+ * **Algorithm — null geodesic in Schwarzschild via GL4.**
117
+ *
118
+ * 1. Schwarzschild radius `r_s = 2GM/c²`. Domain guard `R_near_m > r_s`
119
+ * (else the photon path crosses the event horizon).
120
+ * 2. Set initial state at `(t=0, r=R_far_m, θ=π/2, φ=0)`. Affine-parameter
121
+ * normalization `p_t = −c²` → `dt/dτ = 1/(1−r_s/r) ≈ 1` far from the
122
+ * horizon (τ ≈ coord time). Set `p_θ = 0` (motion confined to equatorial
123
+ * plane), `p_φ = b_m · c` (Killing-vector angular momentum
124
+ * corresponding to flat-limit impact parameter `b_m`).
125
+ * 3. Solve `p_r` from the null condition `g^μν p_μ p_ν = 0` at the
126
+ * initial point, take the negative root (inward motion: `dr/dτ < 0`
127
+ * since `dr/dτ = g^rr p_r = (1−r_s/r) p_r`).
128
+ * 4. Integrate via `integrateGeodesicGL4` for `tauMax` chosen to overshoot
129
+ * `r = R_near_m` (safety factor 1.5 on the flat-space transit time).
130
+ * 5. Walk snapshots; find the first index where `r ≤ R_near_m`. Linearly
131
+ * interpolate `t` between the bracketing snapshots to land exactly on
132
+ * `r = R_near_m`. Take that `t` as the geodesic coord-time transit.
133
+ * 6. Flat-space reference: for a straight-line null ray with impact
134
+ * parameter `b`, time to go from `r_far` to `r_near` (single leg, no
135
+ * closest-approach crossing) is `(√(r_far²−b²) − √(r_near²−b²))/c`.
136
+ * For `b = 0` (default) this reduces to `(R_far − R_near)/c`.
137
+ * 7. `shapiroDelaySec = t_geodesic − t_flat`.
138
+ *
139
+ * **Sign convention.** Shapiro delay is positive (light slowed by the
140
+ * gravitational potential). A negative result indicates an integration
141
+ * or reference-frame bug.
142
+ *
143
+ * **Impact parameter `b_m`.** Default `0` (radial). The default geometry
144
+ * reproduces the closed-form `evaluateShapiroDelay` to ≤1e-6 relative at
145
+ * 2048 steps for solar-scale Earth/Mars distances (Task 11 cross-check).
146
+ * Non-zero `b_m` requires `b_m ≤ R_near_m` (closest approach `r_min ≈ b`
147
+ * must not lie between R_far and R_near).
148
+ *
149
+ * @param inputs - Source mass + far/near radii (+ optional `b_m`, `steps`):
150
+ * - `M_kg` — gravitational source mass in **kilograms** (SI). Must be a
151
+ * finite positive number.
152
+ * - `R_far_m` — origin radial coordinate in **metres** (SI). The signal
153
+ * start point.
154
+ * - `R_near_m` — destination radial coordinate in **metres** (SI). Must
155
+ * satisfy `0 < R_near_m ≤ R_far_m` and `R_near_m > 1.01 · r_s` (stay
156
+ * comfortably outside the Schwarzschild horizon `r_s = 2GM/c²`).
157
+ * - `b_m` — optional impact parameter in **metres** (SI). Default `0`
158
+ * (purely radial geodesic). Non-zero `b_m` requires `b_m ≤ R_near_m`.
159
+ * - `steps` — optional GL4 integrator step count (dimensionless). Default
160
+ * 2048. Higher = tighter agreement with closed-form Shapiro at
161
+ * additional CPU cost.
162
+ * @returns `{ eikonalResidual, shapiroDelaySec }`:
163
+ * - `eikonalResidual` — **dimensionless** numerical residual of
164
+ * `g^μν ∇_μ ∇_ν S = 0`; returns exactly `0` by construction.
165
+ * - `shapiroDelaySec` — gravitational-time-delay in **seconds** (SI).
166
+ * Positive by sign convention (light is slowed in the potential well).
167
+ * @throws RangeError on out-of-domain inputs.
44
168
  * @public
45
169
  */
46
170
  export async function evaluateBE37CovariantEikonalNumerical(inputs) {
47
- const { M_kg, R_far_m, R_near_m } = inputs;
48
- // Domain guards (mirrors evaluateShapiroDelay for API consistency).
171
+ const { M_kg, R_far_m, R_near_m, b_m = 0, steps = 2048 } = inputs;
172
+ // ─── Domain guards ──────────────────────────────────────────────────────
49
173
  if (!Number.isFinite(M_kg) || M_kg <= 0) {
50
174
  throw new RangeError(`evaluateBE37CovariantEikonalNumerical: M_kg must be a finite positive number, got ${M_kg}`);
51
175
  }
@@ -58,23 +182,78 @@ export async function evaluateBE37CovariantEikonalNumerical(inputs) {
58
182
  if (R_near_m > R_far_m) {
59
183
  throw new RangeError(`evaluateBE37CovariantEikonalNumerical: R_near_m (${R_near_m}) must be ≤ R_far_m (${R_far_m})`);
60
184
  }
185
+ if (!Number.isFinite(b_m) || b_m < 0) {
186
+ throw new RangeError(`evaluateBE37CovariantEikonalNumerical: b_m must be a finite non-negative number, got ${b_m}`);
187
+ }
188
+ if (b_m > R_near_m) {
189
+ throw new RangeError(`evaluateBE37CovariantEikonalNumerical: b_m (${b_m}) must be ≤ R_near_m (${R_near_m}); closest-approach geometry not supported`);
190
+ }
191
+ const r_s = schwarzschildRs(M_kg);
192
+ if (R_near_m <= r_s * 1.01) {
193
+ throw new RangeError(`evaluateBE37CovariantEikonalNumerical: R_near_m (${R_near_m}) must be safely outside the Schwarzschild horizon r_s=${r_s}`);
194
+ }
61
195
  // ─── Eikonal residual ────────────────────────────────────────────────────
62
- //
63
- // The covariant-eikonal equation g^μν ∇_μ ∇_ν S = 0 is evaluated at
64
- // the null wave-covector k_μ = ∂_μ S = (E, E, 0, 0) in Schwarzschild
65
- // coordinates. For a null ray, by definition:
66
- //
67
- // g^μν k_μ k_ν = 0
68
- //
69
- // This is a structural consequence of the null-ray construction — it does
70
- // not depend on M_kg, R_far_m, or R_near_m. The residual is exactly 0.
196
+ // g^μν k_μ k_ν = 0 by construction for the null wave-covector
197
+ // k_μ = (E, E, 0, 0). Structural independent of M_kg, R_far, R_near.
71
198
  const eikonalResidual = 0;
72
- // ─── Shapiro delay (v0.4.0 stub) ────────────────────────────────────────
73
- //
74
- // The geodesic-integrated Shapiro delay is deferred to v0.5.0.
75
- // shapiroDelaySec returns 0 here; the v0.5.0 task will wire
76
- // integrateGeodesic through this path and remove the stub.
77
- const shapiroDelaySec = 0;
199
+ // ─── Shapiro delay via GL4 null-geodesic integration ────────────────────
200
+ const gInverseFn = buildGInverseFn(M_kg);
201
+ const dgInverseFn = buildDgInverseFn(M_kg);
202
+ // Initial state at (t=0, r=R_far, θ=π/2, φ=0). Equatorial plane (p_θ=0).
203
+ // Affine-parameter normalization: p_t = -c² makes dt/dτ ≈ 1 far from
204
+ // horizon, so τ ≈ coord time t and tauMax can be set in units of seconds.
205
+ const x0 = [0, R_far_m, Math.PI / 2, 0];
206
+ const p_t = -c2_SI;
207
+ const p_phi = b_m * c_SI; // Killing-vector conservation: classical b = p_φ/(|p_t|/c²·c) = p_φ/c.
208
+ const p_theta = 0;
209
+ // Solve null condition g^μν p_μ p_ν = 0 for p_r at the initial point:
210
+ // g^tt p_t² + g^rr p_r² + g^φφ p_φ² = 0 (θ=π/2)
211
+ // ⇒ p_r² = (−g^tt p_t² − g^φφ p_φ²) / g^rr
212
+ const gInv0 = gInverseFn(x0);
213
+ const numerator = -gInv0[0][0] * p_t * p_t - gInv0[3][3] * p_phi * p_phi;
214
+ if (numerator < 0) {
215
+ throw new RangeError(`evaluateBE37CovariantEikonalNumerical: null condition has no real p_r at R_far=${R_far_m} (impact parameter b=${b_m} too large for this geometry; numerator=${numerator})`);
216
+ }
217
+ const p_r_magnitude = Math.sqrt(numerator / gInv0[1][1]);
218
+ // Inward motion: dr/dτ = g^rr p_r = (1-r_s/r) p_r < 0 ⇒ p_r < 0.
219
+ const p_r = -p_r_magnitude;
220
+ const initialState = {
221
+ x: x0,
222
+ p: [p_t, p_r, p_theta, p_phi],
223
+ };
224
+ // Choose tauMax to overshoot R_near with safety margin. With p_t = -c²
225
+ // and far from horizon, dr/dτ ≈ -c for b=0 (radial); slightly slower for
226
+ // non-zero b. Flat-space single-leg time = (√(R_far² − b²) − √(R_near² − b²))/c.
227
+ const flatLegFar = Math.sqrt(R_far_m * R_far_m - b_m * b_m);
228
+ const flatLegNear = Math.sqrt(R_near_m * R_near_m - b_m * b_m);
229
+ const t_flat = (flatLegFar - flatLegNear) / c_SI;
230
+ const tauMax = t_flat * 1.5;
231
+ const snapshots = integrateGeodesicGL4(initialState, {
232
+ steps,
233
+ tauMax,
234
+ gInverseFn,
235
+ dgInverseFn,
236
+ domainMinRadius: r_s * 1.01,
237
+ });
238
+ // Find the first snapshot with r ≤ R_near_m and linearly interpolate t.
239
+ let t_geodesic;
240
+ for (let i = 1; i < snapshots.length; i++) {
241
+ const rPrev = snapshots[i - 1].x[1];
242
+ const rCurr = snapshots[i].x[1];
243
+ if (rPrev > R_near_m && rCurr <= R_near_m) {
244
+ const tPrev = snapshots[i - 1].x[0];
245
+ const tCurr = snapshots[i].x[0];
246
+ // Linear interpolation: alpha = (R_near - rPrev) / (rCurr - rPrev), in [0, 1].
247
+ const alpha = (R_near_m - rPrev) / (rCurr - rPrev);
248
+ t_geodesic = tPrev + alpha * (tCurr - tPrev);
249
+ break;
250
+ }
251
+ }
252
+ if (t_geodesic === undefined) {
253
+ const rFinal = snapshots[snapshots.length - 1].x[1];
254
+ throw new Error(`evaluateBE37CovariantEikonalNumerical: photon did not reach R_near=${R_near_m} within tauMax=${tauMax} s; final r=${rFinal}. Try increasing steps or tauMax.`);
255
+ }
256
+ const shapiroDelaySec = t_geodesic - t_flat;
78
257
  return { eikonalResidual, shapiroDelaySec };
79
258
  }
80
259
  //# sourceMappingURL=be37-covariant-eikonal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"be37-covariant-eikonal.js","sourceRoot":"","sources":["../../src/numerical/be37-covariant-eikonal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAkDH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,qCAAqC,CACzD,MAAkC;IAElC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAE3C,oEAAoE;IACpE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,I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G,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChC,IAAI,KAAK,GAAG,QAAQ,IAAI,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC1C,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACpC,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAChC,+EAA+E;YAC/E,MAAM,KAAK,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;YACnD,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;YAC7C,MAAM;QACR,CAAC;IACH,CAAC;IACD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,MAAM,IAAI,KAAK,CACb,sEAAsE,QAAQ,kBAAkB,MAAM,eAAe,MAAM,mCAAmC,CAC/J,CAAC;IACJ,CAAC;IAED,MAAM,eAAe,GAAG,UAAU,GAAG,MAAM,CAAC;IAE5C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,189 @@
1
+ /**
2
+ * Numerical helpers for Riemann-curvature lowering (Task 6 [U] / v0.5.0 1c-ii).
3
+ *
4
+ * Mirrors `connection-lowering-helpers.ts`: produces Γ and ∂Γ tensors from
5
+ * coordinate-dependent metric closures, then assembles the Riemann tensor via
6
+ * the corrected (Carroll-Ch.3 §3.4 / Adam+Eve F4-S3) formula:
7
+ *
8
+ * R^ρ_{σμν} = ∂_μ Γ^ρ_{σν} − ∂_ν Γ^ρ_{σμ} + Σ_λ (Γ^ρ_{λμ} Γ^λ_{σν} − Γ^ρ_{λν} Γ^λ_{σμ})
9
+ *
10
+ * Index conventions (pinned via JSDoc + a runtime assert):
11
+ * - Γ[ρ][σ][ν] = Γ^ρ_{σν} (matches computeChristoffelTensor's [α][μ][ν] with
12
+ * σ ↔ μ — i.e., the SECOND axis is σ, the THIRD is ν, per Carroll Ch.5).
13
+ * - dGamma[λ][ρ][σ][ν] = ∂_λ Γ^ρ_{σν} (I3)
14
+ * - R[ρ][σ][μ][ν] = R^ρ_{σμν} (Carroll)
15
+ *
16
+ * NOTE on the σ/μ swap vs `computeChristoffelTensor`:
17
+ * `computeChristoffelTensor` was authored for v0.4.0 covariant-derivative
18
+ * lowering, which sums Γ^α_{μλ} T^λ over the middle index `μ` (the wrt index
19
+ * of the cov-deriv). v0.5.0 Riemann needs σ in the SECOND-lower slot of every
20
+ * Γ. Because Γ is symmetric in its two lower indices (Christoffel symmetry),
21
+ * the two storage conventions are numerically identical — we use the
22
+ * existing [α][middle][last] storage and access it with σ in the middle slot.
23
+ *
24
+ * The fast path uses the v0.4.0 `computeChristoffelTensor` infrastructure
25
+ * (no new tensor-engine code) and the v0.4.0 `pderivNumericalFn` pattern
26
+ * (centered finite differences). M11: ∂Γ is computed by repeated centered
27
+ * finite-differences on `christoffel()`, not a new AST node type or AD pass.
28
+ *
29
+ * @module numerical/curvature-lowering-helpers
30
+ */
31
+ import type { TensorEngine } from './tensor-engine.js';
32
+ import type { NestedArray } from './types.js';
33
+ /** Flat row-major N×N matrix (one g or g^{-1} sample). */
34
+ export type FlatMatrix = ReadonlyArray<number>;
35
+ /** A coordinate-dependent rank-2 closure: f(x) → N×N as a NestedArray
36
+ * (number[][] or any nested form that `flattenNA` can flatten). */
37
+ export type MetricFn = (x: ReadonlyArray<number>) => NestedArray;
38
+ /**
39
+ * dGamma[λ][ρ][σ][ν] = ∂_λ Γ^ρ_{σν} at the given coordinates (I3).
40
+ *
41
+ * 4-deep nested number array — readonly to mark this as an output container
42
+ * the helper produces but does not mutate after construction.
43
+ */
44
+ export type DGammaTensor = readonly (readonly (readonly (readonly number[])[])[])[];
45
+ /** Gamma[ρ][σ][ν] = Γ^ρ_{σν} — same index order as `computeChristoffelTensor`
46
+ * output (just renamed for the Riemann use). */
47
+ export type GammaTensor = readonly (readonly (readonly number[])[])[];
48
+ /**
49
+ * Step size for finite differences on the Christoffel function.
50
+ *
51
+ * Inner step (∂g for one Γ evaluation) uses the v0.4.0 default
52
+ * `1e-6·max(|x|,1)` via `pderivNumericalFn`-style centered FD. This gives ∂g
53
+ * with relative precision ≈ 1e-11 on Schwarzschild components (verified by
54
+ * inspection at r=3·r_s).
55
+ *
56
+ * Outer step (∂Γ for one R evaluation) is `1e-4·max(|x|,1)` and we use a
57
+ * **4th-order centered stencil**:
58
+ *
59
+ * f'(x) ≈ [−f(x+2h) + 8 f(x+h) − 8 f(x-h) + f(x-2h)] / (12 h)
60
+ *
61
+ * Truncation O(h⁴) instead of O(h²). At h=0.886 m (r=3·r_s, M=M_sun),
62
+ * truncation ≈ h⁴·Γ⁽⁵⁾/Γ ~ 1e-13 relative, round-off ε·|Γ|/h ~ 1e-15 relative.
63
+ * Both sit well below the 1e-9 gate.
64
+ *
65
+ * The 2nd-order outer FD that v0.4.0 covariant-derivative lowering uses
66
+ * leaves ~3e-6 relative error on R^t_{rtr} due to noise propagation through
67
+ * the c²-scaled g_{tt} component — 4th-order outer FD recovers the precision.
68
+ */
69
+ export declare function outerStep(x: number): number;
70
+ /**
71
+ * Compute Γ^ρ_{σν} at coordinate x. Internally builds a centered-FD ∂g sampler
72
+ * around x and delegates to `computeChristoffelTensor` (the v0.4.0 helper).
73
+ *
74
+ * Returns a fully-materialised 3-deep nested array Γ[ρ][σ][ν]. (We do NOT keep
75
+ * the EngineTensor wrapper because we immediately rebuild dGamma and R as
76
+ * plain nested arrays — round-tripping through the engine on every FD sample
77
+ * would dominate the cost.)
78
+ */
79
+ export declare function christoffelAt(x: ReadonlyArray<number>, gFn: MetricFn, gInverseFn: MetricFn, N: number, engine: TensorEngine): number[][][];
80
+ /**
81
+ * dGamma[λ][ρ][σ][ν] = ∂_λ Γ^ρ_{σν} via centered FD on `christoffelAt`. (I3)
82
+ *
83
+ * Includes a runtime index-assert verifying `dGamma[1][1][1][1]` is finite
84
+ * before returning (catches silent shape-permutation bugs introduced by future
85
+ * edits to `computeChristoffelTensor`'s output ordering).
86
+ */
87
+ export declare function dGammaAt(x: ReadonlyArray<number>, gFn: MetricFn, gInverseFn: MetricFn, N: number, engine: TensorEngine): DGammaTensor;
88
+ /**
89
+ * Build the full 4×4×4×4 Riemann tensor R^ρ_{σμν} from Γ and ∂Γ per the
90
+ * Carroll formula (Adam+Eve F4-S3):
91
+ *
92
+ * R[ρ][σ][μ][ν] = ∂_μ Γ[ρ][σ][ν] − ∂_ν Γ[ρ][σ][μ]
93
+ * + Σ_λ (Γ[ρ][λ][μ] Γ[λ][σ][ν] − Γ[ρ][λ][ν] Γ[λ][σ][μ])
94
+ *
95
+ * σ in the SECOND lower slot of each Γ (F4/S3 correction).
96
+ */
97
+ export declare function buildRiemann(gamma: GammaTensor, dGamma: DGammaTensor, N: number): number[][][][];
98
+ /**
99
+ * Compute the upper-Riemann tensor R^ρ_{σμν} at coordinate x using the same
100
+ * Γ + ∂Γ pipeline as the riemann-tensor lowering case. Encapsulates the
101
+ * full christoffelAt + dGammaAt + buildRiemann sequence so callers (Task 9
102
+ * Bianchi residual) can sample R at perturbed coordinates without
103
+ * re-implementing the FD machinery.
104
+ */
105
+ export declare function riemannUpperAt(x: ReadonlyArray<number>, gFn: MetricFn, gInverseFn: MetricFn, N: number, engine: TensorEngine): number[][][][];
106
+ /**
107
+ * Lower the upper-ρ index of R^ρ_{σμν} via the covariant metric g_{aρ}:
108
+ *
109
+ * R_{aσμν} = Σ_ρ g_{aρ} R^ρ_{σμν}
110
+ *
111
+ * Output index order: `[a][σ][μ][ν]` — all four lower. (a is the freshly
112
+ * lowered index in the first slot.)
113
+ */
114
+ export declare function lowerFirstIndex(R: number[][][][], gLowerFlat: ReadonlyArray<number>, N: number): number[][][][];
115
+ /**
116
+ * Sample the all-lower Riemann tensor R_{αβγδ}(x) — combines `riemannUpperAt`
117
+ * with `lowerFirstIndex` for the single-coordinate evaluation. Used both as
118
+ * the base sample and (with perturbed x) as the FD inputs for ∂_λ R_{αβγδ}.
119
+ */
120
+ export declare function riemannLowerAt(x: ReadonlyArray<number>, gFn: MetricFn, gInverseFn: MetricFn, N: number, engine: TensorEngine): number[][][][];
121
+ /**
122
+ * Compute ∂_λ R_{αβγδ}(x) via a 4th-order centered stencil on
123
+ * `riemannLowerAt`. Index order: `dR[λ][α][β][γ][δ] = ∂_λ R_{αβγδ}`.
124
+ *
125
+ * Uses the same outer step (`outerStep`) as Task 6's dGammaAt so the
126
+ * FD-noise compounding pattern matches. This is one extra layer of FD on top
127
+ * of the Christoffel-of-Christoffel double-FD already inside `riemannLowerAt`
128
+ * — total: ∂(∂(∂g)) at 4th order in each layer. Empirical noise floor reached
129
+ * by the per-component value is documented in the test report.
130
+ */
131
+ export declare function dRiemannLowerAt(x: ReadonlyArray<number>, gFn: MetricFn, gInverseFn: MetricFn, N: number, engine: TensorEngine): number[][][][][];
132
+ /**
133
+ * Compute ∇_λ R_{μνρσ} via partial + Christoffel-correction terms (Approach 1).
134
+ *
135
+ * ∇_λ R_{μνρσ} = ∂_λ R_{μνρσ}
136
+ * − Γ^α_{λμ} R_{ανρσ}
137
+ * − Γ^α_{λν} R_{μαρσ}
138
+ * − Γ^α_{λρ} R_{μνασ}
139
+ * − Γ^α_{λσ} R_{μνρα}
140
+ *
141
+ * Index order: `covR[λ][μ][ν][ρ][σ] = ∇_λ R_{μνρσ}`.
142
+ *
143
+ * Approach choice (full ∇, not raw ∂): the second Bianchi identity
144
+ * ∇_{[λ} R_{μν]ρσ} = 0 is the canonical statement. Using raw ∂ would give a
145
+ * residual dominated by the (cyclic-non-cancelling) Christoffel-correction
146
+ * terms, masking the identity check with O(1) algebraic clutter. Full ∇
147
+ * makes the test a genuine self-consistency check of the lowered Riemann.
148
+ */
149
+ export declare function covariantDerivRiemannLowerAt(x: ReadonlyArray<number>, gFn: MetricFn, gInverseFn: MetricFn, N: number, engine: TensorEngine): number[][][][][];
150
+ /**
151
+ * Build the second-Bianchi-identity residual (cyclic over first three indices):
152
+ *
153
+ * B_{λμνρσ} = ∇_λ R_{μνρσ} + ∇_μ R_{νλρσ} + ∇_ν R_{λμρσ}
154
+ *
155
+ * Carroll Eq. 3.95: B ≡ 0 in any (torsion-free) Lorentzian manifold. The
156
+ * residual measures the FD-truncation + cancellation noise on the lowered
157
+ * Riemann tensor through one extra ∂ layer.
158
+ *
159
+ * Index order: `B[λ][μ][ν][ρ][σ]` — all five lower.
160
+ */
161
+ export declare function bianchiResidualAt(x: ReadonlyArray<number>, gFn: MetricFn, gInverseFn: MetricFn, N: number, engine: TensorEngine): number[][][][][];
162
+ /**
163
+ * JS-side contraction of a flat 4-axis tensor R[a][b][c][d] (length N⁴, row-major)
164
+ * down to a 2-tensor by summing one upper axis against one lower axis.
165
+ *
166
+ * Configuration:
167
+ * - `upperAxis`: the axis index (0..3) that contracts WITH `lowerAxis` (dummy slot).
168
+ * - `lowerAxis`: the partner axis (0..3) forming the dummy pair.
169
+ * - `outAxes`: the two surviving axes [i, j] that become the (free output)
170
+ * rows/cols of the returned N×N matrix.
171
+ *
172
+ * For Carroll Eq. 3.91 Ricci R_μν = R^λ_{μλν} on Riemann stored as R[ρ][σ][μ][ν]:
173
+ * contractRiemannJS(flatR, N, { upperAxis: 0, lowerAxis: 2, outAxes: [1, 3] })
174
+ * sums `R[λ][μ_out][λ][ν_out]` over λ.
175
+ *
176
+ * Pre-flattened input convention: row-major `R[a][b][c][d] = flatR[a*N³ + b*N² + c*N + d]`.
177
+ * (Matches `flattenNestedArray` output for an [N,N,N,N] EngineTensor.)
178
+ *
179
+ * @internal — extracted from `lowering.ts` ricci-tensor arm (AS-1, v0.5.1). Kept
180
+ * deliberately narrow (4-axis source → 2-axis output) to match the v0.5.0 GR
181
+ * curvature pipeline; generalisation deferred to v0.6.0 if Weyl/Kretschmann
182
+ * arrives (see `docs/architecture/COMPONENTS.md` curvature-layer pattern note).
183
+ */
184
+ export declare function contractRiemannJS(flatR: ReadonlyArray<number>, N: number, config: {
185
+ upperAxis: 0 | 1 | 2 | 3;
186
+ lowerAxis: 0 | 1 | 2 | 3;
187
+ outAxes: readonly [number, number];
188
+ }): number[][];
189
+ //# sourceMappingURL=curvature-lowering-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"curvature-lowering-helpers.d.ts","sourceRoot":"","sources":["../../src/numerical/curvature-lowering-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAK9C,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AAE/C;oEACoE;AACpE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,WAAW,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAEpF;iDACiD;AACjD,MAAM,MAAM,WAAW,GAAG,SAAS,CAAC,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAMtE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3C;AA0CD;;;;;;;;GAQG;AACH,w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