universal-physics-tensor 0.7.3 → 0.15.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/README.md +147 -109
- package/bin/upt.mjs +508 -0
- package/dist/bridges/be23-planckian-confrontation.d.ts +162 -0
- package/dist/bridges/be23-planckian-confrontation.d.ts.map +1 -0
- package/dist/bridges/be23-planckian-confrontation.js +196 -0
- package/dist/bridges/be23-planckian-confrontation.js.map +1 -0
- package/dist/bridges/be36-gw170817-confrontation.d.ts +111 -0
- package/dist/bridges/be36-gw170817-confrontation.d.ts.map +1 -0
- package/dist/bridges/be36-gw170817-confrontation.js +100 -0
- package/dist/bridges/be36-gw170817-confrontation.js.map +1 -0
- package/dist/bridges/bridge-equations.d.ts +129 -0
- package/dist/bridges/bridge-equations.d.ts.map +1 -0
- package/dist/bridges/bridge-equations.js +130 -0
- package/dist/bridges/bridge-equations.js.map +1 -0
- package/dist/bridges/catalog-adapter.d.ts +1 -1
- package/dist/bridges/catalog-adapter.js +1 -1
- package/dist/bridges/confrontation-coverage.d.ts +67 -0
- package/dist/bridges/confrontation-coverage.d.ts.map +1 -0
- package/dist/bridges/confrontation-coverage.js +83 -0
- package/dist/bridges/confrontation-coverage.js.map +1 -0
- package/dist/bridges/equations/_be-helpers.d.ts +2 -1
- package/dist/bridges/equations/_be-helpers.d.ts.map +1 -1
- package/dist/bridges/equations/be-12-coherence-length.d.ts +1 -1
- package/dist/bridges/equations/be-13-einstein-trace.d.ts +2 -2
- package/dist/bridges/equations/be-13-einstein-trace.js +1 -1
- package/dist/bridges/equations/be-14-ryu-takayanagi.d.ts +2 -2
- package/dist/bridges/equations/be-15-emergence.d.ts +19 -5
- package/dist/bridges/equations/be-15-emergence.d.ts.map +1 -1
- package/dist/bridges/equations/be-15-emergence.js +18 -4
- package/dist/bridges/equations/be-15-emergence.js.map +1 -1
- package/dist/bridges/equations/be-16-landauer.d.ts +1 -1
- package/dist/bridges/equations/be-17-einstein-cartan.d.ts +1 -1
- package/dist/bridges/equations/be-18-higgs-mass.d.ts +1 -1
- package/dist/bridges/equations/be-19-quantum-bounce.d.ts +1 -1
- package/dist/bridges/equations/be-20-vacuum-energy.d.ts +4 -4
- package/dist/bridges/equations/be-20-vacuum-energy.d.ts.map +1 -1
- package/dist/bridges/equations/be-20-vacuum-energy.js +4 -2
- package/dist/bridges/equations/be-20-vacuum-energy.js.map +1 -1
- package/dist/bridges/equations/be-22-topological-entanglement.d.ts +1 -1
- package/dist/bridges/equations/be-23-syk-planckian.d.ts +1 -1
- package/dist/bridges/equations/be-24-foerster-fret.d.ts +1 -1
- package/dist/bridges/equations/be-25-iit-phi.d.ts +1 -1
- package/dist/bridges/equations/be-25-orch-or.d.ts +13 -1
- package/dist/bridges/equations/be-25-orch-or.d.ts.map +1 -1
- package/dist/bridges/equations/be-25-orch-or.js +12 -0
- package/dist/bridges/equations/be-25-orch-or.js.map +1 -1
- package/dist/bridges/equations/be-26-dna-tunneling.d.ts +2 -2
- package/dist/bridges/equations/be-26-dna-tunneling.js +1 -1
- package/dist/bridges/equations/be-27-effective-temperature.d.ts +1 -1
- package/dist/bridges/equations/be-28-onsager-entropy-production.d.ts +1 -1
- package/dist/bridges/equations/be-29-jarzynski.d.ts +1 -1
- package/dist/bridges/equations/be-30-flm-first-law.d.ts +2 -2
- package/dist/bridges/equations/be-31-causal-set-bd.d.ts +1 -1
- package/dist/bridges/equations/be-32-quantum-reference-frame.d.ts +1 -1
- package/dist/bridges/equations/be-33-hertz-millis.d.ts +1 -1
- package/dist/bridges/equations/be-34-kibble-zurek.d.ts +1 -1
- package/dist/bridges/equations/be-35-conformal-bootstrap.d.ts +1 -1
- package/dist/bridges/equations/be-36-gw-speed-bound.d.ts +12 -5
- package/dist/bridges/equations/be-36-gw-speed-bound.d.ts.map +1 -1
- package/dist/bridges/equations/be-36-gw-speed-bound.js +11 -4
- package/dist/bridges/equations/be-36-gw-speed-bound.js.map +1 -1
- package/dist/bridges/equations/be-38-mond.d.ts +1 -1
- package/dist/bridges/equations/be-39-asymptotic-safety.d.ts +2 -2
- package/dist/bridges/equations/be-40-composite-higgs.d.ts +1 -1
- package/dist/bridges/equations/be-41-swampland.d.ts +1 -1
- package/dist/bridges/equations/be-43-er-epr.d.ts +1 -1
- package/dist/bridges/equations/be-44-soft-hair.d.ts +1 -1
- package/dist/bridges/equations/be-45-tcc.d.ts +1 -1
- package/dist/bridges/equations/be-46-multiverse-measure.d.ts +1 -1
- package/dist/bridges/equations/be-47-bbn-dark-sector.d.ts +1 -1
- package/dist/bridges/equations/be-48-grw-localization.d.ts +1 -1
- package/dist/bridges/equations/be-49-quantum-darwinism.d.ts +1 -1
- package/dist/bridges/equations/be-50-wheeler-feynman.d.ts +1 -1
- package/dist/bridges/index.d.ts +10 -7
- package/dist/bridges/index.d.ts.map +1 -1
- package/dist/bridges/index.js +47 -34
- package/dist/bridges/index.js.map +1 -1
- package/dist/bridges/membership.d.ts +44 -0
- package/dist/bridges/membership.d.ts.map +1 -0
- package/dist/bridges/membership.js +59 -0
- package/dist/bridges/membership.js.map +1 -0
- package/dist/bridges/rejected.d.ts +40 -0
- package/dist/bridges/rejected.d.ts.map +1 -0
- package/dist/bridges/rejected.js +81 -0
- package/dist/bridges/rejected.js.map +1 -0
- package/dist/composition/bridge-analysis.d.ts +189 -0
- package/dist/composition/bridge-analysis.d.ts.map +1 -0
- package/dist/composition/bridge-analysis.js +445 -0
- package/dist/composition/bridge-analysis.js.map +1 -0
- package/dist/composition/bridge-prediction.d.ts +95 -0
- package/dist/composition/bridge-prediction.d.ts.map +1 -0
- package/dist/composition/bridge-prediction.js +0 -0
- package/dist/composition/bridge-prediction.js.map +1 -0
- package/dist/composition/catalog-graph.d.ts +20 -0
- package/dist/composition/catalog-graph.d.ts.map +1 -0
- package/dist/composition/catalog-graph.js +39 -0
- package/dist/composition/catalog-graph.js.map +1 -0
- package/dist/composition/compose-surface.d.ts +12 -0
- package/dist/composition/compose-surface.d.ts.map +1 -0
- package/dist/composition/compose-surface.js +10 -0
- package/dist/composition/compose-surface.js.map +1 -0
- package/dist/composition/compose-symbolic.d.ts +75 -0
- package/dist/composition/compose-symbolic.d.ts.map +1 -0
- package/dist/composition/compose-symbolic.js +157 -0
- package/dist/composition/compose-symbolic.js.map +1 -0
- package/dist/composition/compose.d.ts +110 -0
- package/dist/composition/compose.d.ts.map +1 -0
- package/dist/composition/compose.js +231 -0
- package/dist/composition/compose.js.map +1 -0
- package/dist/composition/consistency.d.ts +24 -0
- package/dist/composition/consistency.d.ts.map +1 -0
- package/dist/composition/consistency.js +26 -0
- package/dist/composition/consistency.js.map +1 -0
- package/dist/composition/discovery.d.ts +104 -0
- package/dist/composition/discovery.d.ts.map +1 -0
- package/dist/composition/discovery.js +165 -0
- package/dist/composition/discovery.js.map +1 -0
- package/dist/composition/edge.d.ts +139 -0
- package/dist/composition/edge.d.ts.map +1 -0
- package/dist/composition/edge.js +72 -0
- package/dist/composition/edge.js.map +1 -0
- package/dist/composition/edges/calibration.d.ts +107 -0
- package/dist/composition/edges/calibration.d.ts.map +1 -0
- package/dist/composition/edges/calibration.js +373 -0
- package/dist/composition/edges/calibration.js.map +1 -0
- package/dist/composition/edges/catalog-full.d.ts +299 -0
- package/dist/composition/edges/catalog-full.d.ts.map +1 -0
- package/dist/composition/edges/catalog-full.js +989 -0
- package/dist/composition/edges/catalog-full.js.map +1 -0
- package/dist/composition/edges/catalog-tranche.d.ts +112 -0
- package/dist/composition/edges/catalog-tranche.d.ts.map +1 -0
- package/dist/composition/edges/catalog-tranche.js +241 -0
- package/dist/composition/edges/catalog-tranche.js.map +1 -0
- package/dist/composition/enumerate.d.ts +67 -0
- package/dist/composition/enumerate.d.ts.map +1 -0
- package/dist/composition/enumerate.js +78 -0
- package/dist/composition/enumerate.js.map +1 -0
- package/dist/composition/explain.d.ts +102 -0
- package/dist/composition/explain.d.ts.map +1 -0
- package/dist/composition/explain.js +244 -0
- package/dist/composition/explain.js.map +1 -0
- package/dist/composition/expr-eval.d.ts +33 -0
- package/dist/composition/expr-eval.d.ts.map +1 -0
- package/dist/composition/expr-eval.js +95 -0
- package/dist/composition/expr-eval.js.map +1 -0
- package/dist/composition/expr-simplify.d.ts +60 -0
- package/dist/composition/expr-simplify.d.ts.map +1 -0
- package/dist/composition/expr-simplify.js +330 -0
- package/dist/composition/expr-simplify.js.map +1 -0
- package/dist/composition/expr-subst.d.ts +29 -0
- package/dist/composition/expr-subst.d.ts.map +1 -0
- package/dist/composition/expr-subst.js +60 -0
- package/dist/composition/expr-subst.js.map +1 -0
- package/dist/composition/identifiability.d.ts +103 -0
- package/dist/composition/identifiability.d.ts.map +1 -0
- package/dist/composition/identifiability.js +148 -0
- package/dist/composition/identifiability.js.map +1 -0
- package/dist/composition/index.d.ts +37 -0
- package/dist/composition/index.d.ts.map +1 -0
- package/dist/composition/index.js +27 -0
- package/dist/composition/index.js.map +1 -0
- package/dist/composition/quantities.d.ts +297 -0
- package/dist/composition/quantities.d.ts.map +1 -0
- package/dist/composition/quantities.js +1017 -0
- package/dist/composition/quantities.js.map +1 -0
- package/dist/composition/quantity.d.ts +59 -0
- package/dist/composition/quantity.d.ts.map +1 -0
- package/dist/composition/quantity.js +36 -0
- package/dist/composition/quantity.js.map +1 -0
- package/dist/composition/retrodiction.d.ts +94 -0
- package/dist/composition/retrodiction.d.ts.map +1 -0
- package/dist/composition/retrodiction.js +171 -0
- package/dist/composition/retrodiction.js.map +1 -0
- package/dist/composition/symbolic-constants.d.ts +33 -0
- package/dist/composition/symbolic-constants.d.ts.map +1 -0
- package/dist/composition/symbolic-constants.js +50 -0
- package/dist/composition/symbolic-constants.js.map +1 -0
- package/dist/composition/uncertainty.d.ts +45 -0
- package/dist/composition/uncertainty.d.ts.map +1 -0
- package/dist/composition/uncertainty.js +59 -0
- package/dist/composition/uncertainty.js.map +1 -0
- package/dist/core/axes-registry.d.ts +1 -1
- package/dist/core/axes-registry.js +1 -1
- package/dist/core/cell.d.ts +0 -8
- package/dist/core/cell.d.ts.map +1 -1
- package/dist/core/cell.js +1 -1
- package/dist/core/cell.js.map +1 -1
- package/dist/core/constants.d.ts +15 -1
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +15 -1
- package/dist/core/constants.js.map +1 -1
- package/dist/core/flux-rules.d.ts +10 -13
- package/dist/core/flux-rules.d.ts.map +1 -1
- package/dist/core/flux-rules.js +19 -10
- package/dist/core/flux-rules.js.map +1 -1
- package/dist/core/labeled-tensor.d.ts +80 -1
- package/dist/core/labeled-tensor.d.ts.map +1 -1
- package/dist/core/labeled-tensor.js +263 -17
- package/dist/core/labeled-tensor.js.map +1 -1
- package/dist/core/universal-index.d.ts +1 -1
- package/dist/core/universal-index.js +1 -1
- package/dist/diff/bridge-gradient.d.ts +51 -8
- package/dist/diff/bridge-gradient.d.ts.map +1 -1
- package/dist/diff/bridge-gradient.js +75 -8
- package/dist/diff/bridge-gradient.js.map +1 -1
- package/dist/dimensional/buckingham.d.ts +103 -0
- package/dist/dimensional/buckingham.d.ts.map +1 -0
- package/dist/dimensional/buckingham.js +284 -0
- package/dist/dimensional/buckingham.js.map +1 -0
- package/dist/dimensional/dimension-spec.d.ts +24 -0
- package/dist/dimensional/dimension-spec.d.ts.map +1 -0
- package/dist/dimensional/dimension-spec.js +110 -0
- package/dist/dimensional/dimension-spec.js.map +1 -0
- package/dist/dimensional/field-equation-helpers.d.ts +1 -1
- package/dist/dimensional/field-equation-helpers.js +1 -1
- package/dist/dimensional/friedmann-equation.d.ts +1 -1
- package/dist/dimensional/friedmann-equation.js +1 -1
- package/dist/dimensional/gauge-field.d.ts +1 -1
- package/dist/dimensional/gauge-field.js +1 -1
- package/dist/dimensional/klein-gordon-equation.d.ts +8 -5
- package/dist/dimensional/klein-gordon-equation.d.ts.map +1 -1
- package/dist/dimensional/klein-gordon-equation.js +8 -5
- package/dist/dimensional/klein-gordon-equation.js.map +1 -1
- package/dist/dimensional/tensor-trace.d.ts +1 -1
- package/dist/dimensional/tensor-trace.js +1 -1
- package/dist/dimensional/validator.d.ts +13 -3
- package/dist/dimensional/validator.d.ts.map +1 -1
- package/dist/dimensional/validator.js +129 -42
- package/dist/dimensional/validator.js.map +1 -1
- package/dist/index.d.ts +34 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -3
- package/dist/index.js.map +1 -1
- package/dist/numerical/be37-covariant-eikonal.d.ts.map +1 -1
- package/dist/numerical/be37-covariant-eikonal.js +15 -18
- package/dist/numerical/be37-covariant-eikonal.js.map +1 -1
- package/dist/numerical/curvature-lowering-helpers.d.ts +7 -13
- package/dist/numerical/curvature-lowering-helpers.d.ts.map +1 -1
- package/dist/numerical/curvature-lowering-helpers.js +1 -1
- package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
- package/dist/numerical/derivative-lowering.d.ts +2 -1
- package/dist/numerical/derivative-lowering.d.ts.map +1 -1
- package/dist/numerical/formula-dimension.d.ts +40 -0
- package/dist/numerical/formula-dimension.d.ts.map +1 -0
- package/dist/numerical/formula-dimension.js +199 -0
- package/dist/numerical/formula-dimension.js.map +1 -0
- package/dist/numerical/formula-mathts.d.ts +27 -0
- package/dist/numerical/formula-mathts.d.ts.map +1 -0
- package/dist/numerical/formula-mathts.js +98 -0
- package/dist/numerical/formula-mathts.js.map +1 -0
- package/dist/numerical/formula-registry.d.ts +30 -0
- package/dist/numerical/formula-registry.d.ts.map +1 -0
- package/dist/numerical/formula-registry.js +88 -0
- package/dist/numerical/formula-registry.js.map +1 -0
- package/dist/numerical/formula.d.ts +75 -0
- package/dist/numerical/formula.d.ts.map +1 -0
- package/dist/numerical/formula.js +275 -0
- package/dist/numerical/formula.js.map +1 -0
- package/dist/numerical/geometrized.d.ts +51 -0
- package/dist/numerical/geometrized.d.ts.map +1 -0
- package/dist/numerical/geometrized.js +66 -0
- package/dist/numerical/geometrized.js.map +1 -0
- package/dist/numerical/gl4-integrator.d.ts +8 -6
- package/dist/numerical/gl4-integrator.d.ts.map +1 -1
- package/dist/numerical/gl4-integrator.js +6 -6
- package/dist/numerical/gl4-integrator.js.map +1 -1
- package/dist/numerical/klein-gordon.d.ts +145 -0
- package/dist/numerical/klein-gordon.d.ts.map +1 -0
- package/dist/numerical/klein-gordon.js +145 -0
- package/dist/numerical/klein-gordon.js.map +1 -0
- package/dist/numerical/kretschmann.d.ts +43 -12
- package/dist/numerical/kretschmann.d.ts.map +1 -1
- package/dist/numerical/kretschmann.js +116 -29
- package/dist/numerical/kretschmann.js.map +1 -1
- package/dist/numerical/lowering.d.ts +18 -0
- package/dist/numerical/lowering.d.ts.map +1 -1
- package/dist/numerical/lowering.js +54 -42
- package/dist/numerical/lowering.js.map +1 -1
- package/dist/numerical/null-ic.d.ts +1 -1
- package/dist/numerical/null-ic.d.ts.map +1 -1
- package/dist/numerical/null-ic.js +3 -2
- package/dist/numerical/null-ic.js.map +1 -1
- package/dist/numerical/painleve-gullstrand-metric.d.ts +18 -6
- package/dist/numerical/painleve-gullstrand-metric.d.ts.map +1 -1
- package/dist/numerical/painleve-gullstrand-metric.js +31 -16
- package/dist/numerical/painleve-gullstrand-metric.js.map +1 -1
- package/dist/numerical/perihelion-finder.d.ts +4 -3
- package/dist/numerical/perihelion-finder.d.ts.map +1 -1
- package/dist/numerical/perihelion-finder.js +5 -4
- package/dist/numerical/perihelion-finder.js.map +1 -1
- package/dist/numerical/types.d.ts +6 -3
- package/dist/numerical/types.d.ts.map +1 -1
- package/dist/numerical/weyl-lowering.d.ts +4 -4
- package/dist/numerical/weyl-lowering.d.ts.map +1 -1
- package/dist/numerical/weyl-lowering.js +14 -1
- package/dist/numerical/weyl-lowering.js.map +1 -1
- package/package.json +19 -8
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Geometrized-units boundary adapters (G-9 increment 1).
|
|
3
|
+
*
|
|
4
|
+
* Converts a scalar between SI and geometrized (G = c = 1) units, driven
|
|
5
|
+
* MECHANICALLY by the `Dimension` exponent vector — the dimension functor
|
|
6
|
+
* earning its keep. For an SI quantity of dimension L^l M^m T^t the single
|
|
7
|
+
* conversion factor is `G^m · c^(t − 2m)` (each kg → G/c² metres, each second
|
|
8
|
+
* → c metres); the geometrized quantity is a pure length L^(l+m+t).
|
|
9
|
+
*
|
|
10
|
+
* This is the self-contained FOUNDATION of the units-normalization layer
|
|
11
|
+
* (design: docs/planning/v0.10.0-Units-Normalization-Design-Note.md, Adam-
|
|
12
|
+
* vetted r2; plan: docs/planning/v0.13-G9-Adapters-Plan.md, Eve-vetted). Only c
|
|
13
|
+
* and G are in scope: a nonzero electromagnetic / thermal / molar / luminous
|
|
14
|
+
* exponent (I/Θ/N/J) throws.
|
|
15
|
+
*
|
|
16
|
+
* PUBLIC boundary API (G-9 increment 2): a consumer running the GR pipeline in
|
|
17
|
+
* geometrized (G = c = 1) units converts scalars at the boundary with these
|
|
18
|
+
* adapters. The consumer-wide DEFAULT-pipeline migration (increment 3) was
|
|
19
|
+
* DECLINED after adversarial review — it is measured to give no precision win
|
|
20
|
+
* (and far worse far-field; see docs/planning/v0.14-G9-Increment3-Disposition.md).
|
|
21
|
+
* The SI pipeline stays the default; this geometrized layer is the optional
|
|
22
|
+
* boundary API.
|
|
23
|
+
*
|
|
24
|
+
* @module numerical/geometrized
|
|
25
|
+
*/
|
|
26
|
+
import { UPTError } from '../dimensional/errors.js';
|
|
27
|
+
import { C_SI, G_SI } from '../core/constants.js';
|
|
28
|
+
/**
|
|
29
|
+
* A dimension carries a non-c/G base (I/Θ/N/J ≠ 0) and cannot be geometrized
|
|
30
|
+
* by c and G alone (k_B / ε₀ extensions are out of scope for this increment).
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export class NonGeometrizableDimensionError extends UPTError {
|
|
35
|
+
constructor(message) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.name = 'NonGeometrizableDimensionError';
|
|
38
|
+
Object.setPrototypeOf(this, NonGeometrizableDimensionError.prototype);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The single SI→geometrized conversion factor for `dim`: `G^M · c^(T − 2M)`
|
|
43
|
+
* (only the mass and time exponents enter). Shared by `toGeometrized` /
|
|
44
|
+
* `fromGeometrized` so the round-trip is a clean inverse. A nonzero I/Θ/N/J
|
|
45
|
+
* exponent throws `NonGeometrizableDimensionError` BEFORE any factor is
|
|
46
|
+
* computed.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export function geometrizedFactor(dim) {
|
|
51
|
+
if (dim.I !== 0 || dim.Theta !== 0 || dim.N !== 0 || dim.J !== 0) {
|
|
52
|
+
throw new NonGeometrizableDimensionError(`geometrizedFactor: only c and G are in scope; this dimension has a ` +
|
|
53
|
+
`nonzero non-mechanizable exponent (I=${dim.I}, Θ=${dim.Theta}, ` +
|
|
54
|
+
`N=${dim.N}, J=${dim.J}). Geometrization handles length / mass / time.`);
|
|
55
|
+
}
|
|
56
|
+
return Math.pow(G_SI, dim.M) * Math.pow(C_SI, dim.T - 2 * dim.M);
|
|
57
|
+
}
|
|
58
|
+
/** SI → geometrized (G = c = 1). @public */
|
|
59
|
+
export function toGeometrized(valueSI, dim) {
|
|
60
|
+
return valueSI * geometrizedFactor(dim);
|
|
61
|
+
}
|
|
62
|
+
/** Geometrized (G = c = 1) → SI. @public */
|
|
63
|
+
export function fromGeometrized(valueGeom, dim) {
|
|
64
|
+
return valueGeom / geometrizedFactor(dim);
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=geometrized.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometrized.js","sourceRoot":"","sources":["../../src/numerical/geometrized.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,OAA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verse-metric closure
|
|
75
|
-
|
|
74
|
+
/** Inverse-metric closure (v0.9.0 O-1 flat layout):
|
|
75
|
+
* `gInverseFn(x)[μ*dim + ν] = g^{μν}(x)`, row-major Float64Array(dim²). */
|
|
76
|
+
readonly gInverseFn: (x: readonly number[]) => Float64Array;
|
|
76
77
|
/**
|
|
77
78
|
* Partial derivatives of the inverse metric.
|
|
78
|
-
* Index order
|
|
79
|
+
* Index order (v0.9.0 O-1 flat layout):
|
|
80
|
+
* `dgInverseFn(x)[lambda*dim² + mu*dim + nu] = ∂_lambda g^{mu nu}` at coords x.
|
|
79
81
|
* (I2: axis semantics pinned here to prevent silent transposition bugs.)
|
|
80
82
|
*/
|
|
81
|
-
readonly dgInverseFn: (x: readonly number[]) =>
|
|
83
|
+
readonly dgInverseFn: (x: readonly number[]) => Float64Array;
|
|
82
84
|
/** Picard fixed-point tolerance (default chosen in Task 2). */
|
|
83
85
|
readonly picardTol?: number;
|
|
84
86
|
/** Picard fixed-point iteration cap (default chosen in Task 2). */
|
|
@@ -141,7 +143,7 @@ interface StageSolveResult {
|
|
|
141
143
|
* The `dgInverseFn` index order is `dg[λ][μ][ν] = ∂_λ g^{μν}` (Task 0 I2
|
|
142
144
|
* pin, also recorded on `GL4Options.dgInverseFn`). When we evaluate
|
|
143
145
|
* `dp_μ = −½ (∂_μ g^{νρ}) P_ν P_ρ` we therefore read
|
|
144
|
-
* `dgInvAtXj[mu
|
|
146
|
+
* `dgInvAtXj[mu*dim²+nu*dim+rho]` — `mu` is the differentiation axis (λ in the
|
|
145
147
|
* pinned order) and `(nu, rho)` are the upper metric indices.
|
|
146
148
|
*
|
|
147
149
|
* Throws `GL4ConvergenceError` with message matching
|
|
@@ -149,7 +151,7 @@ interface StageSolveResult {
|
|
|
149
151
|
*
|
|
150
152
|
* @internal
|
|
151
153
|
*/
|
|
152
|
-
export declare function solveGL4Stage(state: GL4State, h: number, gInverseFn: (x: readonly number[]) =>
|
|
154
|
+
export declare function solveGL4Stage(state: GL4State, h: number, gInverseFn: (x: readonly number[]) => Float64Array, dgInverseFn: (x: readonly number[]) => Float64Array, opts: {
|
|
153
155
|
picardTol: number;
|
|
154
156
|
picardMaxIter: number;
|
|
155
157
|
}): StageSolveResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gl4-integrator.d.ts","sourceRoot":"","sources":["../../src/numerical/gl4-integrator.ts"],"names":[],"mappings":"AA6BA;;;;;;;;GAQG;AACH,eAAO,MAAM,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAA4C,CAAC;AAEzF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAGjF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAc,CAAC;AAE3D;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,QAAQ;IACvB,+BAA+B;IAC/B,QAAQ,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,yCAAyC;IACzC,QAAQ,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,QAAQ,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB;qCACiC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB
|
|
1
|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Q,EACtB,OAAO,EAAE,UAAU,GAClB,SAAS,WAAW,EAAE,CA4DxB"}
|
|
@@ -77,7 +77,7 @@ export const GL4_B = [0.5, 0.5];
|
|
|
77
77
|
* The `dgInverseFn` index order is `dg[λ][μ][ν] = ∂_λ g^{μν}` (Task 0 I2
|
|
78
78
|
* pin, also recorded on `GL4Options.dgInverseFn`). When we evaluate
|
|
79
79
|
* `dp_μ = −½ (∂_μ g^{νρ}) P_ν P_ρ` we therefore read
|
|
80
|
-
* `dgInvAtXj[mu
|
|
80
|
+
* `dgInvAtXj[mu*dim²+nu*dim+rho]` — `mu` is the differentiation axis (λ in the
|
|
81
81
|
* pinned order) and `(nu, rho)` are the upper metric indices.
|
|
82
82
|
*
|
|
83
83
|
* Throws `GL4ConvergenceError` with message matching
|
|
@@ -118,15 +118,15 @@ export function solveGL4Stage(state, h, gInverseFn, dgInverseFn, opts) {
|
|
|
118
118
|
// dx^μ contribution: + h · a_{ij} · Σ_ν g^{μν}(X_j) P_{j,ν}
|
|
119
119
|
let dxStage = 0;
|
|
120
120
|
for (let nu = 0; nu < dim; nu++) {
|
|
121
|
-
dxStage += gInvAtXj[mu
|
|
121
|
+
dxStage += gInvAtXj[mu * dim + nu] * P[j][nu];
|
|
122
122
|
}
|
|
123
123
|
xAccum += h * GL4_A[i][j] * dxStage;
|
|
124
124
|
// dp_μ contribution: − h · a_{ij} · ½ Σ_{νρ} (∂_μ g^{νρ})(X_j) P_{j,ν} P_{j,ρ}
|
|
125
|
-
// I2 pin: dgInvAtXj[mu
|
|
125
|
+
// I2 pin: dgInvAtXj[mu*dim²+nu*dim+rho] = ∂_mu g^{nu rho}.
|
|
126
126
|
let dpStage = 0;
|
|
127
127
|
for (let nu = 0; nu < dim; nu++) {
|
|
128
128
|
for (let rho = 0; rho < dim; rho++) {
|
|
129
|
-
dpStage += dgInvAtXj[mu
|
|
129
|
+
dpStage += dgInvAtXj[mu * dim * dim + nu * dim + rho] * P[j][nu] * P[j][rho];
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
pAccum -= h * GL4_A[i][j] * 0.5 * dpStage;
|
|
@@ -179,7 +179,7 @@ function updateFromStages(xPrev, h, stageX, stageP, gInverseFn) {
|
|
|
179
179
|
const gInv = gInverseFn(stageX[i]);
|
|
180
180
|
let xDot = 0;
|
|
181
181
|
for (let nu = 0; nu < dim; nu++) {
|
|
182
|
-
xDot += gInv[mu
|
|
182
|
+
xDot += gInv[mu * dim + nu] * stageP[i][nu];
|
|
183
183
|
}
|
|
184
184
|
delta += GL4_B[i] * xDot;
|
|
185
185
|
}
|
|
@@ -210,7 +210,7 @@ function updateMomentumFromStages(pPrev, h, stageX, stageP, dgInverseFn) {
|
|
|
210
210
|
let pDot = 0;
|
|
211
211
|
for (let nu = 0; nu < dim; nu++) {
|
|
212
212
|
for (let rho = 0; rho < dim; rho++) {
|
|
213
|
-
pDot += dg[mu
|
|
213
|
+
pDot += dg[mu * dim * dim + nu * dim + rho] * stageP[i][nu] * stageP[i][rho];
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
delta += GL4_B[i] * (-0.5 * pDot);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gl4-integrator.js","sourceRoot":"","sources":["../../src/numerical/gl4-integrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzE,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,KAAK,GAA8B,CAAC,GAAG,GAAG,YAAY,EAAE,GAAG,GAAG,YAAY,CAAC,CAAC;AAEzF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,KAAK,GAAoE;IACpF,CAAC,IAAI,EAAE,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC,IAA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,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE;oBAC/D,SAAS;oBACT,aAAa;iBACd,CAAC,CAAC;gBACH,aAAa,GAAG,IAAI,CAAC;gBACrB,MAAM;YACR,CAAC;YAAC,MAAM,CAAC;gBACP,KAAK,IAAI,CAAC,CAAC;gBACX,QAAQ,EAAE,CAAC;YACb,CAAC;QACH,CAAC;QACD,IAAI,CAAC,aAAa,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC3C,MAAM,IAAI,mBAAmB,CAC3B,mEAAmE,MAAM,UAAU,CAAC,8CAA8C,CACnI,CAAC;QACJ,CAAC;QACD,CAAC,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QACrE,CAAC,GAAG,wBAAwB,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAC9E,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACjE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Klein-Gordon dispersion-relation numerical evaluator (G-7 debt closure).
|
|
3
|
+
*
|
|
4
|
+
* Companion to the symbolic predicate `KleinGordonEquationNode`
|
|
5
|
+
* (`src/dimensional/klein-gordon-equation.ts`, Part-X §X.5): the predicate
|
|
6
|
+
* pins structure + dimensions of `(□ + m²)φ = J`; this module supplies the
|
|
7
|
+
* numerical content for the *free-field plane-wave sector*.
|
|
8
|
+
*
|
|
9
|
+
* A plane wave φ ~ exp(i(k·x − ωt)) solves the free Klein-Gordon equation
|
|
10
|
+
* `(□ + m²)φ = 0` iff the dispersion relation holds
|
|
11
|
+
* (Peskin & Schroeder 1995, *An Introduction to Quantum Field Theory*,
|
|
12
|
+
* §2.1 — ω_k² = |k|² + m² in natural units; restoring SI factors):
|
|
13
|
+
*
|
|
14
|
+
* ω² = c² k² + (m c² / ℏ)²
|
|
15
|
+
*
|
|
16
|
+
* where ω_C = m c² / ℏ is the (angular) Compton frequency of the field
|
|
17
|
+
* quantum. The evaluator returns the **scale-normalized residual**
|
|
18
|
+
*
|
|
19
|
+
* r = (ω² − c²k² − ω_C²) / (ω² + c²k² + ω_C²)
|
|
20
|
+
*
|
|
21
|
+
* which is dimensionless, bounded in (−1, 1), and zero iff the plane wave
|
|
22
|
+
* solves the free KG equation — the same residual-normalization discipline
|
|
23
|
+
* as `evaluateEinsteinEquationResidual` (src/numerical/einstein-equation.ts),
|
|
24
|
+
* adapted to the algebraic (no-FD) plane-wave case.
|
|
25
|
+
*
|
|
26
|
+
* Scope note (honesty policy): this closes the dispersion-relation slice of
|
|
27
|
+
* the missing-evaluator debt only. A full finite-difference wave-operator
|
|
28
|
+
* evaluator `□φ` on coordinate grids (the analogue of the curvature lowering
|
|
29
|
+
* pipeline) remains future work.
|
|
30
|
+
*
|
|
31
|
+
* @module numerical/klein-gordon
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Input bag for {@link evaluateKGDispersionResidual}.
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
export interface KGDispersionResidualInput {
|
|
39
|
+
/** Angular frequency ω of the plane wave (rad/s). Must be > 0 and finite. */
|
|
40
|
+
readonly omega_per_s: number;
|
|
41
|
+
/** Wavenumber magnitude |k| (m⁻¹). Must be ≥ 0 and finite. */
|
|
42
|
+
readonly k_per_m: number;
|
|
43
|
+
/** Field-quantum mass m (kg). Must be ≥ 0 and finite (0 = massless field). */
|
|
44
|
+
readonly mass_kg: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Input bag for {@link verifyKleinGordonPlaneWave}.
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
export interface KGPlaneWaveVerifyInput {
|
|
52
|
+
/** Field-quantum mass m (kg). Must be ≥ 0 and finite (0 = massless field). */
|
|
53
|
+
readonly mass_kg: number;
|
|
54
|
+
/** Wavenumber magnitude |k| (m⁻¹). Must be ≥ 0 and finite. */
|
|
55
|
+
readonly k_per_m: number;
|
|
56
|
+
/**
|
|
57
|
+
* Maximum tolerated |residual| for the closure check.
|
|
58
|
+
* Default 1e-12 (the algebraic round-trip lands at the few-ULP level,
|
|
59
|
+
* ≲ 1e-15; 1e-12 leaves ~3 orders of headroom, mirroring the
|
|
60
|
+
* measure-then-lock convention of `verifyKillingEquation`).
|
|
61
|
+
*/
|
|
62
|
+
readonly tolerance?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Result of {@link verifyKleinGordonPlaneWave}.
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export interface KGPlaneWaveVerifyResult {
|
|
70
|
+
/** The exact dispersion root ω = √(c²k² + (mc²/ℏ)²) (rad/s). */
|
|
71
|
+
readonly omega_per_s: number;
|
|
72
|
+
/** Scale-normalized dispersion residual at the constructed ω (dimensionless). */
|
|
73
|
+
readonly residual: number;
|
|
74
|
+
/** Whether |residual| ≤ tolerance. */
|
|
75
|
+
readonly withinTolerance: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Evaluate the dimensionless free-field Klein-Gordon dispersion residual
|
|
79
|
+
*
|
|
80
|
+
* r = (ω² − c²k² − (m c²/ℏ)²) / (ω² + c²k² + (m c²/ℏ)²)
|
|
81
|
+
*
|
|
82
|
+
* r = 0 iff the plane wave φ ~ exp(i(k·x − ωt)) solves the free KG equation
|
|
83
|
+
* (□ + m²)φ = 0 — i.e. iff ω² = c²k² + (mc²/ℏ)² (Peskin & Schroeder 1995
|
|
84
|
+
* §2.1, ω_k² = |k|² + m² in natural units, SI factors restored).
|
|
85
|
+
*
|
|
86
|
+
* The denominator ω² + c²k² + ω_C² is strictly positive on the validated
|
|
87
|
+
* domain (ω > 0), so r is well-defined, dimensionless, and bounded in
|
|
88
|
+
* (−1, 1): r → +1 for ω far above the mass shell, r → −1 far below.
|
|
89
|
+
*
|
|
90
|
+
* @param input - ω (rad/s, > 0), |k| (m⁻¹, ≥ 0), m (kg, ≥ 0).
|
|
91
|
+
* @returns Dimensionless residual r ∈ (−1, 1); 0 on the mass shell.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* import { evaluateKGDispersionResidual } from 'universal-physics-tensor/numerical/klein-gordon';
|
|
96
|
+
* import { C_SI } from 'universal-physics-tensor';
|
|
97
|
+
*
|
|
98
|
+
* // Massless field: ω = ck is exactly on shell.
|
|
99
|
+
* const k = 1e7; // m⁻¹
|
|
100
|
+
* const r = evaluateKGDispersionResidual({
|
|
101
|
+
* omega_per_s: C_SI * k,
|
|
102
|
+
* k_per_m: k,
|
|
103
|
+
* mass_kg: 0,
|
|
104
|
+
* });
|
|
105
|
+
* // r === 0
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @public
|
|
109
|
+
*/
|
|
110
|
+
export declare function evaluateKGDispersionResidual(input: KGDispersionResidualInput): number;
|
|
111
|
+
/**
|
|
112
|
+
* Closure check for the free Klein-Gordon plane-wave sector (the algebraic
|
|
113
|
+
* analogue of `verifyKillingEquation`'s residual-plus-tolerance pattern):
|
|
114
|
+
* construct the exact positive dispersion root
|
|
115
|
+
*
|
|
116
|
+
* ω = √(c²k² + (m c²/ℏ)²)
|
|
117
|
+
*
|
|
118
|
+
* (Peskin & Schroeder 1995 §2.1) and feed it back through
|
|
119
|
+
* {@link evaluateKGDispersionResidual}, verifying the residual closes to ~0.
|
|
120
|
+
* Round-trip error is pure IEEE-754 rounding (one sqrt + one squaring over
|
|
121
|
+
* identical intermediates), so |residual| lands at the few-ULP level.
|
|
122
|
+
*
|
|
123
|
+
* Degenerate-domain guard: `mass_kg` and `k_per_m` must not both be zero
|
|
124
|
+
* (ω = 0 is outside the evaluator's ω > 0 domain — there is no zero-frequency
|
|
125
|
+
* plane wave).
|
|
126
|
+
*
|
|
127
|
+
* @param input - m (kg, ≥ 0), |k| (m⁻¹, ≥ 0), optional tolerance (default 1e-12).
|
|
128
|
+
* @returns `{ omega_per_s, residual, withinTolerance }`.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* import { verifyKleinGordonPlaneWave } from 'universal-physics-tensor/numerical/klein-gordon';
|
|
133
|
+
*
|
|
134
|
+
* // Electron-mass scalar at k = 1e10 m⁻¹.
|
|
135
|
+
* const { omega_per_s, residual, withinTolerance } = verifyKleinGordonPlaneWave({
|
|
136
|
+
* mass_kg: 9.1093837015e-31,
|
|
137
|
+
* k_per_m: 1e10,
|
|
138
|
+
* });
|
|
139
|
+
* // omega_per_s ≈ 7.83e20 rad/s, |residual| ≲ 1e-15, withinTolerance === true
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @public
|
|
143
|
+
*/
|
|
144
|
+
export declare function verifyKleinGordonPlaneWave(input: KGPlaneWaveVerifyInput): KGPlaneWaveVerifyResult;
|
|
145
|
+
//# sourceMappingURL=klein-gordon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"klein-gordon.d.ts","sourceRoot":"","sources":["../../src/numerical/klein-gordon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAKH;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,6EAA6E;IAC7E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,gEAAgE;IAChE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,sCAAsC;IACtC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,yBAAyB,GAC/B,MAAM,CAoBR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,sBAAsB,GAC5B,uBAAuB,CAyCzB"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Klein-Gordon dispersion-relation numerical evaluator (G-7 debt closure).
|
|
3
|
+
*
|
|
4
|
+
* Companion to the symbolic predicate `KleinGordonEquationNode`
|
|
5
|
+
* (`src/dimensional/klein-gordon-equation.ts`, Part-X §X.5): the predicate
|
|
6
|
+
* pins structure + dimensions of `(□ + m²)φ = J`; this module supplies the
|
|
7
|
+
* numerical content for the *free-field plane-wave sector*.
|
|
8
|
+
*
|
|
9
|
+
* A plane wave φ ~ exp(i(k·x − ωt)) solves the free Klein-Gordon equation
|
|
10
|
+
* `(□ + m²)φ = 0` iff the dispersion relation holds
|
|
11
|
+
* (Peskin & Schroeder 1995, *An Introduction to Quantum Field Theory*,
|
|
12
|
+
* §2.1 — ω_k² = |k|² + m² in natural units; restoring SI factors):
|
|
13
|
+
*
|
|
14
|
+
* ω² = c² k² + (m c² / ℏ)²
|
|
15
|
+
*
|
|
16
|
+
* where ω_C = m c² / ℏ is the (angular) Compton frequency of the field
|
|
17
|
+
* quantum. The evaluator returns the **scale-normalized residual**
|
|
18
|
+
*
|
|
19
|
+
* r = (ω² − c²k² − ω_C²) / (ω² + c²k² + ω_C²)
|
|
20
|
+
*
|
|
21
|
+
* which is dimensionless, bounded in (−1, 1), and zero iff the plane wave
|
|
22
|
+
* solves the free KG equation — the same residual-normalization discipline
|
|
23
|
+
* as `evaluateEinsteinEquationResidual` (src/numerical/einstein-equation.ts),
|
|
24
|
+
* adapted to the algebraic (no-FD) plane-wave case.
|
|
25
|
+
*
|
|
26
|
+
* Scope note (honesty policy): this closes the dispersion-relation slice of
|
|
27
|
+
* the missing-evaluator debt only. A full finite-difference wave-operator
|
|
28
|
+
* evaluator `□φ` on coordinate grids (the analogue of the curvature lowering
|
|
29
|
+
* pipeline) remains future work.
|
|
30
|
+
*
|
|
31
|
+
* @module numerical/klein-gordon
|
|
32
|
+
*/
|
|
33
|
+
import { C_SI, HBAR_SI } from '../core/constants.js';
|
|
34
|
+
import { validateFiniteInputs } from '../bridges/equations/_be-helpers.js';
|
|
35
|
+
/**
|
|
36
|
+
* Evaluate the dimensionless free-field Klein-Gordon dispersion residual
|
|
37
|
+
*
|
|
38
|
+
* r = (ω² − c²k² − (m c²/ℏ)²) / (ω² + c²k² + (m c²/ℏ)²)
|
|
39
|
+
*
|
|
40
|
+
* r = 0 iff the plane wave φ ~ exp(i(k·x − ωt)) solves the free KG equation
|
|
41
|
+
* (□ + m²)φ = 0 — i.e. iff ω² = c²k² + (mc²/ℏ)² (Peskin & Schroeder 1995
|
|
42
|
+
* §2.1, ω_k² = |k|² + m² in natural units, SI factors restored).
|
|
43
|
+
*
|
|
44
|
+
* The denominator ω² + c²k² + ω_C² is strictly positive on the validated
|
|
45
|
+
* domain (ω > 0), so r is well-defined, dimensionless, and bounded in
|
|
46
|
+
* (−1, 1): r → +1 for ω far above the mass shell, r → −1 far below.
|
|
47
|
+
*
|
|
48
|
+
* @param input - ω (rad/s, > 0), |k| (m⁻¹, ≥ 0), m (kg, ≥ 0).
|
|
49
|
+
* @returns Dimensionless residual r ∈ (−1, 1); 0 on the mass shell.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* import { evaluateKGDispersionResidual } from 'universal-physics-tensor/numerical/klein-gordon';
|
|
54
|
+
* import { C_SI } from 'universal-physics-tensor';
|
|
55
|
+
*
|
|
56
|
+
* // Massless field: ω = ck is exactly on shell.
|
|
57
|
+
* const k = 1e7; // m⁻¹
|
|
58
|
+
* const r = evaluateKGDispersionResidual({
|
|
59
|
+
* omega_per_s: C_SI * k,
|
|
60
|
+
* k_per_m: k,
|
|
61
|
+
* mass_kg: 0,
|
|
62
|
+
* });
|
|
63
|
+
* // r === 0
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
export function evaluateKGDispersionResidual(input) {
|
|
69
|
+
validateFiniteInputs(input, [
|
|
70
|
+
{ name: 'omega_per_s', min: 0, excludeMin: true },
|
|
71
|
+
{ name: 'k_per_m', min: 0 },
|
|
72
|
+
{ name: 'mass_kg', min: 0 },
|
|
73
|
+
], 'evaluateKGDispersionResidual');
|
|
74
|
+
const { omega_per_s, k_per_m, mass_kg } = input;
|
|
75
|
+
const omega2 = omega_per_s * omega_per_s;
|
|
76
|
+
const ck = C_SI * k_per_m;
|
|
77
|
+
const ck2 = ck * ck;
|
|
78
|
+
// Compton angular frequency ω_C = m c² / ℏ (rad/s).
|
|
79
|
+
const omegaC = (mass_kg * C_SI * C_SI) / HBAR_SI;
|
|
80
|
+
const omegaC2 = omegaC * omegaC;
|
|
81
|
+
return (omega2 - ck2 - omegaC2) / (omega2 + ck2 + omegaC2);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Closure check for the free Klein-Gordon plane-wave sector (the algebraic
|
|
85
|
+
* analogue of `verifyKillingEquation`'s residual-plus-tolerance pattern):
|
|
86
|
+
* construct the exact positive dispersion root
|
|
87
|
+
*
|
|
88
|
+
* ω = √(c²k² + (m c²/ℏ)²)
|
|
89
|
+
*
|
|
90
|
+
* (Peskin & Schroeder 1995 §2.1) and feed it back through
|
|
91
|
+
* {@link evaluateKGDispersionResidual}, verifying the residual closes to ~0.
|
|
92
|
+
* Round-trip error is pure IEEE-754 rounding (one sqrt + one squaring over
|
|
93
|
+
* identical intermediates), so |residual| lands at the few-ULP level.
|
|
94
|
+
*
|
|
95
|
+
* Degenerate-domain guard: `mass_kg` and `k_per_m` must not both be zero
|
|
96
|
+
* (ω = 0 is outside the evaluator's ω > 0 domain — there is no zero-frequency
|
|
97
|
+
* plane wave).
|
|
98
|
+
*
|
|
99
|
+
* @param input - m (kg, ≥ 0), |k| (m⁻¹, ≥ 0), optional tolerance (default 1e-12).
|
|
100
|
+
* @returns `{ omega_per_s, residual, withinTolerance }`.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* import { verifyKleinGordonPlaneWave } from 'universal-physics-tensor/numerical/klein-gordon';
|
|
105
|
+
*
|
|
106
|
+
* // Electron-mass scalar at k = 1e10 m⁻¹.
|
|
107
|
+
* const { omega_per_s, residual, withinTolerance } = verifyKleinGordonPlaneWave({
|
|
108
|
+
* mass_kg: 9.1093837015e-31,
|
|
109
|
+
* k_per_m: 1e10,
|
|
110
|
+
* });
|
|
111
|
+
* // omega_per_s ≈ 7.83e20 rad/s, |residual| ≲ 1e-15, withinTolerance === true
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
export function verifyKleinGordonPlaneWave(input) {
|
|
117
|
+
validateFiniteInputs(input, [
|
|
118
|
+
{ name: 'mass_kg', min: 0 },
|
|
119
|
+
{ name: 'k_per_m', min: 0 },
|
|
120
|
+
], 'verifyKleinGordonPlaneWave');
|
|
121
|
+
if (input.tolerance !== undefined) {
|
|
122
|
+
validateFiniteInputs(input, [{ name: 'tolerance', min: 0, excludeMin: true }], 'verifyKleinGordonPlaneWave');
|
|
123
|
+
}
|
|
124
|
+
const { mass_kg, k_per_m } = input;
|
|
125
|
+
if (mass_kg === 0 && k_per_m === 0) {
|
|
126
|
+
throw new RangeError('verifyKleinGordonPlaneWave: mass_kg and k_per_m must not both be zero (degenerate ω = 0 has no plane-wave solution)');
|
|
127
|
+
}
|
|
128
|
+
const tolerance = input.tolerance ?? 1e-12;
|
|
129
|
+
// Same intermediates as the residual evaluator (ck, ω_C) so the round-trip
|
|
130
|
+
// cancels to the IEEE-754 floor rather than accumulating re-association noise.
|
|
131
|
+
const ck = C_SI * k_per_m;
|
|
132
|
+
const omegaC = (mass_kg * C_SI * C_SI) / HBAR_SI;
|
|
133
|
+
const omega_per_s = Math.sqrt(ck * ck + omegaC * omegaC);
|
|
134
|
+
const residual = evaluateKGDispersionResidual({
|
|
135
|
+
omega_per_s,
|
|
136
|
+
k_per_m,
|
|
137
|
+
mass_kg,
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
omega_per_s,
|
|
141
|
+
residual,
|
|
142
|
+
withinTolerance: Math.abs(residual) <= tolerance,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=klein-gordon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"klein-gordon.js","sourceRoot":"","sources":["../../src/numerical/klein-gordon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B,CAC7B,CAAC;IACF,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QAClC,oBAAoB,CAClB,KAAK,EACL,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EACjD,4BAA4B,CAC7B,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACnC,IAAI,OAAO,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,UAAU,CAClB,qHAAqH,CACtH,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC;IAE3C,2EAA2E;IAC3E,+EAA+E;IAC/E,MAAM,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC;IAC1B,MAAM,MAAM,GAAG,CAAC,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC;IACjD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;IAEzD,MAAM,QAAQ,GAAG,4BAA4B,CAAC;QAC5C,WAAW;QACX,OAAO;QACP,OAAO;KACR,CAAC,CAAC;IAEH,OAAO;QACL,WAAW;QACX,QAAQ;QACR,eAAe,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,SAAS;KACjD,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Kretschmann scalar numerical contraction (v0.6.0 Phase 3, Task 3.6
|
|
2
|
+
* Kretschmann scalar numerical contraction (v0.6.0 Phase 3, Task 3.6;
|
|
3
|
+
* factored-raising optimization 2026-06-11).
|
|
3
4
|
*
|
|
4
5
|
* Computes K = R_{ρσμν} R^{ρσμν} from the fully-lowered Riemann tensor and
|
|
5
6
|
* the inverse metric by raising all four indices on the second Riemann factor.
|
|
6
7
|
*
|
|
7
|
-
* **PERFORMANCE
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* **PERFORMANCE (2026-06-11 optimization)**: the original implementation
|
|
9
|
+
* raised all four indices inside the contraction loop — O(4⁸) = 65536
|
|
10
|
+
* inner products (~327k multiplications). The current implementation
|
|
11
|
+
* factors the four-index raise into FOUR successive single-index raisings
|
|
12
|
+
* (4 × 4⁵ = 4096 multiply-adds) plus one 256-term contraction — a ~70×
|
|
13
|
+
* reduction in multiplications that is EXACT for arbitrary input (pure
|
|
14
|
+
* reassociation of the sums; no Riemann-symmetry assumption). See the
|
|
15
|
+
* algorithm notes inside {@link computeKretschmann}.
|
|
13
16
|
*
|
|
14
17
|
* @module numerical/kretschmann
|
|
15
18
|
*/
|
|
@@ -19,15 +22,43 @@
|
|
|
19
22
|
* Algorithm:
|
|
20
23
|
* 1. Raise all four indices on the second Riemann factor:
|
|
21
24
|
* R^{ρσμν} = g^{ρα} g^{σβ} g^{μγ} g^{νδ} R_{αβγδ}
|
|
25
|
+
* — factored as four successive single-index raisings (see below).
|
|
22
26
|
* 2. Contract:
|
|
23
27
|
* K = Σ_{ρσμν} R_{ρσμν} · R^{ρσμν}
|
|
24
28
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
29
|
+
* **Factored raising (exact, input-shape-agnostic).** The naive raise is a
|
|
30
|
+
* rank-8 contraction, O(4⁸). Because the four metric factors each touch a
|
|
31
|
+
* single Riemann index, the sum factors exactly:
|
|
32
|
+
*
|
|
33
|
+
* T1^ρ_{βγδ} = g^{ρα} R_{αβγδ} (axis-0 raise, 4⁵ = 1024 mult-adds)
|
|
34
|
+
* T2^{ρσ}_{γδ} = g^{σβ} T1^ρ_{βγδ} (axis-1 raise, 1024)
|
|
35
|
+
* T3^{ρσμ}_δ = g^{μγ} T2^{ρσ}_{γδ} (axis-2 raise, 1024)
|
|
36
|
+
* R^{ρσμν} = g^{νδ} T3^{ρσμ}_δ (axis-3 raise, 1024)
|
|
37
|
+
*
|
|
38
|
+
* This is a pure reassociation of the quadruple sum — mathematically
|
|
39
|
+
* identical for ARBITRARY (even non-antisymmetric) `riemannLower` input,
|
|
40
|
+
* which matters because the FD-built Riemann is only approximately
|
|
41
|
+
* antisymmetric.
|
|
42
|
+
*
|
|
43
|
+
* **Rejected alternative — symmetry pair-iteration.** Under EXACT Riemann
|
|
44
|
+
* antisymmetry (R_{ρσμν} = −R_{σρμν} = −R_{ρσνμ}) all components with
|
|
45
|
+
* ρ = σ or μ = ν vanish and the survivors come in sign-pairs, so the
|
|
46
|
+
* contraction collapses to the 6×6 independent index PAIRS:
|
|
47
|
+
*
|
|
48
|
+
* K = 4 · Σ_{ρ<σ} Σ_{μ<ν} R_{ρσμν} R^{ρσμν}
|
|
49
|
+
*
|
|
50
|
+
* (each unordered pair contributes 4 ordered combinations whose sign
|
|
51
|
+
* factors square away: (−1)·(−1) = +1). That formula is NOT identical to
|
|
52
|
+
* the full sum for arbitrary input — the FD pipeline produces small
|
|
53
|
+
* antisymmetry violations — so it was rejected in favour of the factored
|
|
54
|
+
* raise, which needs no input-symmetry assumption.
|
|
27
55
|
*
|
|
28
56
|
* @param riemannLower - R_{ρσμν}: all-lower Riemann tensor, shape [4][4][4][4].
|
|
29
57
|
* Obtain by lowering R^ρ_{σμν} via g_{ρα}: R_{αβγδ} = g_{αρ} R^ρ_{βγδ}.
|
|
30
|
-
* @param metricInverse - g^{αβ}: inverse metric
|
|
58
|
+
* @param metricInverse - g^{αβ}: inverse metric. Either nested `number[][]`
|
|
59
|
+
* (shape [4][4]) or row-major `Float64Array(16)` with `flat[mu*4 + nu]`
|
|
60
|
+
* (the v0.9.0 fixture layout). Normalized ONCE at entry — O-4 widening,
|
|
61
|
+
* non-breaking for existing nested callers.
|
|
31
62
|
* @returns K, a scalar. Dimension [L⁻⁴] (Riemann is [L⁻²] per F8/I3 convention).
|
|
32
63
|
*
|
|
33
64
|
* @example
|
|
@@ -48,7 +79,7 @@
|
|
|
48
79
|
*
|
|
49
80
|
* const engine = new Float64ReferenceEngine();
|
|
50
81
|
* const rLower = riemannLowerAt(x, schwarzschildGFn(M), schwarzschildGInverseFn(M), 4, engine);
|
|
51
|
-
* const gInv = schwarzschildGInverseFn(M)(x);
|
|
82
|
+
* const gInv = schwarzschildGInverseFn(M)(x); // Float64Array(16) — accepted directly
|
|
52
83
|
* const K = computeKretschmann(rLower, gInv);
|
|
53
84
|
*
|
|
54
85
|
* // Schwarzschild closed-form: K = 48 G² M² / (c⁴ r⁶)
|
|
@@ -58,5 +89,5 @@
|
|
|
58
89
|
*
|
|
59
90
|
* @public
|
|
60
91
|
*/
|
|
61
|
-
export declare function computeKretschmann(riemannLower: number[][][][], metricInverse: number[][]): number;
|
|
92
|
+
export declare function computeKretschmann(riemannLower: number[][][][], metricInverse: number[][] | Float64Array): number;
|
|
62
93
|
//# sourceMappingURL=kretschmann.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kretschmann.d.ts","sourceRoot":"","sources":["../../src/numerical/kretschmann.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"kretschmann.d.ts","sourceRoot":"","sources":["../../src/numerical/kretschmann.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAC5B,aAAa,EAAE,MAAM,EAAE,EAAE,GAAG,YAAY,GACvC,MAAM,CAsFR"}
|