universal-physics-tensor 1.0.3 → 2.0.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 +118 -73
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts +1 -0
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts.map +1 -1
- package/dist/atlas/benchmark/hybrid-retrieval.js.map +1 -1
- package/dist/atlas/chain-pipeline.d.ts +37 -0
- package/dist/atlas/chain-pipeline.d.ts.map +1 -1
- package/dist/atlas/chain-pipeline.js +95 -79
- package/dist/atlas/chain-pipeline.js.map +1 -1
- package/dist/atlas/composition-table.d.ts +5 -7
- package/dist/atlas/composition-table.d.ts.map +1 -1
- package/dist/atlas/composition-table.js +3 -5
- package/dist/atlas/composition-table.js.map +1 -1
- package/dist/atlas/proof-target.d.ts +28 -2
- package/dist/atlas/proof-target.d.ts.map +1 -1
- package/dist/atlas/proof-target.js +25 -16
- package/dist/atlas/proof-target.js.map +1 -1
- package/dist/atlas/regime.d.ts +2 -2
- package/dist/atlas/regime.d.ts.map +1 -1
- package/dist/atlas/regime.js +1 -1
- package/dist/atlas/regime.js.map +1 -1
- package/dist/atlas/types.d.ts +7 -7
- package/dist/atlas/types.d.ts.map +1 -1
- package/dist/bridges/be53-yang-mills-confrontation.d.ts +1 -1
- package/dist/bridges/be53-yang-mills-confrontation.d.ts.map +1 -1
- package/dist/canonical/normal-form.d.ts +2 -1
- package/dist/canonical/normal-form.d.ts.map +1 -1
- package/dist/canonical/normal-form.js +2 -1
- package/dist/canonical/normal-form.js.map +1 -1
- package/dist/cases/brownian-sphere.d.ts.map +1 -1
- package/dist/cases/brownian-sphere.js +1 -0
- package/dist/cases/brownian-sphere.js.map +1 -1
- package/dist/cli/args.d.ts +7 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/command.d.ts +13 -0
- package/dist/cli/command.d.ts.map +1 -1
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/commands/_atlas-route.d.ts +1 -1
- package/dist/cli/commands/atlas.d.ts.map +1 -1
- package/dist/cli/commands/atlas.js +28 -7
- package/dist/cli/commands/atlas.js.map +1 -1
- package/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/audit.js +7 -3
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/cli/commands/axes.d.ts.map +1 -1
- package/dist/cli/commands/axes.js +6 -2
- package/dist/cli/commands/axes.js.map +1 -1
- package/dist/cli/commands/candidates.d.ts.map +1 -1
- package/dist/cli/commands/candidates.js +7 -3
- package/dist/cli/commands/candidates.js.map +1 -1
- package/dist/cli/commands/canonical.d.ts.map +1 -1
- package/dist/cli/commands/canonical.js +11 -3
- package/dist/cli/commands/canonical.js.map +1 -1
- package/dist/cli/commands/chain.d.ts +1 -0
- package/dist/cli/commands/chain.d.ts.map +1 -1
- package/dist/cli/commands/chain.js +12 -1
- package/dist/cli/commands/chain.js.map +1 -1
- package/dist/cli/commands/confront.d.ts.map +1 -1
- package/dist/cli/commands/confront.js +20 -6
- package/dist/cli/commands/confront.js.map +1 -1
- package/dist/cli/commands/connectors.d.ts.map +1 -1
- package/dist/cli/commands/connectors.js +7 -3
- package/dist/cli/commands/connectors.js.map +1 -1
- package/dist/cli/commands/coverage.d.ts.map +1 -1
- package/dist/cli/commands/coverage.js +6 -2
- package/dist/cli/commands/coverage.js.map +1 -1
- package/dist/cli/commands/derive.d.ts.map +1 -1
- package/dist/cli/commands/derive.js +12 -4
- package/dist/cli/commands/derive.js.map +1 -1
- package/dist/cli/commands/discover.d.ts.map +1 -1
- package/dist/cli/commands/discover.js +35 -8
- package/dist/cli/commands/discover.js.map +1 -1
- package/dist/cli/commands/eval.d.ts.map +1 -1
- package/dist/cli/commands/eval.js +26 -19
- package/dist/cli/commands/eval.js.map +1 -1
- package/dist/cli/commands/evaluate.d.ts +7 -3
- package/dist/cli/commands/evaluate.d.ts.map +1 -1
- package/dist/cli/commands/evaluate.js +71 -36
- package/dist/cli/commands/evaluate.js.map +1 -1
- package/dist/cli/commands/explain.d.ts.map +1 -1
- package/dist/cli/commands/explain.js +7 -3
- package/dist/cli/commands/explain.js.map +1 -1
- package/dist/cli/commands/frontier.d.ts.map +1 -1
- package/dist/cli/commands/frontier.js +12 -2
- package/dist/cli/commands/frontier.js.map +1 -1
- package/dist/cli/commands/ground.d.ts.map +1 -1
- package/dist/cli/commands/ground.js +20 -5
- package/dist/cli/commands/ground.js.map +1 -1
- package/dist/cli/commands/map.d.ts +1 -1
- package/dist/cli/commands/map.d.ts.map +1 -1
- package/dist/cli/commands/map.js +29 -25
- package/dist/cli/commands/map.js.map +1 -1
- package/dist/cli/commands/metric.d.ts.map +1 -1
- package/dist/cli/commands/metric.js +21 -14
- package/dist/cli/commands/metric.js.map +1 -1
- package/dist/cli/commands/path.d.ts +3 -2
- package/dist/cli/commands/path.d.ts.map +1 -1
- package/dist/cli/commands/path.js +47 -20
- package/dist/cli/commands/path.js.map +1 -1
- package/dist/cli/commands/predict.d.ts.map +1 -1
- package/dist/cli/commands/predict.js +7 -3
- package/dist/cli/commands/predict.js.map +1 -1
- package/dist/cli/commands/priority.d.ts.map +1 -1
- package/dist/cli/commands/priority.js +7 -3
- package/dist/cli/commands/priority.js.map +1 -1
- package/dist/cli/commands/probe.d.ts.map +1 -1
- package/dist/cli/commands/probe.js +32 -16
- package/dist/cli/commands/probe.js.map +1 -1
- package/dist/cli/commands/recover.d.ts.map +1 -1
- package/dist/cli/commands/recover.js +7 -4
- package/dist/cli/commands/recover.js.map +1 -1
- package/dist/cli/commands/regime.d.ts +2 -2
- package/dist/cli/commands/regime.d.ts.map +1 -1
- package/dist/cli/commands/regime.js +36 -12
- package/dist/cli/commands/regime.js.map +1 -1
- package/dist/cli/commands/retrieve.d.ts.map +1 -1
- package/dist/cli/commands/retrieve.js +23 -4
- package/dist/cli/commands/retrieve.js.map +1 -1
- package/dist/cli/commands/search.d.ts.map +1 -1
- package/dist/cli/commands/search.js +12 -2
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/symbolic.d.ts.map +1 -1
- package/dist/cli/commands/symbolic.js +11 -3
- package/dist/cli/commands/symbolic.js.map +1 -1
- package/dist/cli/commands/testplan.d.ts.map +1 -1
- package/dist/cli/commands/testplan.js +12 -2
- package/dist/cli/commands/testplan.js.map +1 -1
- package/dist/cli/eval-numbers.d.ts +2 -2
- package/dist/cli/eval-numbers.js +2 -2
- package/dist/cli/flag-help.d.ts +34 -0
- package/dist/cli/flag-help.d.ts.map +1 -0
- package/dist/cli/flag-help.js +113 -0
- package/dist/cli/flag-help.js.map +1 -0
- package/dist/cli/main.d.ts +0 -8
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +42 -29
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/version.d.ts +6 -2
- package/dist/cli/version.d.ts.map +1 -1
- package/dist/cli/version.js +11 -3
- package/dist/cli/version.js.map +1 -1
- package/dist/cli-api.d.ts +50 -0
- package/dist/cli-api.d.ts.map +1 -1
- package/dist/cli-api.js +42 -0
- package/dist/cli-api.js.map +1 -1
- package/dist/composition/adjudication.d.ts +9 -0
- package/dist/composition/adjudication.d.ts.map +1 -1
- package/dist/composition/adjudication.js +13 -0
- package/dist/composition/adjudication.js.map +1 -1
- package/dist/composition/canonical-compare.d.ts +1 -0
- package/dist/composition/canonical-compare.d.ts.map +1 -1
- package/dist/composition/canonical-compare.js +1 -0
- package/dist/composition/canonical-compare.js.map +1 -1
- package/dist/composition/chain-result.d.ts +55 -0
- package/dist/composition/chain-result.d.ts.map +1 -0
- package/dist/composition/chain-result.js +57 -0
- package/dist/composition/chain-result.js.map +1 -0
- package/dist/composition/compose-symbolic.d.ts.map +1 -1
- package/dist/composition/compose-symbolic.js +4 -39
- package/dist/composition/compose-symbolic.js.map +1 -1
- package/dist/composition/compose.d.ts.map +1 -1
- package/dist/composition/compose.js +11 -4
- package/dist/composition/compose.js.map +1 -1
- package/dist/composition/edges/calibration.d.ts +9 -0
- package/dist/composition/edges/calibration.d.ts.map +1 -1
- package/dist/composition/edges/calibration.js +9 -9
- package/dist/composition/edges/calibration.js.map +1 -1
- package/dist/composition/edges/catalog-condensed-matter.d.ts +10 -0
- package/dist/composition/edges/catalog-condensed-matter.d.ts.map +1 -1
- package/dist/composition/edges/catalog-condensed-matter.js +10 -10
- package/dist/composition/edges/catalog-condensed-matter.js.map +1 -1
- package/dist/composition/edges/catalog-gravitation-cosmology.d.ts +11 -0
- package/dist/composition/edges/catalog-gravitation-cosmology.d.ts.map +1 -1
- package/dist/composition/edges/catalog-gravitation-cosmology.js +11 -11
- package/dist/composition/edges/catalog-gravitation-cosmology.js.map +1 -1
- package/dist/composition/edges/catalog-quantum.d.ts +10 -0
- package/dist/composition/edges/catalog-quantum.d.ts.map +1 -1
- package/dist/composition/edges/catalog-quantum.js +10 -10
- package/dist/composition/edges/catalog-quantum.js.map +1 -1
- package/dist/composition/edges/catalog-tranche.d.ts +11 -0
- package/dist/composition/edges/catalog-tranche.d.ts.map +1 -1
- package/dist/composition/edges/catalog-tranche.js +11 -11
- package/dist/composition/edges/catalog-tranche.js.map +1 -1
- package/dist/composition/enumerate.d.ts +46 -5
- package/dist/composition/enumerate.d.ts.map +1 -1
- package/dist/composition/enumerate.js +37 -8
- package/dist/composition/enumerate.js.map +1 -1
- package/dist/composition/expr-simplify.d.ts.map +1 -1
- package/dist/composition/expr-simplify.js +3 -11
- package/dist/composition/expr-simplify.js.map +1 -1
- package/dist/composition/frontier-account.d.ts +6 -6
- package/dist/composition/frontier-account.d.ts.map +1 -1
- package/dist/composition/mathts-scalar-symbols.d.ts +48 -0
- package/dist/composition/mathts-scalar-symbols.d.ts.map +1 -0
- package/dist/composition/mathts-scalar-symbols.js +150 -0
- package/dist/composition/mathts-scalar-symbols.js.map +1 -0
- package/dist/composition/probe/frontier.d.ts.map +1 -1
- package/dist/composition/probe/frontier.js +17 -4
- package/dist/composition/probe/frontier.js.map +1 -1
- package/dist/composition/probe/study.js +1 -1
- package/dist/composition/probe/study.js.map +1 -1
- package/dist/composition/uncertainty.d.ts +2 -2
- package/dist/composition/uncertainty.d.ts.map +1 -1
- package/dist/composition/uncertainty.js +14 -13
- package/dist/composition/uncertainty.js.map +1 -1
- package/dist/diff/bridge-gradient.d.ts +5 -8
- package/dist/diff/bridge-gradient.d.ts.map +1 -1
- package/dist/diff/bridge-gradient.js +5 -8
- package/dist/diff/bridge-gradient.js.map +1 -1
- package/dist/dimensional/buckingham.d.ts.map +1 -1
- package/dist/dimensional/buckingham.js +19 -91
- package/dist/dimensional/buckingham.js.map +1 -1
- package/dist/dimensional/units.d.ts +13 -0
- package/dist/dimensional/units.d.ts.map +1 -1
- package/dist/dimensional/units.js +78 -1
- package/dist/dimensional/units.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/numerical/binding-value.d.ts +3 -3
- package/dist/numerical/binding-value.d.ts.map +1 -1
- package/dist/numerical/binding-value.js +60 -31
- package/dist/numerical/binding-value.js.map +1 -1
- package/dist/numerical/einstein-equation.js +3 -3
- package/dist/numerical/einstein-equation.js.map +1 -1
- package/dist/numerical/engine-registry.d.ts +12 -27
- package/dist/numerical/engine-registry.d.ts.map +1 -1
- package/dist/numerical/engine-registry.js +10 -65
- package/dist/numerical/engine-registry.js.map +1 -1
- package/dist/numerical/errors.d.ts +1 -2
- package/dist/numerical/errors.d.ts.map +1 -1
- package/dist/numerical/errors.js +1 -2
- package/dist/numerical/errors.js.map +1 -1
- package/dist/numerical/formula-contract.d.ts +60 -0
- package/dist/numerical/formula-contract.d.ts.map +1 -0
- package/dist/numerical/formula-contract.js +107 -0
- package/dist/numerical/formula-contract.js.map +1 -0
- package/dist/numerical/formula-dimension.d.ts +33 -10
- package/dist/numerical/formula-dimension.d.ts.map +1 -1
- package/dist/numerical/formula-dimension.js +48 -35
- package/dist/numerical/formula-dimension.js.map +1 -1
- package/dist/numerical/formula-mathts.d.ts +15 -17
- package/dist/numerical/formula-mathts.d.ts.map +1 -1
- package/dist/numerical/formula-mathts.js +34 -36
- package/dist/numerical/formula-mathts.js.map +1 -1
- package/dist/numerical/formula-registry.d.ts +11 -19
- package/dist/numerical/formula-registry.d.ts.map +1 -1
- package/dist/numerical/formula-registry.js +16 -79
- package/dist/numerical/formula-registry.js.map +1 -1
- package/dist/numerical/geodesic-integrator.d.ts.map +1 -1
- package/dist/numerical/geodesic-integrator.js +19 -31
- package/dist/numerical/geodesic-integrator.js.map +1 -1
- package/dist/numerical/gl4-integrator.d.ts +12 -51
- package/dist/numerical/gl4-integrator.d.ts.map +1 -1
- package/dist/numerical/gl4-integrator.js +103 -565
- package/dist/numerical/gl4-integrator.js.map +1 -1
- package/dist/numerical/index.d.ts +0 -2
- package/dist/numerical/index.d.ts.map +1 -1
- package/dist/numerical/index.js +0 -2
- package/dist/numerical/index.js.map +1 -1
- package/dist/numerical/kretschmann.d.ts +2 -2
- package/dist/numerical/kretschmann.js +2 -2
- package/dist/numerical/mathts-engine.d.ts +7 -8
- package/dist/numerical/mathts-engine.d.ts.map +1 -1
- package/dist/numerical/mathts-engine.js +19 -27
- package/dist/numerical/mathts-engine.js.map +1 -1
- package/dist/numerical/null-ray-integrator.d.ts.map +1 -1
- package/dist/numerical/null-ray-integrator.js +11 -28
- package/dist/numerical/null-ray-integrator.js.map +1 -1
- package/dist/numerical/quadrature.d.ts +2 -17
- package/dist/numerical/quadrature.d.ts.map +1 -1
- package/dist/numerical/quadrature.js +9 -20
- package/dist/numerical/quadrature.js.map +1 -1
- package/dist/numerical/spacetime-metrics.d.ts +1 -0
- package/dist/numerical/spacetime-metrics.d.ts.map +1 -1
- package/dist/numerical/spacetime-metrics.js.map +1 -1
- package/dist/numerical/strides.d.ts +1 -2
- package/dist/numerical/strides.d.ts.map +1 -1
- package/dist/numerical/strides.js +1 -2
- package/dist/numerical/strides.js.map +1 -1
- package/dist/numerical/tensor-engine.d.ts +2 -3
- package/dist/numerical/tensor-engine.d.ts.map +1 -1
- package/dist/numerical/tensor-engine.js +1 -2
- package/dist/numerical/tensor-engine.js.map +1 -1
- package/dist/relations/category.d.ts +8 -2
- package/dist/relations/category.d.ts.map +1 -1
- package/dist/relations/category.js +10 -2
- package/dist/relations/category.js.map +1 -1
- package/dist/relations/composition-table.d.ts +1 -1
- package/dist/relations/composition-table.d.ts.map +1 -1
- package/dist/relations/composition-table.js +1 -1
- package/dist/relations/composition-table.js.map +1 -1
- package/dist/relations/regime-vocabularies.d.ts +40 -0
- package/dist/relations/regime-vocabularies.d.ts.map +1 -0
- package/dist/relations/regime-vocabularies.js +19 -0
- package/dist/relations/regime-vocabularies.js.map +1 -0
- package/package.json +13 -46
- package/dist/numerical/float64-engine.d.ts +0 -55
- package/dist/numerical/float64-engine.d.ts.map +0 -1
- package/dist/numerical/float64-engine.js +0 -675
- package/dist/numerical/float64-engine.js.map +0 -1
- package/dist/numerical/formula.d.ts +0 -106
- package/dist/numerical/formula.d.ts.map +0 -1
- package/dist/numerical/formula.js +0 -348
- package/dist/numerical/formula.js.map +0 -1
|
@@ -1,100 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Formula-parser registry
|
|
2
|
+
* Formula-parser registry.
|
|
3
3
|
*
|
|
4
|
-
* `getFormulaParser()` returns the MathTS-backed parser
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* and cached. A broken or absent MathTS never breaks the caller — it falls
|
|
8
|
-
* back silently to Path B.
|
|
9
|
-
*
|
|
10
|
-
* The CLI and any inference code depend only on the {@link FormulaParser}
|
|
11
|
-
* interface, so swapping Path B ↔ Path A is transparent.
|
|
4
|
+
* `getFormulaParser()` returns the MathTS-backed parser. The MathTS packages
|
|
5
|
+
* are required dependencies, so there is no absent-peer branch and no Path B
|
|
6
|
+
* parser.
|
|
12
7
|
*
|
|
13
8
|
* @module numerical/formula-registry
|
|
14
9
|
*/
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
let cached;
|
|
19
|
-
/** A formula MathTS must reproduce to be accepted (the §1-gate smoke test). */
|
|
20
|
-
const SMOKE_EXPR = 'a*b^2 + 1';
|
|
21
|
-
const SMOKE_SCOPE = { a: 3, b: 4 };
|
|
22
|
-
const SMOKE_EXPECTED = 49; // 3*16 + 1
|
|
23
|
-
/** Run `fn` with MathTS's import-time WASM-fallback chatter suppressed. */
|
|
24
|
-
async function quietly(fn) {
|
|
25
|
-
const origWarn = console.warn;
|
|
26
|
-
const origError = console.error;
|
|
27
|
-
const origWrite = process.stderr.write.bind(process.stderr);
|
|
28
|
-
console.warn = () => { };
|
|
29
|
-
console.error = () => { };
|
|
30
|
-
// mathts prints some notices via process.stderr.write directly.
|
|
31
|
-
process.stderr.write = () => true;
|
|
32
|
-
try {
|
|
33
|
-
return await fn();
|
|
34
|
-
}
|
|
35
|
-
finally {
|
|
36
|
-
console.warn = origWarn;
|
|
37
|
-
console.error = origError;
|
|
38
|
-
process.stderr.write = origWrite;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
async function detect() {
|
|
42
|
-
try {
|
|
43
|
-
const parser = await quietly(loadMathtsFormulaParser);
|
|
44
|
-
// Smoke test: it must actually assemble AND evaluate correctly.
|
|
45
|
-
const v = parser.parse(SMOKE_EXPR).evaluate(SMOKE_SCOPE);
|
|
46
|
-
if (Math.abs(v - SMOKE_EXPECTED) < 1e-9) {
|
|
47
|
-
return { parser, kind: 'mathts' };
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
/* peer absent or failed to assemble — fall through */
|
|
52
|
-
}
|
|
53
|
-
return { parser: defaultFormulaParser, kind: 'builtin' };
|
|
54
|
-
}
|
|
55
|
-
/** Resolve the active formula parser (cached). @internal */
|
|
10
|
+
import { mathtsFormulaParser } from './formula-mathts.js';
|
|
11
|
+
import { builtinFormulaDimensionChecker } from './formula-dimension.js';
|
|
12
|
+
/** Resolve the active formula parser. It is the MathTS parser. @internal */
|
|
56
13
|
export async function getFormulaParser() {
|
|
57
|
-
|
|
58
|
-
return (await cached).parser;
|
|
14
|
+
return mathtsFormulaParser;
|
|
59
15
|
}
|
|
60
|
-
/** Which parser is active
|
|
16
|
+
/** Which parser is active. Always `mathts`. @internal */
|
|
61
17
|
export async function getFormulaParserKind() {
|
|
62
|
-
|
|
63
|
-
return (await cached).kind;
|
|
18
|
+
return 'mathts';
|
|
64
19
|
}
|
|
65
|
-
let cachedChecker;
|
|
66
|
-
const LENGTH_DIM = { L: 1, M: 0, T: 0, I: 0, Theta: 0, N: 0, J: 0 };
|
|
67
20
|
/**
|
|
68
|
-
* The dimensional checker for user formulas
|
|
69
|
-
*
|
|
70
|
-
* smoke-tests clean, else the self-contained Path B AST — both transpile to
|
|
71
|
-
* the same `ExprNode`, so the dimensional verdict is identical. @internal
|
|
21
|
+
* The dimensional checker for user formulas. It transpiles the MathTS AST.
|
|
22
|
+
* @internal
|
|
72
23
|
*/
|
|
73
24
|
export async function getFormulaDimensionChecker() {
|
|
74
|
-
|
|
75
|
-
try {
|
|
76
|
-
const checker = await quietly(loadFormulaDimensionChecker);
|
|
77
|
-
// smoke test: a dimensionless ratio is homogeneous and dimensionless.
|
|
78
|
-
if (checker.check('a/a', { a: LENGTH_DIM }).ok)
|
|
79
|
-
return checker;
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
/* peer absent or failed — fall back to the built-in checker */
|
|
83
|
-
}
|
|
84
|
-
return builtinFormulaDimensionChecker();
|
|
85
|
-
})();
|
|
86
|
-
return cachedChecker;
|
|
25
|
+
return builtinFormulaDimensionChecker();
|
|
87
26
|
}
|
|
88
27
|
/**
|
|
89
|
-
* Parse physics text to a dimensional `ExprNode` + its inferred dimension
|
|
90
|
-
*
|
|
91
|
-
* built-in parser). The single public string→`ExprNode` entry point.
|
|
28
|
+
* Parse physics text to a dimensional `ExprNode` + its inferred dimension.
|
|
29
|
+
* The single public string→`ExprNode` entry point.
|
|
92
30
|
*
|
|
93
31
|
* @throws {FormulaDimensionError} on a parse error or non-homogeneity.
|
|
94
32
|
* @public
|
|
95
33
|
*/
|
|
96
34
|
export async function parsePhysics(text, dims) {
|
|
97
|
-
|
|
98
|
-
return checker.parse(text, dims);
|
|
35
|
+
return builtinFormulaDimensionChecker().parse(text, dims);
|
|
99
36
|
}
|
|
100
37
|
//# sourceMappingURL=formula-registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formula-registry.js","sourceRoot":"","sources":["../../src/numerical/formula-registry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"formula-registry.js","sourceRoot":"","sources":["../../src/numerical/formula-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAIxE,4EAA4E;AAC5E,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED,yDAAyD;AACzD,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B;IAC9C,OAAO,8BAA8B,EAAE,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,IAAY,EACZ,IAAyC;IAEzC,OAAO,8BAA8B,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geodesic-integrator.d.ts","sourceRoot":"","sources":["../../src/numerical/geodesic-integrator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geodesic-integrator.d.ts","sourceRoot":"","sources":["../../src/numerical/geodesic-integrator.ts"],"names":[],"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16
|
-
* dependency — the integrator is self-contained.
|
|
16
|
+
* dependency — the integrator is self-contained. The fixed steps are
|
|
17
|
+
* MathTS `solveODESystem` with `dt` set, which is that library's classical
|
|
18
|
+
* RK4. Adaptive `solveODE` is not this step.
|
|
17
19
|
*
|
|
18
20
|
* Validated against the cycloid parametric form for radial Schwarzschild
|
|
19
21
|
* infall to ±1e-6 (Task 14 test, η = 0.5).
|
|
20
22
|
*
|
|
21
23
|
* @module numerical/geodesic-integrator
|
|
22
24
|
*/
|
|
25
|
+
import { solveODESystem } from '@danielsimonjr/mathts-functions';
|
|
23
26
|
import { NumericalBackendError } from './errors.js';
|
|
24
|
-
function addScaled4(a, b, k) {
|
|
25
|
-
return [a[0] + k * b[0], a[1] + k * b[1], a[2] + k * b[2], a[3] + k * b[3]];
|
|
26
|
-
}
|
|
27
|
-
function combineRK4(y, k1, k2, k3, k4, h) {
|
|
28
|
-
return [
|
|
29
|
-
y[0] + (h / 6) * (k1[0] + 2 * k2[0] + 2 * k3[0] + k4[0]),
|
|
30
|
-
y[1] + (h / 6) * (k1[1] + 2 * k2[1] + 2 * k3[1] + k4[1]),
|
|
31
|
-
y[2] + (h / 6) * (k1[2] + 2 * k2[2] + 2 * k3[2] + k4[2]),
|
|
32
|
-
y[3] + (h / 6) * (k1[3] + 2 * k2[3] + 2 * k3[3] + k4[3]),
|
|
33
|
-
];
|
|
34
|
-
}
|
|
35
27
|
/**
|
|
36
28
|
* Evaluate the Christoffel acceleration −Γ^μ_{νρ} v^ν v^ρ at position x
|
|
37
29
|
* with 4-velocity v. Returns (dx/dτ, dv/dτ) = (v, accel).
|
|
@@ -158,34 +150,30 @@ export function integrateGeodesic(inputs) {
|
|
|
158
150
|
throw new NumericalBackendError(`integrateGeodesic: steps must be a positive integer, got ${steps}`);
|
|
159
151
|
}
|
|
160
152
|
const h = (tauEnd - tauStart) / steps;
|
|
161
|
-
|
|
162
|
-
let v = [v0[0], v0[1], v0[2], v0[3]];
|
|
163
|
-
const sampleEvery = Math.max(1, Math.floor(steps / 100));
|
|
164
|
-
const trajectory = [[...x]];
|
|
153
|
+
const y0 = [x0[0], x0[1], x0[2], x0[3], v0[0], v0[1], v0[2], v0[3]];
|
|
165
154
|
// One scratch buffer reused across all Christoffel evaluations (4 per step).
|
|
166
155
|
// Each geodesicRHS consumes its Γ before the next call, so reuse is safe and
|
|
167
156
|
// avoids ~4·steps Float64Array(64) allocations per integration.
|
|
168
157
|
const scratch = new Float64Array(64);
|
|
158
|
+
const sol = solveODESystem((_tau, y) => {
|
|
159
|
+
const x = [y[0], y[1], y[2], y[3]];
|
|
160
|
+
const v = [y[4], y[5], y[6], y[7]];
|
|
161
|
+
const s = geodesicRHS(christoffelFn, x, v, scratch);
|
|
162
|
+
return [s.dx[0], s.dx[1], s.dx[2], s.dx[3], s.dv[0], s.dv[1], s.dv[2], s.dv[3]];
|
|
163
|
+
}, y0, [tauStart, tauEnd], { dt: h });
|
|
164
|
+
const asVec4 = (row) => [row[0], row[1], row[2], row[3]];
|
|
165
|
+
const sampleEvery = Math.max(1, Math.floor(steps / 100));
|
|
166
|
+
const trajectory = [asVec4(sol.y[0] ?? y0)];
|
|
169
167
|
for (let i = 0; i < steps; i++) {
|
|
170
|
-
const s1 = geodesicRHS(christoffelFn, x, v, scratch);
|
|
171
|
-
const x2 = addScaled4(x, s1.dx, h / 2);
|
|
172
|
-
const v2 = addScaled4(v, s1.dv, h / 2);
|
|
173
|
-
const s2 = geodesicRHS(christoffelFn, x2, v2, scratch);
|
|
174
|
-
const x3 = addScaled4(x, s2.dx, h / 2);
|
|
175
|
-
const v3 = addScaled4(v, s2.dv, h / 2);
|
|
176
|
-
const s3 = geodesicRHS(christoffelFn, x3, v3, scratch);
|
|
177
|
-
const x4 = addScaled4(x, s3.dx, h);
|
|
178
|
-
const v4 = addScaled4(v, s3.dv, h);
|
|
179
|
-
const s4 = geodesicRHS(christoffelFn, x4, v4, scratch);
|
|
180
|
-
x = combineRK4(x, s1.dx, s2.dx, s3.dx, s4.dx, h);
|
|
181
|
-
v = combineRK4(v, s1.dv, s2.dv, s3.dv, s4.dv, h);
|
|
182
168
|
if ((i + 1) % sampleEvery === 0) {
|
|
183
|
-
|
|
169
|
+
const row = sol.y[i + 1] ?? sol.y[sol.y.length - 1] ?? y0;
|
|
170
|
+
trajectory.push(asVec4(row));
|
|
184
171
|
}
|
|
185
172
|
}
|
|
173
|
+
const last = sol.y[sol.y.length - 1] ?? y0;
|
|
186
174
|
return {
|
|
187
|
-
xFinal:
|
|
188
|
-
vFinal:
|
|
175
|
+
xFinal: asVec4(last),
|
|
176
|
+
vFinal: [last[4], last[5], last[6], last[7]],
|
|
189
177
|
trajectory,
|
|
190
178
|
};
|
|
191
179
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geodesic-integrator.js","sourceRoot":"","sources":["../../src/numerical/geodesic-integrator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"geodesic-integrator.js","sourceRoot":"","sources":["../../src/numerical/geodesic-integrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AA+EpD;;;;;;GAMG;AACH,SAAS,WAAW,CAClB,aAA6E,EAC7E,CAAO,EACP,CAAO;AACP,yEAAyE;AACzE,4EAA4E;AAC5E,8DAA8D;AAC9D,OAAsB;IAEtB,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACpC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,E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AAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YAC1D,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAE3C,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC;QACpB,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5C,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -1,34 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Gauss
|
|
3
|
-
*
|
|
2
|
+
* Gauss–Legendre order-4 Butcher tableau from MathTS. `GL4_A` is the 2×2
|
|
3
|
+
* stage matrix, `GL4_B` the weights (both ½), and `GL4_C` the two nodes.
|
|
4
|
+
* `integrateGeodesicGL4` does not read these names; the tableau tests do.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @internal — exported for unit tests pinning the Butcher tableau invariants.
|
|
8
|
-
* Public callers should use {@link integrateGeodesicGL4}, not the raw constants.
|
|
9
|
-
*/
|
|
10
|
-
export declare const GL4_C: readonly [number, number];
|
|
11
|
-
/**
|
|
12
|
-
* GL4 Butcher matrix a_{ij} — the 2×2 collocation table for the implicit
|
|
13
|
-
* stages:
|
|
14
|
-
*
|
|
15
|
-
* [ 1/4 1/4 − √3/6 ]
|
|
16
|
-
* [ 1/4 + √3/6 1/4 ]
|
|
17
|
-
*
|
|
18
|
-
* (Hairer/Lubich/Wanner §II.1, Table 1.1.)
|
|
19
|
-
*
|
|
20
|
-
* @internal — exported for unit tests pinning the Butcher tableau invariants.
|
|
21
|
-
* Public callers should use {@link integrateGeodesicGL4}, not the raw constants.
|
|
22
|
-
*/
|
|
23
|
-
export declare const GL4_A: readonly [readonly [number, number], readonly [number, number]];
|
|
24
|
-
/**
|
|
25
|
-
* GL4 stage weights — the 2-point Gauss-Legendre quadrature weights on
|
|
26
|
-
* [0,1]: b₁ = b₂ = ½.
|
|
27
|
-
*
|
|
28
|
-
* @internal — exported for unit tests pinning the Butcher tableau invariants.
|
|
29
|
-
* Public callers should use {@link integrateGeodesicGL4}, not the raw constants.
|
|
6
|
+
* @internal
|
|
30
7
|
*/
|
|
31
|
-
export
|
|
8
|
+
export { GL4_A, GL4_B, GL4_C } from '@danielsimonjr/mathts-functions';
|
|
32
9
|
/**
|
|
33
10
|
* Canonical (x, p) phase-space state for the geodesic flow on T*M.
|
|
34
11
|
*
|
|
@@ -128,28 +105,12 @@ interface StageSolveResult {
|
|
|
128
105
|
readonly iterations: number;
|
|
129
106
|
}
|
|
130
107
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* Per Design §3 Task 1a, the implicit system is:
|
|
134
|
-
* X_i = x_n + h · Σ_j a_{ij} · g^{·ν}(X_j) P_{j,ν}
|
|
135
|
-
* P_{i,μ} = p_n − h · Σ_j a_{ij} · ½ (∂_μ g^νρ)(X_j) P_{j,ν} P_{j,ρ}
|
|
136
|
-
*
|
|
137
|
-
* Data flow (F15 / M1): stage values (X_j, P_j) at iterate k feed forward
|
|
138
|
-
* to update (X_i, P_i) at iterate k+1. This is Picard iteration (NOT
|
|
139
|
-
* Newton) — no Jacobian assembly or LU decomposition. Convergence is
|
|
140
|
-
* linear with contraction rate ≈ h·|∂f/∂x|. For Mercury (h ≈ 150 s),
|
|
141
|
-
* expect 30–40 iterations at tol=1e-12. GL4's symplecticity is guaranteed
|
|
142
|
-
* by the Butcher tableau, not by the inner solver's convergence speed
|
|
143
|
-
* (Sanz-Serna 1988; Hairer/Lubich/Wanner §II.1).
|
|
144
|
-
*
|
|
145
|
-
* The `dgInverseFn` index order is `dg[λ][μ][ν] = ∂_λ g^{μν}` (Task 0 I2
|
|
146
|
-
* pin, also recorded on `GL4Options.dgInverseFn`). When we evaluate
|
|
147
|
-
* `dp_μ = −½ (∂_μ g^{νρ}) P_ν P_ρ` we therefore read
|
|
148
|
-
* `dgInvAtXj[mu*dim²+nu*dim+rho]` — `mu` is the differentiation axis (λ in the
|
|
149
|
-
* pinned order) and `(nu, rho)` are the upper metric indices.
|
|
108
|
+
* One GL4 step, reported in the stage-result shape the stage tests read.
|
|
150
109
|
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
110
|
+
* The step itself is MathTS `gaussLegendre4`. In flat space `p` is constant,
|
|
111
|
+
* so both stage momenta equal that advanced `p`. Throws `GL4ConvergenceError`
|
|
112
|
+
* with a message matching `/Picard iteration did not converge/` when the
|
|
113
|
+
* Picard cap is exhausted.
|
|
153
114
|
*
|
|
154
115
|
* @internal
|
|
155
116
|
*/
|
|
@@ -162,7 +123,8 @@ export declare function solveGL4Stage(state: GL4State, h: number, gInverseFn: (x
|
|
|
162
123
|
*
|
|
163
124
|
* H(x, p) = ½ g^{μν}(x) p_μ p_ν
|
|
164
125
|
*
|
|
165
|
-
*
|
|
126
|
+
* Each accepted step is MathTS `gaussLegendre4` on the geodesic Hamiltonian.
|
|
127
|
+
* Adaptive step-halving stays here. `onStep` reads that step's `iterations`.
|
|
166
128
|
* with **adaptive step-halving on Picard non-convergence** (Adam+Eve I4,
|
|
167
129
|
* replaces the single-retry R8): if Picard fails at step size h, retry at
|
|
168
130
|
* h/2, h/4, … down to `hMin` (default `h · 1e-9`); throw
|
|
@@ -215,5 +177,4 @@ export declare function solveGL4Stage(state: GL4State, h: number, gInverseFn: (x
|
|
|
215
177
|
* @public
|
|
216
178
|
*/
|
|
217
179
|
export declare function integrateGeodesicGL4(initialState: GL4State, options: GL4Options): readonly GL4Snapshot[];
|
|
218
|
-
export {};
|
|
219
180
|
//# sourceMappingURL=gl4-integrator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gl4-integrator.d.ts","sourceRoot":"","sources":["../../src/numerical/gl4-integrator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gl4-integrator.d.ts","sourceRoot":"","sources":["../../src/numerical/gl4-integrator.ts"],"names":[],"mappings":"AA4BA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;;;;;;;;;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;gFAC4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,KAAK,YAAY,CAAC;IAC5D;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,KAAK,YAAY,CAAC;IAC7D,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,mE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