universal-physics-tensor 10.0.0 → 12.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 +39 -36
- package/bin/upt.mjs +13 -1
- package/data/applied-cases.json +1892 -0
- package/data/applied-cases.schema.json +194 -0
- package/data/atlas/atlas.json +25 -25
- package/data/atlas/atlas.jsonld +1 -1
- package/data/atlas/diffusion.json +6 -6
- package/data/atlas/oscillators.json +7 -7
- package/data/atlas/waves.json +14 -14
- package/data/atlas/witness-results.json +11 -11
- package/data/bridge-catalog.json +389 -230
- package/data/bridge-catalog.schema.json +45 -7
- package/data/units.json +6 -25
- package/dist/atlas/applicability.d.ts.map +1 -1
- package/dist/atlas/applicability.js +21 -15
- package/dist/atlas/applicability.js.map +1 -1
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts +9 -1
- package/dist/atlas/benchmark/hybrid-retrieval.d.ts.map +1 -1
- package/dist/atlas/benchmark/hybrid-retrieval.js +15 -13
- package/dist/atlas/benchmark/hybrid-retrieval.js.map +1 -1
- package/dist/atlas/benchmark/loader.js +2 -2
- package/dist/atlas/benchmark/loader.js.map +1 -1
- package/dist/atlas/benchmark/stats.d.ts +2 -2
- package/dist/atlas/benchmark/stats.d.ts.map +1 -1
- package/dist/atlas/benchmark/stats.js +9 -15
- package/dist/atlas/benchmark/stats.js.map +1 -1
- package/dist/atlas/catalog-formal-ref.d.ts +26 -3
- package/dist/atlas/catalog-formal-ref.d.ts.map +1 -1
- package/dist/atlas/catalog-formal-ref.js +52 -5
- package/dist/atlas/catalog-formal-ref.js.map +1 -1
- package/dist/atlas/chain-pipeline.d.ts.map +1 -1
- package/dist/atlas/chain-pipeline.js +7 -8
- package/dist/atlas/chain-pipeline.js.map +1 -1
- package/dist/atlas/diffusion/bridges-closure.d.ts +0 -4
- package/dist/atlas/diffusion/bridges-closure.d.ts.map +1 -1
- package/dist/atlas/diffusion/bridges-closure.js +8 -12
- package/dist/atlas/diffusion/bridges-closure.js.map +1 -1
- package/dist/atlas/diffusion/bridges.d.ts.map +1 -1
- package/dist/atlas/diffusion/bridges.js +27 -39
- package/dist/atlas/diffusion/bridges.js.map +1 -1
- package/dist/atlas/diffusion/dimensions.d.ts +6 -14
- package/dist/atlas/diffusion/dimensions.d.ts.map +1 -1
- package/dist/atlas/diffusion/dimensions.js +8 -16
- package/dist/atlas/diffusion/dimensions.js.map +1 -1
- package/dist/atlas/diffusion/models.d.ts +3 -3
- package/dist/atlas/diffusion/models.d.ts.map +1 -1
- package/dist/atlas/diffusion/models.js +5 -10
- package/dist/atlas/diffusion/models.js.map +1 -1
- package/dist/atlas/diffusion/numerics.d.ts +16 -4
- package/dist/atlas/diffusion/numerics.d.ts.map +1 -1
- package/dist/atlas/diffusion/numerics.js +38 -24
- package/dist/atlas/diffusion/numerics.js.map +1 -1
- package/dist/atlas/link-prediction.d.ts +106 -3
- package/dist/atlas/link-prediction.d.ts.map +1 -1
- package/dist/atlas/link-prediction.js +212 -66
- package/dist/atlas/link-prediction.js.map +1 -1
- package/dist/atlas/oscillators/bridges-coarse.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-coarse.js +7 -11
- package/dist/atlas/oscillators/bridges-coarse.js.map +1 -1
- package/dist/atlas/oscillators/bridges-exact.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-exact.js +6 -7
- package/dist/atlas/oscillators/bridges-exact.js.map +1 -1
- package/dist/atlas/oscillators/bridges-limits.d.ts +3 -16
- package/dist/atlas/oscillators/bridges-limits.d.ts.map +1 -1
- package/dist/atlas/oscillators/bridges-limits.js +23 -34
- package/dist/atlas/oscillators/bridges-limits.js.map +1 -1
- package/dist/atlas/oscillators/dimensions.d.ts +9 -21
- package/dist/atlas/oscillators/dimensions.d.ts.map +1 -1
- package/dist/atlas/oscillators/dimensions.js +9 -21
- package/dist/atlas/oscillators/dimensions.js.map +1 -1
- package/dist/atlas/oscillators/limit-witnesses.d.ts +2 -2
- package/dist/atlas/oscillators/limit-witnesses.d.ts.map +1 -1
- package/dist/atlas/oscillators/limit-witnesses.js +17 -15
- package/dist/atlas/oscillators/limit-witnesses.js.map +1 -1
- package/dist/atlas/oscillators/models.d.ts.map +1 -1
- package/dist/atlas/oscillators/models.js +2 -6
- package/dist/atlas/oscillators/models.js.map +1 -1
- package/dist/atlas/oscillators/pendulum-motion.d.ts +29 -6
- package/dist/atlas/oscillators/pendulum-motion.d.ts.map +1 -1
- package/dist/atlas/oscillators/pendulum-motion.js +60 -40
- package/dist/atlas/oscillators/pendulum-motion.js.map +1 -1
- package/dist/atlas/oscillators/phase-translation.d.ts +0 -11
- package/dist/atlas/oscillators/phase-translation.d.ts.map +1 -1
- package/dist/atlas/oscillators/phase-translation.js +3 -4
- package/dist/atlas/oscillators/phase-translation.js.map +1 -1
- package/dist/atlas/oscillators/position-translation.d.ts +68 -7
- package/dist/atlas/oscillators/position-translation.d.ts.map +1 -1
- package/dist/atlas/oscillators/position-translation.js +123 -12
- package/dist/atlas/oscillators/position-translation.js.map +1 -1
- package/dist/atlas/oscillators/rejections.d.ts +0 -2
- package/dist/atlas/oscillators/rejections.d.ts.map +1 -1
- package/dist/atlas/oscillators/rejections.js +0 -7
- package/dist/atlas/oscillators/rejections.js.map +1 -1
- package/dist/atlas/physjs-entries.generated.d.ts +35 -25
- package/dist/atlas/physjs-entries.generated.d.ts.map +1 -1
- package/dist/atlas/physjs-entries.generated.js +37 -25
- package/dist/atlas/physjs-entries.generated.js.map +1 -1
- package/dist/atlas/physjs-ref.d.ts +34 -31
- package/dist/atlas/physjs-ref.d.ts.map +1 -1
- package/dist/atlas/physjs-ref.js +55 -53
- package/dist/atlas/physjs-ref.js.map +1 -1
- package/dist/atlas/physjs-reviewed.d.ts +1 -1
- package/dist/atlas/physjs-reviewed.js +15 -15
- package/dist/atlas/physjs-reviewed.js.map +1 -1
- package/dist/atlas/poster/statements.d.ts +0 -19
- package/dist/atlas/poster/statements.d.ts.map +1 -1
- package/dist/atlas/poster/statements.js +1 -1
- package/dist/atlas/poster/statements.js.map +1 -1
- package/dist/atlas/proof-target.d.ts +1 -1
- package/dist/atlas/proof-target.js +1 -1
- package/dist/atlas/proof-target.js.map +1 -1
- package/dist/atlas/regime.d.ts +1 -1
- 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/text-overlap.d.ts +23 -0
- package/dist/atlas/text-overlap.d.ts.map +1 -0
- package/dist/atlas/text-overlap.js +41 -0
- package/dist/atlas/text-overlap.js.map +1 -0
- package/dist/atlas/waves/bridges-closure.d.ts.map +1 -1
- package/dist/atlas/waves/bridges-closure.js +2 -6
- package/dist/atlas/waves/bridges-closure.js.map +1 -1
- package/dist/atlas/waves/bridges.d.ts.map +1 -1
- package/dist/atlas/waves/bridges.js +32 -48
- package/dist/atlas/waves/bridges.js.map +1 -1
- package/dist/atlas/waves/models.d.ts +5 -6
- package/dist/atlas/waves/models.d.ts.map +1 -1
- package/dist/atlas/waves/models.js +7 -13
- package/dist/atlas/waves/models.js.map +1 -1
- package/dist/atlas/waves/numerics.d.ts.map +1 -1
- package/dist/atlas/waves/numerics.js +10 -3
- package/dist/atlas/waves/numerics.js.map +1 -1
- package/dist/atlas/witness-numeric.d.ts +30 -0
- package/dist/atlas/witness-numeric.d.ts.map +1 -1
- package/dist/atlas/witness-numeric.js +53 -0
- package/dist/atlas/witness-numeric.js.map +1 -1
- package/dist/atlas/witness-specs.d.ts.map +1 -1
- package/dist/atlas/witness-specs.js +19 -0
- package/dist/atlas/witness-specs.js.map +1 -1
- package/dist/atlas/witness-symbolic.d.ts +75 -3
- package/dist/atlas/witness-symbolic.d.ts.map +1 -1
- package/dist/atlas/witness-symbolic.js +116 -10
- package/dist/atlas/witness-symbolic.js.map +1 -1
- package/dist/bridges/catalog-load.d.ts.map +1 -1
- package/dist/bridges/catalog-load.js +13 -8
- package/dist/bridges/catalog-load.js.map +1 -1
- package/dist/bridges/catalog-types.d.ts +26 -2
- package/dist/bridges/catalog-types.d.ts.map +1 -1
- package/dist/bridges/catalog-types.js +11 -1
- package/dist/bridges/catalog-types.js.map +1 -1
- package/dist/bridges/evaluation-errors.d.ts +31 -1
- package/dist/bridges/evaluation-errors.d.ts.map +1 -1
- package/dist/bridges/evaluation-errors.js +20 -2
- package/dist/bridges/evaluation-errors.js.map +1 -1
- package/dist/bridges/evaluator-inputs.d.ts.map +1 -1
- package/dist/bridges/evaluator-inputs.js +7 -5
- package/dist/bridges/evaluator-inputs.js.map +1 -1
- package/dist/bridges/evaluators.d.ts.map +1 -1
- package/dist/bridges/evaluators.js +27 -12
- package/dist/bridges/evaluators.js.map +1 -1
- package/dist/bridges/expr-parse.d.ts +11 -0
- package/dist/bridges/expr-parse.d.ts.map +1 -1
- package/dist/bridges/expr-parse.js +14 -5
- package/dist/bridges/expr-parse.js.map +1 -1
- package/dist/bridges/holds.d.ts +35 -3
- package/dist/bridges/holds.d.ts.map +1 -1
- package/dist/bridges/holds.js +117 -23
- package/dist/bridges/holds.js.map +1 -1
- package/dist/bridges/notices.d.ts.map +1 -1
- package/dist/bridges/notices.js +5 -5
- package/dist/bridges/notices.js.map +1 -1
- package/dist/bridges/relation-eval.d.ts +4 -4
- package/dist/bridges/relation-eval.d.ts.map +1 -1
- package/dist/bridges/relation-eval.js +15 -16
- package/dist/bridges/relation-eval.js.map +1 -1
- package/dist/bridges/sensitivity.d.ts.map +1 -1
- package/dist/bridges/sensitivity.js +3 -3
- package/dist/bridges/sensitivity.js.map +1 -1
- package/dist/bridges/validity.d.ts +33 -0
- package/dist/bridges/validity.d.ts.map +1 -0
- package/dist/bridges/validity.js +67 -0
- package/dist/bridges/validity.js.map +1 -0
- package/dist/canonical/entries/atomic.js +1 -3
- package/dist/canonical/entries/atomic.js.map +1 -1
- package/dist/canonical/entries/condensed-matter.d.ts.map +1 -1
- package/dist/canonical/entries/condensed-matter.js +4 -5
- package/dist/canonical/entries/condensed-matter.js.map +1 -1
- package/dist/canonical/entries/dimensional-classics.d.ts.map +1 -1
- package/dist/canonical/entries/dimensional-classics.js +3 -4
- package/dist/canonical/entries/dimensional-classics.js.map +1 -1
- package/dist/canonical/entries/electromagnetism.d.ts.map +1 -1
- package/dist/canonical/entries/electromagnetism.js +4 -10
- package/dist/canonical/entries/electromagnetism.js.map +1 -1
- package/dist/canonical/entries/fluids-waves.d.ts.map +1 -1
- package/dist/canonical/entries/fluids-waves.js +3 -7
- package/dist/canonical/entries/fluids-waves.js.map +1 -1
- package/dist/canonical/entries/mechanics.d.ts.map +1 -1
- package/dist/canonical/entries/mechanics.js +4 -6
- package/dist/canonical/entries/mechanics.js.map +1 -1
- package/dist/canonical/entries/nonmonomial.d.ts.map +1 -1
- package/dist/canonical/entries/nonmonomial.js +9 -17
- package/dist/canonical/entries/nonmonomial.js.map +1 -1
- package/dist/canonical/entries/relativity.d.ts.map +1 -1
- package/dist/canonical/entries/relativity.js +6 -6
- package/dist/canonical/entries/relativity.js.map +1 -1
- package/dist/canonical/entries/thermo-nuclear-cosmo.d.ts.map +1 -1
- package/dist/canonical/entries/thermo-nuclear-cosmo.js +6 -10
- package/dist/canonical/entries/thermo-nuclear-cosmo.js.map +1 -1
- package/dist/canonical/fixed-points.d.ts +94 -0
- package/dist/canonical/fixed-points.d.ts.map +1 -0
- package/dist/canonical/fixed-points.js +81 -0
- package/dist/canonical/fixed-points.js.map +1 -0
- package/dist/canonical/linkage.d.ts.map +1 -1
- package/dist/canonical/linkage.js +25 -44
- package/dist/canonical/linkage.js.map +1 -1
- package/dist/canonical/normal-form.d.ts.map +1 -1
- package/dist/canonical/normal-form.js +5 -11
- package/dist/canonical/normal-form.js.map +1 -1
- package/dist/canonical/structural.d.ts +21 -21
- package/dist/canonical/structural.d.ts.map +1 -1
- package/dist/canonical/structural.js +40 -19
- package/dist/canonical/structural.js.map +1 -1
- package/dist/cases/catalog-checks.d.ts +10 -0
- package/dist/cases/catalog-checks.d.ts.map +1 -0
- package/dist/cases/catalog-checks.js +241 -0
- package/dist/cases/catalog-checks.js.map +1 -0
- package/dist/cases/catalog.d.ts +83 -0
- package/dist/cases/catalog.d.ts.map +1 -0
- package/dist/cases/catalog.js +118 -0
- package/dist/cases/catalog.js.map +1 -0
- package/dist/cases/engine.d.ts +13 -0
- package/dist/cases/engine.d.ts.map +1 -0
- package/dist/cases/engine.js +179 -0
- package/dist/cases/engine.js.map +1 -0
- package/dist/cases/index.d.ts.map +1 -1
- package/dist/cases/index.js +5 -7
- package/dist/cases/index.js.map +1 -1
- package/dist/cases/methods.d.ts +215 -0
- package/dist/cases/methods.d.ts.map +1 -0
- package/dist/cases/methods.js +743 -0
- package/dist/cases/methods.js.map +1 -0
- package/dist/cases/quadrature.d.ts +7 -9
- package/dist/cases/quadrature.d.ts.map +1 -1
- package/dist/cases/quadrature.js +28 -32
- package/dist/cases/quadrature.js.map +1 -1
- package/dist/cases/types.d.ts +12 -0
- package/dist/cases/types.d.ts.map +1 -1
- package/dist/cases/types.js.map +1 -1
- package/dist/cli/args.d.ts +25 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +30 -8
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/bindings.d.ts.map +1 -1
- package/dist/cli/bindings.js +5 -4
- package/dist/cli/bindings.js.map +1 -1
- package/dist/cli/command.d.ts +11 -1
- package/dist/cli/command.d.ts.map +1 -1
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/commands/_atlas-map.d.ts +0 -9
- package/dist/cli/commands/_atlas-map.d.ts.map +1 -1
- package/dist/cli/commands/_atlas-map.js +8 -18
- package/dist/cli/commands/_atlas-map.js.map +1 -1
- package/dist/cli/commands/_atlas-route.d.ts.map +1 -1
- package/dist/cli/commands/_atlas-route.js +6 -2
- package/dist/cli/commands/_atlas-route.js.map +1 -1
- package/dist/cli/commands/_discovery-opts.d.ts +1 -0
- package/dist/cli/commands/_discovery-opts.d.ts.map +1 -1
- package/dist/cli/commands/_discovery-opts.js +9 -9
- package/dist/cli/commands/_discovery-opts.js.map +1 -1
- package/dist/cli/commands/atlas.d.ts.map +1 -1
- package/dist/cli/commands/atlas.js +8 -5
- 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 +8 -1
- 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 +20 -1
- package/dist/cli/commands/axes.js.map +1 -1
- package/dist/cli/commands/confront.d.ts.map +1 -1
- package/dist/cli/commands/confront.js +8 -14
- package/dist/cli/commands/confront.js.map +1 -1
- package/dist/cli/commands/derive.d.ts.map +1 -1
- package/dist/cli/commands/derive.js +22 -22
- 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 +122 -73
- 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 +1 -0
- package/dist/cli/commands/eval.js.map +1 -1
- package/dist/cli/commands/evaluate.d.ts.map +1 -1
- package/dist/cli/commands/evaluate.js +67 -39
- 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 +24 -3
- package/dist/cli/commands/explain.js.map +1 -1
- package/dist/cli/commands/ground.d.ts.map +1 -1
- package/dist/cli/commands/ground.js +7 -1
- package/dist/cli/commands/ground.js.map +1 -1
- package/dist/cli/commands/map.d.ts.map +1 -1
- package/dist/cli/commands/map.js +84 -11
- 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 +12 -9
- package/dist/cli/commands/metric.js.map +1 -1
- package/dist/cli/commands/path.d.ts +10 -0
- package/dist/cli/commands/path.d.ts.map +1 -1
- package/dist/cli/commands/path.js +25 -3
- package/dist/cli/commands/path.js.map +1 -1
- package/dist/cli/commands/probe.d.ts.map +1 -1
- package/dist/cli/commands/probe.js +59 -16
- package/dist/cli/commands/probe.js.map +1 -1
- package/dist/cli/commands/regime.d.ts.map +1 -1
- package/dist/cli/commands/regime.js +1 -0
- 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 +1 -0
- 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 +1 -0
- 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 +19 -28
- 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 +4 -2
- package/dist/cli/commands/testplan.js.map +1 -1
- package/dist/cli/determination.d.ts +1 -0
- package/dist/cli/determination.d.ts.map +1 -1
- package/dist/cli/determination.js.map +1 -1
- package/dist/cli/expr-print.d.ts +0 -2
- package/dist/cli/expr-print.d.ts.map +1 -1
- package/dist/cli/expr-print.js +7 -31
- package/dist/cli/expr-print.js.map +1 -1
- package/dist/cli/flag-help.d.ts +1 -0
- package/dist/cli/flag-help.d.ts.map +1 -1
- package/dist/cli/flag-help.js +1 -0
- package/dist/cli/flag-help.js.map +1 -1
- package/dist/cli/graphs.d.ts +2 -0
- package/dist/cli/graphs.d.ts.map +1 -1
- package/dist/cli/graphs.js +1 -0
- package/dist/cli/graphs.js.map +1 -1
- package/dist/cli/main.d.ts +8 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +19 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/numeric-flag.d.ts +12 -0
- package/dist/cli/numeric-flag.d.ts.map +1 -0
- package/dist/cli/numeric-flag.js +44 -0
- package/dist/cli/numeric-flag.js.map +1 -0
- package/dist/cli/output.d.ts +28 -0
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +23 -0
- package/dist/cli/output.js.map +1 -1
- package/dist/cli/record-reach.js +2 -2
- package/dist/cli/record-reach.js.map +1 -1
- package/dist/cli/record-tables.d.ts.map +1 -1
- package/dist/cli/record-tables.js +6 -5
- package/dist/cli/record-tables.js.map +1 -1
- package/dist/cli/record.d.ts +1 -5
- package/dist/cli/record.d.ts.map +1 -1
- package/dist/cli/record.js +9 -8
- package/dist/cli/record.js.map +1 -1
- package/dist/cli/search-index.d.ts.map +1 -1
- package/dist/cli/search-index.js +7 -6
- package/dist/cli/search-index.js.map +1 -1
- package/dist/cli/statuses.d.ts +0 -2
- package/dist/cli/statuses.d.ts.map +1 -1
- package/dist/cli/statuses.js +12 -9
- package/dist/cli/statuses.js.map +1 -1
- package/dist/cli/stored-results.d.ts +7 -0
- package/dist/cli/stored-results.d.ts.map +1 -0
- package/dist/cli/stored-results.js +23 -0
- package/dist/cli/stored-results.js.map +1 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.d.ts.map +1 -1
- package/dist/cli/version.js +8 -5
- package/dist/cli/version.js.map +1 -1
- package/dist/cli-api.d.ts +36 -5
- package/dist/cli-api.d.ts.map +1 -1
- package/dist/cli-api.js +30 -4
- package/dist/cli-api.js.map +1 -1
- package/dist/composition/algebraic-equivalence.d.ts +43 -0
- package/dist/composition/algebraic-equivalence.d.ts.map +1 -0
- package/dist/composition/algebraic-equivalence.js +115 -0
- package/dist/composition/algebraic-equivalence.js.map +1 -0
- package/dist/composition/axes.d.ts +0 -6
- package/dist/composition/axes.d.ts.map +1 -1
- package/dist/composition/axes.js +6 -6
- package/dist/composition/axes.js.map +1 -1
- package/dist/composition/axis-audit.d.ts +47 -20
- package/dist/composition/axis-audit.d.ts.map +1 -1
- package/dist/composition/axis-audit.js +82 -9
- package/dist/composition/axis-audit.js.map +1 -1
- package/dist/composition/bridge-analysis.d.ts +17 -0
- package/dist/composition/bridge-analysis.d.ts.map +1 -1
- package/dist/composition/bridge-analysis.js +102 -55
- package/dist/composition/bridge-analysis.js.map +1 -1
- package/dist/composition/canonical-compare.d.ts +40 -0
- package/dist/composition/canonical-compare.d.ts.map +1 -1
- package/dist/composition/canonical-compare.js +122 -24
- package/dist/composition/canonical-compare.js.map +1 -1
- package/dist/composition/canonical-graph.d.ts +3 -3
- package/dist/composition/canonical-graph.d.ts.map +1 -1
- package/dist/composition/canonical-graph.js +11 -38
- package/dist/composition/canonical-graph.js.map +1 -1
- package/dist/composition/canonical-json.js +2 -2
- package/dist/composition/canonical-json.js.map +1 -1
- package/dist/composition/catalog-graph.d.ts.map +1 -1
- package/dist/composition/catalog-graph.js +2 -5
- package/dist/composition/catalog-graph.js.map +1 -1
- package/dist/composition/chain-candidate.d.ts +8 -0
- package/dist/composition/chain-candidate.d.ts.map +1 -1
- package/dist/composition/chain-candidate.js +9 -2
- package/dist/composition/chain-candidate.js.map +1 -1
- package/dist/composition/chain-match.d.ts +6 -3
- package/dist/composition/chain-match.d.ts.map +1 -1
- package/dist/composition/chain-match.js +4 -1
- package/dist/composition/chain-match.js.map +1 -1
- package/dist/composition/chain-result.d.ts.map +1 -1
- package/dist/composition/chain-result.js +2 -14
- package/dist/composition/chain-result.js.map +1 -1
- package/dist/composition/compose-symbolic.d.ts.map +1 -1
- package/dist/composition/compose-symbolic.js +3 -2
- package/dist/composition/compose-symbolic.js.map +1 -1
- package/dist/composition/compose.d.ts.map +1 -1
- package/dist/composition/compose.js +13 -5
- package/dist/composition/compose.js.map +1 -1
- package/dist/composition/composition-recovery.d.ts.map +1 -1
- package/dist/composition/composition-recovery.js +4 -7
- package/dist/composition/composition-recovery.js.map +1 -1
- package/dist/composition/consequence.d.ts +15 -5
- package/dist/composition/consequence.d.ts.map +1 -1
- package/dist/composition/consequence.js +6 -4
- package/dist/composition/consequence.js.map +1 -1
- package/dist/composition/discovery.d.ts +129 -9
- package/dist/composition/discovery.d.ts.map +1 -1
- package/dist/composition/discovery.js +171 -67
- package/dist/composition/discovery.js.map +1 -1
- package/dist/composition/edge.d.ts +21 -2
- package/dist/composition/edge.d.ts.map +1 -1
- package/dist/composition/edge.js +23 -1
- package/dist/composition/edge.js.map +1 -1
- package/dist/composition/enumerate.d.ts.map +1 -1
- package/dist/composition/enumerate.js +18 -3
- package/dist/composition/enumerate.js.map +1 -1
- package/dist/composition/evaluate-relation.d.ts +35 -11
- package/dist/composition/evaluate-relation.d.ts.map +1 -1
- package/dist/composition/evaluate-relation.js +60 -39
- package/dist/composition/evaluate-relation.js.map +1 -1
- package/dist/composition/explain.d.ts +3 -12
- package/dist/composition/explain.d.ts.map +1 -1
- package/dist/composition/explain.js +7 -20
- package/dist/composition/explain.js.map +1 -1
- package/dist/composition/expr-eval.d.ts +1 -1
- package/dist/composition/expr-eval.d.ts.map +1 -1
- package/dist/composition/expr-eval.js +6 -15
- package/dist/composition/expr-eval.js.map +1 -1
- package/dist/composition/expr-simplify.d.ts +26 -14
- package/dist/composition/expr-simplify.d.ts.map +1 -1
- package/dist/composition/expr-simplify.js +64 -72
- package/dist/composition/expr-simplify.js.map +1 -1
- package/dist/composition/formula-shape.d.ts +23 -4
- package/dist/composition/formula-shape.d.ts.map +1 -1
- package/dist/composition/formula-shape.js +57 -17
- package/dist/composition/formula-shape.js.map +1 -1
- package/dist/composition/graph-structure.d.ts +98 -0
- package/dist/composition/graph-structure.d.ts.map +1 -0
- package/dist/composition/graph-structure.js +167 -0
- package/dist/composition/graph-structure.js.map +1 -0
- package/dist/composition/graph-viz-svg.d.ts.map +1 -1
- package/dist/composition/graph-viz-svg.js +1 -1
- package/dist/composition/graph-viz-svg.js.map +1 -1
- package/dist/composition/graph-viz.d.ts.map +1 -1
- package/dist/composition/graph-viz.js +8 -37
- package/dist/composition/graph-viz.js.map +1 -1
- package/dist/composition/grounding.d.ts.map +1 -1
- package/dist/composition/grounding.js +19 -7
- package/dist/composition/grounding.js.map +1 -1
- package/dist/composition/identifiability.d.ts +91 -4
- package/dist/composition/identifiability.d.ts.map +1 -1
- package/dist/composition/identifiability.js +363 -6
- package/dist/composition/identifiability.js.map +1 -1
- package/dist/composition/index.d.ts +8 -4
- package/dist/composition/index.d.ts.map +1 -1
- package/dist/composition/index.js +3 -2
- package/dist/composition/index.js.map +1 -1
- package/dist/composition/mathts-quiet.d.ts +7 -8
- package/dist/composition/mathts-quiet.d.ts.map +1 -1
- package/dist/composition/mathts-quiet.js +7 -16
- package/dist/composition/mathts-quiet.js.map +1 -1
- package/dist/composition/mathts-scalar-symbols.d.ts.map +1 -1
- package/dist/composition/mathts-scalar-symbols.js +2 -1
- package/dist/composition/mathts-scalar-symbols.js.map +1 -1
- package/dist/composition/own-equation-magnitude.d.ts +95 -0
- package/dist/composition/own-equation-magnitude.d.ts.map +1 -0
- package/dist/composition/own-equation-magnitude.js +270 -0
- package/dist/composition/own-equation-magnitude.js.map +1 -0
- package/dist/composition/probe/backend-protocol.d.ts +3 -0
- package/dist/composition/probe/backend-protocol.d.ts.map +1 -1
- package/dist/composition/probe/backend-protocol.js.map +1 -1
- package/dist/composition/probe/candidate-store.d.ts +1 -0
- package/dist/composition/probe/candidate-store.d.ts.map +1 -1
- package/dist/composition/probe/candidate-store.js +1 -0
- package/dist/composition/probe/candidate-store.js.map +1 -1
- package/dist/composition/probe/corpus.d.ts +8 -4
- package/dist/composition/probe/corpus.d.ts.map +1 -1
- package/dist/composition/probe/corpus.js +23 -12
- package/dist/composition/probe/corpus.js.map +1 -1
- package/dist/composition/probe/dataset.d.ts +18 -0
- package/dist/composition/probe/dataset.d.ts.map +1 -1
- package/dist/composition/probe/dataset.js +95 -50
- package/dist/composition/probe/dataset.js.map +1 -1
- package/dist/composition/probe/experiment-design.d.ts +7 -1
- package/dist/composition/probe/experiment-design.d.ts.map +1 -1
- package/dist/composition/probe/experiment-design.js +44 -24
- package/dist/composition/probe/experiment-design.js.map +1 -1
- package/dist/composition/probe/falsify.d.ts +2 -0
- package/dist/composition/probe/falsify.d.ts.map +1 -1
- package/dist/composition/probe/falsify.js +2 -0
- package/dist/composition/probe/falsify.js.map +1 -1
- package/dist/composition/probe/fit.d.ts +7 -0
- package/dist/composition/probe/fit.d.ts.map +1 -1
- package/dist/composition/probe/fit.js +46 -22
- package/dist/composition/probe/fit.js.map +1 -1
- package/dist/composition/probe/frontier.d.ts.map +1 -1
- package/dist/composition/probe/frontier.js +33 -15
- package/dist/composition/probe/frontier.js.map +1 -1
- package/dist/composition/probe/generator.d.ts +30 -1
- package/dist/composition/probe/generator.d.ts.map +1 -1
- package/dist/composition/probe/generator.js +58 -36
- package/dist/composition/probe/generator.js.map +1 -1
- package/dist/composition/probe/index.d.ts +14 -0
- package/dist/composition/probe/index.d.ts.map +1 -1
- package/dist/composition/probe/index.js +6 -0
- package/dist/composition/probe/index.js.map +1 -1
- package/dist/composition/probe/limits.d.ts +25 -1
- package/dist/composition/probe/limits.d.ts.map +1 -1
- package/dist/composition/probe/limits.js +53 -11
- package/dist/composition/probe/limits.js.map +1 -1
- package/dist/composition/probe/pipeline.d.ts +5 -0
- package/dist/composition/probe/pipeline.d.ts.map +1 -1
- package/dist/composition/probe/pipeline.js +73 -24
- package/dist/composition/probe/pipeline.js.map +1 -1
- package/dist/composition/probe/power-law.d.ts +121 -0
- package/dist/composition/probe/power-law.d.ts.map +1 -0
- package/dist/composition/probe/power-law.js +251 -0
- package/dist/composition/probe/power-law.js.map +1 -0
- package/dist/composition/probe/problem.d.ts +8 -4
- package/dist/composition/probe/problem.d.ts.map +1 -1
- package/dist/composition/probe/problem.js +177 -49
- package/dist/composition/probe/problem.js.map +1 -1
- package/dist/composition/probe/report.js +1 -1
- package/dist/composition/probe/report.js.map +1 -1
- package/dist/composition/probe/residual.d.ts +7 -1
- package/dist/composition/probe/residual.d.ts.map +1 -1
- package/dist/composition/probe/residual.js +10 -7
- package/dist/composition/probe/residual.js.map +1 -1
- package/dist/composition/probe/run-manifest.d.ts +1 -0
- package/dist/composition/probe/run-manifest.d.ts.map +1 -1
- package/dist/composition/probe/run-manifest.js.map +1 -1
- package/dist/composition/probe/scalar-search.d.ts +50 -0
- package/dist/composition/probe/scalar-search.d.ts.map +1 -0
- package/dist/composition/probe/scalar-search.js +169 -0
- package/dist/composition/probe/scalar-search.js.map +1 -0
- package/dist/composition/probe/scoring.d.ts +1 -0
- package/dist/composition/probe/scoring.d.ts.map +1 -1
- package/dist/composition/probe/scoring.js.map +1 -1
- package/dist/composition/probe/structure.d.ts +82 -17
- package/dist/composition/probe/structure.d.ts.map +1 -1
- package/dist/composition/probe/structure.js +129 -55
- package/dist/composition/probe/structure.js.map +1 -1
- package/dist/composition/probe/study.d.ts +31 -9
- package/dist/composition/probe/study.d.ts.map +1 -1
- package/dist/composition/probe/study.js +235 -184
- package/dist/composition/probe/study.js.map +1 -1
- package/dist/composition/probe/t-tail.d.ts +16 -0
- package/dist/composition/probe/t-tail.d.ts.map +1 -0
- package/dist/composition/probe/t-tail.js +29 -0
- package/dist/composition/probe/t-tail.js.map +1 -0
- package/dist/composition/probe/types.d.ts +3 -0
- package/dist/composition/probe/types.d.ts.map +1 -1
- package/dist/composition/probe/types.js.map +1 -1
- package/dist/composition/proposed-bridges.d.ts +52 -12
- package/dist/composition/proposed-bridges.d.ts.map +1 -1
- package/dist/composition/proposed-bridges.js +107 -60
- package/dist/composition/proposed-bridges.js.map +1 -1
- package/dist/composition/quantity-clusters.d.ts +48 -0
- package/dist/composition/quantity-clusters.d.ts.map +1 -0
- package/dist/composition/quantity-clusters.js +98 -0
- package/dist/composition/quantity-clusters.js.map +1 -0
- package/dist/composition/rational-exponent.d.ts +40 -0
- package/dist/composition/rational-exponent.d.ts.map +1 -0
- package/dist/composition/rational-exponent.js +65 -0
- package/dist/composition/rational-exponent.js.map +1 -0
- package/dist/composition/representative-values.d.ts +22 -0
- package/dist/composition/representative-values.d.ts.map +1 -1
- package/dist/composition/representative-values.js +29 -0
- package/dist/composition/representative-values.js.map +1 -1
- package/dist/composition/retrodiction.d.ts +15 -0
- package/dist/composition/retrodiction.d.ts.map +1 -1
- package/dist/composition/retrodiction.js +12 -4
- package/dist/composition/retrodiction.js.map +1 -1
- package/dist/composition/user-equation.d.ts +1 -0
- package/dist/composition/user-equation.d.ts.map +1 -1
- package/dist/composition/user-equation.js +3 -2
- package/dist/composition/user-equation.js.map +1 -1
- package/dist/core/assignment.d.ts +19 -0
- package/dist/core/assignment.d.ts.map +1 -0
- package/dist/core/assignment.js +19 -0
- package/dist/core/assignment.js.map +1 -0
- package/dist/core/compare.d.ts +32 -0
- package/dist/core/compare.d.ts.map +1 -0
- package/dist/core/compare.js +46 -0
- package/dist/core/compare.js.map +1 -0
- package/dist/core/constants.d.ts +42 -41
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +71 -51
- package/dist/core/constants.js.map +1 -1
- package/dist/core/data-file.d.ts +7 -0
- package/dist/core/data-file.d.ts.map +1 -1
- package/dist/core/data-file.js +17 -0
- package/dist/core/data-file.js.map +1 -1
- package/dist/core/format.d.ts +36 -0
- package/dist/core/format.d.ts.map +1 -0
- package/dist/core/format.js +39 -0
- package/dist/core/format.js.map +1 -0
- package/dist/core/hash.d.ts +14 -0
- package/dist/core/hash.d.ts.map +1 -0
- package/dist/core/hash.js +17 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/json-schema.d.ts +2 -0
- package/dist/core/json-schema.d.ts.map +1 -1
- package/dist/core/json-schema.js +14 -13
- package/dist/core/json-schema.js.map +1 -1
- package/dist/core/labeled-tensor.d.ts.map +1 -1
- package/dist/core/labeled-tensor.js +0 -8
- package/dist/core/labeled-tensor.js.map +1 -1
- package/dist/core/mathts-read.d.ts +25 -0
- package/dist/core/mathts-read.d.ts.map +1 -0
- package/dist/core/mathts-read.js +51 -0
- package/dist/core/mathts-read.js.map +1 -0
- package/dist/core/tensor.d.ts.map +1 -1
- package/dist/core/tensor.js +24 -0
- package/dist/core/tensor.js.map +1 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/diff/bridge-ast-gradient.d.ts +27 -23
- package/dist/diff/bridge-ast-gradient.d.ts.map +1 -1
- package/dist/diff/bridge-ast-gradient.js +75 -173
- package/dist/diff/bridge-ast-gradient.js.map +1 -1
- package/dist/diff/bridge-gradient.d.ts +19 -6
- package/dist/diff/bridge-gradient.d.ts.map +1 -1
- package/dist/diff/bridge-gradient.js +19 -11
- package/dist/diff/bridge-gradient.js.map +1 -1
- package/dist/diff/bridge-specs.d.ts.map +1 -1
- package/dist/diff/bridge-specs.js +3 -0
- package/dist/diff/bridge-specs.js.map +1 -1
- package/dist/dimensional/algebra.d.ts +18 -0
- package/dist/dimensional/algebra.d.ts.map +1 -1
- package/dist/dimensional/algebra.js +41 -1
- package/dist/dimensional/algebra.js.map +1 -1
- package/dist/dimensional/ast-builders.d.ts +7 -0
- package/dist/dimensional/ast-builders.d.ts.map +1 -1
- package/dist/dimensional/ast-builders.js +11 -0
- package/dist/dimensional/ast-builders.js.map +1 -1
- package/dist/dimensional/ast-leaves.d.ts +81 -0
- package/dist/dimensional/ast-leaves.d.ts.map +1 -0
- package/dist/dimensional/ast-leaves.js +146 -0
- package/dist/dimensional/ast-leaves.js.map +1 -0
- package/dist/dimensional/ast-types.d.ts +15 -0
- package/dist/dimensional/ast-types.d.ts.map +1 -1
- package/dist/dimensional/ast-types.js.map +1 -1
- package/dist/dimensional/buckingham.d.ts.map +1 -1
- package/dist/dimensional/buckingham.js +15 -27
- package/dist/dimensional/buckingham.js.map +1 -1
- package/dist/dimensional/constant-rows.js +9 -9
- package/dist/dimensional/constant-rows.js.map +1 -1
- package/dist/dimensional/curvature-composite.d.ts +1 -1
- package/dist/dimensional/curvature-composite.js.map +1 -1
- package/dist/dimensional/dimension-inference.d.ts.map +1 -1
- package/dist/dimensional/dimension-inference.js +1 -2
- package/dist/dimensional/dimension-inference.js.map +1 -1
- package/dist/dimensional/errors.d.ts +1 -1
- package/dist/dimensional/errors.d.ts.map +1 -1
- package/dist/dimensional/errors.js +1 -15
- package/dist/dimensional/errors.js.map +1 -1
- package/dist/dimensional/exact-scale.d.ts +24 -11
- package/dist/dimensional/exact-scale.d.ts.map +1 -1
- package/dist/dimensional/exact-scale.js +122 -130
- package/dist/dimensional/exact-scale.js.map +1 -1
- package/dist/dimensional/gauge-field.d.ts.map +1 -1
- package/dist/dimensional/gauge-field.js +2 -2
- package/dist/dimensional/gauge-field.js.map +1 -1
- package/dist/dimensional/hyphen-names.d.ts +12 -2
- package/dist/dimensional/hyphen-names.d.ts.map +1 -1
- package/dist/dimensional/hyphen-names.js +44 -19
- package/dist/dimensional/hyphen-names.js.map +1 -1
- package/dist/dimensional/mathts-unit-delegation.d.ts +29 -0
- package/dist/dimensional/mathts-unit-delegation.d.ts.map +1 -0
- package/dist/dimensional/mathts-unit-delegation.js +187 -0
- package/dist/dimensional/mathts-unit-delegation.js.map +1 -0
- package/dist/dimensional/mathts-unit-wrapper.d.ts +33 -0
- package/dist/dimensional/mathts-unit-wrapper.d.ts.map +1 -0
- package/dist/dimensional/mathts-unit-wrapper.js +190 -0
- package/dist/dimensional/mathts-unit-wrapper.js.map +1 -0
- package/dist/dimensional/metric.d.ts.map +1 -1
- package/dist/dimensional/metric.js +0 -1
- package/dist/dimensional/metric.js.map +1 -1
- package/dist/dimensional/scalar-lowering.d.ts +21 -0
- package/dist/dimensional/scalar-lowering.d.ts.map +1 -0
- package/dist/dimensional/scalar-lowering.js +45 -0
- package/dist/dimensional/scalar-lowering.js.map +1 -0
- package/dist/dimensional/symbolic-constants.d.ts +9 -0
- package/dist/dimensional/symbolic-constants.d.ts.map +1 -1
- package/dist/dimensional/symbolic-constants.js +13 -1
- package/dist/dimensional/symbolic-constants.js.map +1 -1
- package/dist/dimensional/types.d.ts +36 -0
- package/dist/dimensional/types.d.ts.map +1 -1
- package/dist/dimensional/types.js +45 -7
- package/dist/dimensional/types.js.map +1 -1
- package/dist/dimensional/unit-data.d.ts +5 -1
- package/dist/dimensional/unit-data.d.ts.map +1 -1
- package/dist/dimensional/unit-data.js +30 -6
- package/dist/dimensional/unit-data.js.map +1 -1
- package/dist/dimensional/units.d.ts +2 -0
- package/dist/dimensional/units.d.ts.map +1 -1
- package/dist/dimensional/units.js +59 -3
- package/dist/dimensional/units.js.map +1 -1
- package/dist/dimensional/validator.d.ts +2 -0
- package/dist/dimensional/validator.d.ts.map +1 -1
- package/dist/dimensional/validator.js.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/numerical/christoffel-flat.d.ts.map +1 -1
- package/dist/numerical/christoffel-flat.js +3 -2
- package/dist/numerical/christoffel-flat.js.map +1 -1
- package/dist/numerical/connection-lowering-helpers.d.ts +3 -1
- package/dist/numerical/connection-lowering-helpers.d.ts.map +1 -1
- package/dist/numerical/connection-lowering-helpers.js +11 -15
- package/dist/numerical/connection-lowering-helpers.js.map +1 -1
- package/dist/numerical/covariant-eikonal.d.ts.map +1 -1
- package/dist/numerical/covariant-eikonal.js +34 -11
- package/dist/numerical/covariant-eikonal.js.map +1 -1
- package/dist/numerical/curvature-lowering-helpers.js +3 -2
- package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
- package/dist/numerical/errors.d.ts.map +1 -1
- package/dist/numerical/errors.js +0 -3
- package/dist/numerical/errors.js.map +1 -1
- package/dist/numerical/finite-difference.d.ts +22 -0
- package/dist/numerical/finite-difference.d.ts.map +1 -0
- package/dist/numerical/finite-difference.js +27 -0
- package/dist/numerical/finite-difference.js.map +1 -0
- package/dist/numerical/geodesic-integrator.d.ts.map +1 -1
- package/dist/numerical/geodesic-integrator.js +22 -14
- package/dist/numerical/geodesic-integrator.js.map +1 -1
- package/dist/numerical/geometrized.d.ts.map +1 -1
- package/dist/numerical/geometrized.js +0 -1
- package/dist/numerical/geometrized.js.map +1 -1
- package/dist/numerical/mathts-engine.d.ts.map +1 -1
- package/dist/numerical/mathts-engine.js +10 -24
- package/dist/numerical/mathts-engine.js.map +1 -1
- package/dist/numerical/metric-inverse.d.ts.map +1 -1
- package/dist/numerical/metric-inverse.js +83 -46
- package/dist/numerical/metric-inverse.js.map +1 -1
- package/dist/numerical/null-ray-integrator.d.ts +2 -1
- package/dist/numerical/null-ray-integrator.d.ts.map +1 -1
- package/dist/numerical/null-ray-integrator.js +12 -12
- package/dist/numerical/null-ray-integrator.js.map +1 -1
- package/dist/numerical/painleve-gullstrand-metric.js +2 -2
- package/dist/numerical/painleve-gullstrand-metric.js.map +1 -1
- package/dist/numerical/pderiv.d.ts.map +1 -1
- package/dist/numerical/pderiv.js +2 -6
- package/dist/numerical/pderiv.js.map +1 -1
- package/dist/numerical/perihelion-finder.d.ts +0 -36
- package/dist/numerical/perihelion-finder.d.ts.map +1 -1
- package/dist/numerical/perihelion-finder.js +41 -87
- package/dist/numerical/perihelion-finder.js.map +1 -1
- package/dist/numerical/quadrature.d.ts.map +1 -1
- package/dist/numerical/quadrature.js +11 -13
- package/dist/numerical/quadrature.js.map +1 -1
- package/dist/numerical/rk4-trajectory.d.ts +10 -0
- package/dist/numerical/rk4-trajectory.d.ts.map +1 -0
- package/dist/numerical/rk4-trajectory.js +37 -0
- package/dist/numerical/rk4-trajectory.js.map +1 -0
- package/dist/numerical/schwarzschild.d.ts +14 -0
- package/dist/numerical/schwarzschild.d.ts.map +1 -0
- package/dist/numerical/schwarzschild.js +17 -0
- package/dist/numerical/schwarzschild.js.map +1 -0
- package/dist/numerical/spacetime-metrics.d.ts +12 -0
- package/dist/numerical/spacetime-metrics.d.ts.map +1 -1
- package/dist/numerical/spacetime-metrics.js +72 -56
- package/dist/numerical/spacetime-metrics.js.map +1 -1
- package/dist/numerical/statistics.d.ts +24 -0
- package/dist/numerical/statistics.d.ts.map +1 -0
- package/dist/numerical/statistics.js +52 -0
- package/dist/numerical/statistics.js.map +1 -0
- package/dist/numerical/strides.d.ts +3 -2
- package/dist/numerical/strides.d.ts.map +1 -1
- package/dist/numerical/strides.js +3 -10
- package/dist/numerical/strides.js.map +1 -1
- package/dist/numerical/tensor-engine.d.ts +21 -0
- package/dist/numerical/tensor-engine.d.ts.map +1 -1
- package/dist/numerical/tensor-engine.js +12 -0
- package/dist/numerical/tensor-engine.js.map +1 -1
- package/dist/relations/regime.d.ts +10 -0
- package/dist/relations/regime.d.ts.map +1 -1
- package/dist/relations/regime.js +18 -1
- package/dist/relations/regime.js.map +1 -1
- package/package.json +9 -12
- package/dist/cases/brownian-sphere.d.ts +0 -68
- package/dist/cases/brownian-sphere.d.ts.map +0 -1
- package/dist/cases/brownian-sphere.js +0 -354
- package/dist/cases/brownian-sphere.js.map +0 -1
- package/dist/cases/damped-resonator.d.ts +0 -23
- package/dist/cases/damped-resonator.d.ts.map +0 -1
- package/dist/cases/damped-resonator.js +0 -224
- package/dist/cases/damped-resonator.js.map +0 -1
- package/dist/cases/kepler-rv.d.ts +0 -13
- package/dist/cases/kepler-rv.d.ts.map +0 -1
- package/dist/cases/kepler-rv.js +0 -172
- package/dist/cases/kepler-rv.js.map +0 -1
- package/dist/cases/lumped-cooling.d.ts +0 -46
- package/dist/cases/lumped-cooling.d.ts.map +0 -1
- package/dist/cases/lumped-cooling.js +0 -261
- package/dist/cases/lumped-cooling.js.map +0 -1
- package/dist/cases/resistor-noise.d.ts +0 -14
- package/dist/cases/resistor-noise.d.ts.map +0 -1
- package/dist/cases/resistor-noise.js +0 -215
- package/dist/cases/resistor-noise.js.map +0 -1
- package/dist/cases/skin-depth.d.ts +0 -21
- package/dist/cases/skin-depth.d.ts.map +0 -1
- package/dist/cases/skin-depth.js +0 -174
- package/dist/cases/skin-depth.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numerics.js","sourceRoot":"","sources":["../../../src/atlas/diffusion/numerics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,C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diffusion family's witnesses.\n *\n * Each function evaluates one claim at a RESOLUTION, so the numeric witness\n * runner can evaluate it twice and record how the error shrank. None of them\n * asserts an order of convergence; the runner reports the ratio and a reviewer\n * reads it (Phase 4 design note §2.3).\n *\n * @module atlas/diffusion/numerics\n */\n\nimport { solveODESystem } from '@danielsimonjr/mathts-functions';\n\n/**\n * The Gaussian solution of `∂c/∂t = D ∂²c/∂x²` from a point source of unit\n * mass, evaluated at `x`: `(4πDt)^{-1/2} exp(−x²/(4Dt))`.\n *\n * @internal\n */\nexport function diffusionKernel(x: number, t: number, D: number): number {\n return Math.exp(-(x * x) / (4 * D * t)) / Math.sqrt(4 * Math.PI * D * t);\n}\n\n/** `ln C(n, k)` by summing logs — exact enough for the n ≤ 10⁵ used here. */\nfunction logBinomial(n: number, k: number): number {\n let s = 0;\n for (let i = 1; i <= k; i++) s += Math.log(n - k + i) - Math.log(i);\n return s;\n}\n\n/**\n * WD1 — the probability DENSITY at the origin of a symmetric lattice random\n * walk after `steps` steps, under the closure `D = Δx²/(2Δt)` at fixed `D`\n * and `t`.\n *\n * With `Δt = t/steps` and `Δx = √(2DΔt)`, the walker sits at the origin with\n * probability `C(steps, steps/2)/2^steps`. Only every other site is reachable\n * after an even number of steps, so the probability is spread over a cell of\n * width `2Δx`, and the density is that probability divided by `2Δx`.\n * As `steps → ∞` it converges to {@link diffusionKernel}`(0, t, D)`.\n *\n * @param steps - the resolution; rounded up to the next even integer.\n * @internal\n */\nexport function randomWalkCentralDensity(steps: number, D: number, t: number): number {\n const n = 2 * Math.ceil(steps / 2);\n const dt = t / n;\n const dx = Math.sqrt(2 * D * dt);\n const logP = logBinomial(n, n / 2) - n * Math.LN2;\n return Math.exp(logP) / (2 * dx);\n}\n\n/**\n * WD1b — the random walk's density at lattice site `site` after `steps` steps\n * (same closure and grid as {@link randomWalkCentralDensity}). Exactly zero\n * outside the light cone `|site| > steps` and on sites of the wrong parity.\n *\n * @internal\n */\nexport function randomWalkDensity(site: number, steps: number, D: number, t: number): number {\n const n = 2 * Math.ceil(steps / 2);\n if (Math.abs(site) > n || (site + n) % 2 !== 0) return 0;\n const dx = Math.sqrt((2 * D * t) / n);\n const k = (n + site) / 2;\n return Math.exp(logBinomial(n, k) - n * Math.LN2) / (2 * dx);\n}\n\n/** Parameters of the WD2 heat-conduction fixture. @internal */\nexport interface HeatFixture {\n /** Thermal conductivity κ. */\n readonly kappa: number;\n /** Density ρ. */\n readonly rho: number;\n /** Specific heat capacity c_p. */\n readonly cp: number;\n /** Initial Gaussian width parameter: `T(x, 0) = exp(−x²/(4 s0))`. */\n readonly s0: number;\n /** Final time. */\n readonly tEnd: number;\n /**\n * Half-width of the domain. The edges are held at ZERO, not at the exact\n * solution: the exact solution is the Fick side of the claim, and feeding it\n * to the heat solver would leak the dictionary under test into the side that\n * is supposed to be independent of it. The true edge value is below\n * `exp(−halfWidth²/(4(s0 + D tEnd)))`, far under the tolerance.\n */\n readonly halfWidth: number;\n}\n\n/**\n * The exact solution of the DIFFUSION equation with coefficient `D` from the\n * WD2 initial condition: `√(s0/(s0 + D t)) · exp(−x²/(4(s0 + D t)))`.\n *\n * @internal\n */\nexport function gaussianSpread(x: number, t: number, D: number, s0: number): number {\n const s = s0 + D * t;\n return Math.sqrt(s0 / s) * Math.exp(-(x * x) / (4 * s));\n}\n\n/**\n * WD2 — the temperature at `x = 0, t = tEnd` from an explicit FTCS solution of\n * the HEAT equation `ρ c_p ∂T/∂t = κ ∂²T/∂x²` on `cells` intervals.\n *\n * The heat equation is solved in its OWN variables: the step uses `κ`, `ρ` and\n * `c_p`, never a pre-combined `D`. Comparing the result against\n * {@link gaussianSpread} with `D = κ/(ρ c_p)` is what tests the dictionary.\n * The mesh ratio `κΔt/(ρ c_p Δx²)` is held at or below 1/4, inside the FTCS\n * stability limit of 1/2, so refinement halves `Δx` and quarters `Δt`.\n *\n * @param cells - the resolution: the number of spatial intervals (made even so\n * `x = 0` is a node).\n * @internal\n */\nexport function heatFtcsCentre(cells: number, f: HeatFixture): number {\n const nx = 2 * Math.ceil(cells / 2);\n const dx = (2 * f.halfWidth) / nx;\n const capacity = f.rho * f.cp;\n const dtMax = (0.25 * capacity * dx * dx) / f.kappa;\n const steps = Math.ceil(f.tEnd / dtMax);\n const dt = f.tEnd / steps;\n const r = (f.kappa * dt) / (capacity * dx * dx);\n\n let u = new Float64Array(nx + 1);\n let next = new Float64Array(nx + 1);\n // The initial condition exp(−x²/(4 s0)) involves no diffusivity at all.\n for (let i = 0; i <= nx; i++) {\n const x = -f.halfWidth + i * dx;\n u[i] = Math.exp(-(x * x) / (4 * f.s0));\n }\n u[0] = 0;\n u[nx] = 0;\n for (let n = 1; n <= steps; n++) {\n for (let i = 1; i < nx; i++) {\n next[i] = u[i]! + r * (u[i + 1]! - 2 * u[i]! + u[i - 1]!);\n }\n next[0] = 0;\n next[nx] = 0;\n [u, next] = [next, u];\n }\n return u[nx / 2]!;\n}\n\n/** Parameters of the WD3 Wick-rotation fixture. @internal */\nexport interface WickFixture {\n readonly hbar: number;\n readonly m: number;\n /** Initial width of the α = 0 Gaussian. */\n readonly s: number;\n /** The point `(x, τ)` the residual is evaluated at. */\n readonly x: number;\n readonly tau: number;\n /** Base finite-difference step; the resolution divides it. */\n readonly h0: number;\n}\n\n/**\n * WD3 — the finite-difference residual `|∂_τ φ − (ħ/2m) ∂²_x φ|` of the\n * Wick-rotated free kernel `φ(x, τ)` (`witnesses/quantum-support.ts`, W5) at\n * one point, with step `h = h0/resolution` in both variables.\n *\n * The residual measures whether the Wick rotation `t = −iτ` of the free\n * Schrödinger equation really lands on the DIFFUSION equation with\n * `D = ħ/(2m)`. Its exact value is zero; the finite-difference estimate\n * approaches zero as `h` shrinks, and the runner records how fast.\n *\n * @internal\n */\nexport function wickHeatResidual(\n resolution: number,\n f: WickFixture,\n kernel: (x: number, tau: number, s: number, hbar: number, m: number) => number,\n): number {\n const h = f.h0 / resolution;\n const phi = (x: number, tau: number): number => kernel(x, tau, f.s, f.hbar, f.m);\n const dTau = (phi(f.x, f.tau + h) - phi(f.x, f.tau - h)) / (2 * h);\n const dXX = (phi(f.x + h, f.tau) - 2 * phi(f.x, f.tau) + phi(f.x - h, f.tau)) / (h * h);\n return Math.abs(dTau - (f.hbar / (2 * f.m)) * dXX);\n}\n\n/**\n * WD3b — `∫ φ(x, τ)² dx` of the Wick-rotated free kernel, by the trapezoid\n * rule over `[−halfWidth, halfWidth]`. The Schrödinger norm `∫|ψ|² dx` is\n * conserved; this one DECAYS with τ, which is the unitarity the continuation\n * does not preserve.\n *\n * @internal\n */\nexport function wickKernelSquaredNorm(\n tau: number,\n f: WickFixture,\n kernel: (x: number, tau: number, s: number, hbar: number, m: number) => number,\n halfWidth = 20,\n cells = 4000,\n): number {\n const dx = (2 * halfWidth) / cells;\n let sum = 0;\n for (let i = 0; i <= cells; i++) {\n const v = kernel(-halfWidth + i * dx, tau, f.s, f.hbar, f.m);\n sum += (i === 0 || i === cells ? 0.5 : 1) * v * v;\n }\n return sum * dx;\n}\n\n// ── Sprint 4 closure: Langevin, telegraph, steady state ────────────────────\n\n/** Parameters of the Langevin (Ornstein–Uhlenbeck) fixture. @internal */\nexport interface LangevinFixture {\n /** Particle mass m. */\n readonly m: number;\n /** Friction coefficient γ (force per velocity). */\n readonly gamma: number;\n /** Thermal energy k_B T. */\n readonly kT: number;\n}\n\n/**\n * WD4 — `⟨x²⟩(t) / (2Dt)` for the Langevin model `m v̇ = −γv + ξ`,\n * `⟨ξ(t)ξ(t′)⟩ = 2γ k_B T δ(t − t′)`, started from x = 0 with a thermalized\n * velocity, at `t = resolution · τ_p` where `τ_p = m/γ`.\n *\n * The second moments are integrated from the LANGEVIN model's own moment\n * equations, `d⟨x²⟩/dt = 2⟨xv⟩`, `d⟨xv⟩/dt = ⟨v²⟩ − (γ/m)⟨xv⟩`, with\n * `⟨v²⟩ = k_B T/m` held at equipartition, by `solveODESystem` with `dt` on a fine fixed grid. The\n * diffusion coefficient `D = k_B T/γ` (Einstein) enters only the DENOMINATOR:\n * the ratio tends to 1 in the diffusive regime `t ≫ τ_p`.\n *\n * @internal\n */\nexport function langevinMsdRatio(resolution: number, f: LangevinFixture): number {\n const tauP = f.m / f.gamma;\n const tEnd = resolution * tauP;\n const v2 = f.kT / f.m;\n const steps = Math.max(2000, Math.ceil(200 * resolution));\n const h = tEnd / steps;\n const sol = solveODESystem(\n (_t, y) => [2 * y[1]!, v2 - y[1]! / tauP],\n [0, 0],\n [0, steps * h],\n { dt: h },\n );\n const end = sol.y[sol.y.length - 1];\n const x2 = end?.[0] ?? Number.NaN;\n const D = f.kT / f.gamma;\n return x2 / (2 * D * tEnd);\n}\n\n/**\n * The slow decay rate of a Fourier mode of the TELEGRAPH equation\n * `τ u_tt + u_t = D u_xx`, divided by the diffusion rate `D q²`:\n * `(1 − √(1 − 4ε)) / (2ε)` with `ε = τ D q²`. Tends to 1 as τ → 0; complex\n * (oscillatory) for `ε > 1/4`, where it returns NaN.\n *\n * @internal\n */\nexport function telegraphSlowRateRatio(tau: number, D: number, q: number): number {\n const eps = tau * D * q * q;\n if (eps === 0) return 1;\n const disc = 1 - 4 * eps;\n if (disc < 0) return Number.NaN;\n return (1 - Math.sqrt(disc)) / (2 * eps);\n}\n\n/**\n * The oscillation frequency of a telegraph mode in its underdamped range,\n * divided by the undamped wave frequency `c q` with `c² = D/τ`:\n * `√(1 − 1/(4ε))`, `ε = τ D q²`. Tends to 1 as ε grows.\n *\n * @internal\n */\nexport function telegraphWaveFrequencyRatio(tau: number, D: number, q: number): number {\n const eps = tau * D * q * q;\n if (eps <= 0.25) return Number.NaN;\n return Math.sqrt(1 - 1 / (4 * eps));\n}\n\n/** Parameters of the WD8 steady-state fixture. @internal */\nexport interface SteadyStateFixture {\n /** Thermal diffusivity α (= κ/(ρ c_p)). */\n readonly alpha: number;\n /** Rod length ℓ. */\n readonly ell: number;\n /** End temperatures. */\n readonly tLeft: number;\n readonly tRight: number;\n /** Base time; the resolution multiplies it. */\n readonly t0: number;\n readonly cells: number;\n}\n\n/**\n * WD8 — the largest deviation from the LINEAR steady profile (the Laplace\n * equation's solution) of an FTCS heat solution with fixed end temperatures,\n * started from a profile with a sin(πx/ℓ) bump, at `t = resolution · t0`.\n * Tends to zero as t → ∞: the steady state is the heat equation's attractor.\n * `reference` replaces the linear profile the deviation is measured against.\n *\n * @internal\n */\nexport function heatSteadyDeviation(\n resolution: number,\n f: SteadyStateFixture,\n reference?: (i: number, cells: number) => number,\n): number {\n const nx = f.cells;\n const dx = f.ell / nx;\n const dtMax = (0.25 * dx * dx) / f.alpha;\n const tEnd = resolution * f.t0;\n const steps = Math.ceil(tEnd / dtMax);\n const dt = tEnd / steps;\n const r = (f.alpha * dt) / (dx * dx);\n const linear = (i: number): number => f.tLeft + ((f.tRight - f.tLeft) * i) / nx;\n let u = new Float64Array(nx + 1);\n let next = new Float64Array(nx + 1);\n for (let i = 0; i <= nx; i++) u[i] = linear(i) + Math.sin((Math.PI * i) / nx);\n next[0] = f.tLeft;\n next[nx] = f.tRight;\n for (let n = 0; n < steps; n++) {\n for (let i = 1; i < nx; i++) next[i] = u[i]! + r * (u[i + 1]! - 2 * u[i]! + u[i - 1]!);\n [u, next] = [next, u];\n }\n // The deviation is measured against `reference` when given — the negative\n // control uses a WRONG steady state here — and against the linear Laplace\n // profile otherwise. The solver itself never sees the reference.\n const ref = reference ?? ((i: number) => linear(i));\n let worst = 0;\n for (let i = 0; i <= nx; i++) worst = Math.max(worst, Math.abs(u[i]! - ref(i, nx)));\n return worst;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"numerics.js","sourceRoot":"","sources":["../../../src/atlas/diffusion/numerics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,sGAAsG;AACtG,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,U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ourcesContent":["/**\n * Atlas Phase 4, S4.4 — the numerics behind the diffusion family's witnesses.\n *\n * Each function evaluates one claim at a RESOLUTION, so the numeric witness\n * runner can evaluate it twice and record how the error shrank. None of them\n * asserts an order of convergence; the runner reports the ratio and a reviewer\n * reads it (Phase 4 design note §2.3).\n *\n * @module atlas/diffusion/numerics\n */\n\nimport { trapz } from '@danielsimonjr/mathts-functions';\nimport { integrateRK4 } from '../../numerical/null-ray-integrator.js';\n// `logChoose` is `ln C(n, k)` through MathTS `lgamma`, the one owner of the log binomial coefficient.\nimport { logChoose } from '../../numerical/statistics.js';\n\n/**\n * The Gaussian solution of `∂c/∂t = D ∂²c/∂x²` from a point source of unit\n * mass, evaluated at `x`: `(4πDt)^{-1/2} exp(−x²/(4Dt))`.\n *\n * @internal\n */\nexport function diffusionKernel(x: number, t: number, D: number): number {\n return Math.exp(-(x * x) / (4 * D * t)) / Math.sqrt(4 * Math.PI * D * t);\n}\n\n/**\n * WD1 — the probability DENSITY at the origin of a symmetric lattice random\n * walk after `steps` steps, under the closure `D = Δx²/(2Δt)` at fixed `D`\n * and `t`.\n *\n * With `Δt = t/steps` and `Δx = √(2DΔt)`, the walker sits at the origin with\n * probability `C(steps, steps/2)/2^steps`. Only every other site is reachable\n * after an even number of steps, so the probability is spread over a cell of\n * width `2Δx`, and the density is that probability divided by `2Δx`.\n * As `steps → ∞` it converges to {@link diffusionKernel}`(0, t, D)`.\n *\n * @param steps - the resolution; rounded up to the next even integer.\n * @internal\n */\nexport function randomWalkCentralDensity(steps: number, D: number, t: number): number {\n const n = 2 * Math.ceil(steps / 2);\n const dt = t / n;\n const dx = Math.sqrt(2 * D * dt);\n const logP = logChoose(n, n / 2) - n * Math.LN2;\n return Math.exp(logP) / (2 * dx);\n}\n\n/**\n * WD1b — the random walk's density at lattice site `site` after `steps` steps\n * (same closure and grid as {@link randomWalkCentralDensity}). Exactly zero\n * outside the light cone `|site| > steps` and on sites of the wrong parity.\n *\n * @internal\n */\nexport function randomWalkDensity(site: number, steps: number, D: number, t: number): number {\n const n = 2 * Math.ceil(steps / 2);\n if (Math.abs(site) > n || (site + n) % 2 !== 0) return 0;\n const dx = Math.sqrt((2 * D * t) / n);\n const k = (n + site) / 2;\n return Math.exp(logChoose(n, k) - n * Math.LN2) / (2 * dx);\n}\n\n/** Parameters of the WD2 heat-conduction fixture. @internal */\nexport interface HeatFixture {\n /** Thermal conductivity κ. */\n readonly kappa: number;\n /** Density ρ. */\n readonly rho: number;\n /** Specific heat capacity c_p. */\n readonly cp: number;\n /** Initial Gaussian width parameter: `T(x, 0) = exp(−x²/(4 s0))`. */\n readonly s0: number;\n /** Final time. */\n readonly tEnd: number;\n /**\n * Half-width of the domain. The edges are held at ZERO, not at the exact\n * solution: the exact solution is the Fick side of the claim, and feeding it\n * to the heat solver would leak the dictionary under test into the side that\n * is supposed to be independent of it. The true edge value is below\n * `exp(−halfWidth²/(4(s0 + D tEnd)))`, far under the tolerance.\n */\n readonly halfWidth: number;\n}\n\n/**\n * The exact solution of the DIFFUSION equation with coefficient `D` from the\n * WD2 initial condition: `√(s0/(s0 + D t)) · exp(−x²/(4(s0 + D t)))`.\n *\n * @internal\n */\nexport function gaussianSpread(x: number, t: number, D: number, s0: number): number {\n const s = s0 + D * t;\n return Math.sqrt(s0 / s) * Math.exp(-(x * x) / (4 * s));\n}\n\n/**\n * WD2 — the temperature at `x = 0, t = tEnd` from an explicit FTCS solution of\n * the HEAT equation `ρ c_p ∂T/∂t = κ ∂²T/∂x²` on `cells` intervals.\n *\n * The heat equation is solved in its OWN variables: the step uses `κ`, `ρ` and\n * `c_p`, never a pre-combined `D`. Comparing the result against\n * {@link gaussianSpread} with `D = κ/(ρ c_p)` is what tests the dictionary.\n * The mesh ratio `κΔt/(ρ c_p Δx²)` is held at or below 1/4, inside the FTCS\n * stability limit of 1/2, so refinement halves `Δx` and quarters `Δt`.\n *\n * @param cells - the resolution: the number of spatial intervals (made even so\n * `x = 0` is a node).\n * @internal\n */\nexport function heatFtcsCentre(cells: number, f: HeatFixture): number {\n const nx = 2 * Math.ceil(cells / 2);\n const dx = (2 * f.halfWidth) / nx;\n const capacity = f.rho * f.cp;\n const dtMax = (0.25 * capacity * dx * dx) / f.kappa;\n const steps = Math.ceil(f.tEnd / dtMax);\n const dt = f.tEnd / steps;\n const r = (f.kappa * dt) / (capacity * dx * dx);\n\n let u = new Float64Array(nx + 1);\n let next = new Float64Array(nx + 1);\n // The initial condition exp(−x²/(4 s0)) involves no diffusivity at all.\n for (let i = 0; i <= nx; i++) {\n const x = -f.halfWidth + i * dx;\n u[i] = Math.exp(-(x * x) / (4 * f.s0));\n }\n u[0] = 0;\n u[nx] = 0;\n for (let n = 1; n <= steps; n++) {\n for (let i = 1; i < nx; i++) {\n next[i] = u[i]! + r * (u[i + 1]! - 2 * u[i]! + u[i - 1]!);\n }\n next[0] = 0;\n next[nx] = 0;\n [u, next] = [next, u];\n }\n return u[nx / 2]!;\n}\n\n/** Parameters of the WD3 Wick-rotation fixture. @internal */\nexport interface WickFixture {\n readonly hbar: number;\n readonly m: number;\n /** Initial width of the α = 0 Gaussian. */\n readonly s: number;\n /** The point `(x, τ)` the residual is evaluated at. */\n readonly x: number;\n readonly tau: number;\n /** Base finite-difference step; the resolution divides it. */\n readonly h0: number;\n}\n\n/**\n * WD3 — the finite-difference residual `|∂_τ φ − (ħ/2m) ∂²_x φ|` of the\n * Wick-rotated free kernel `φ(x, τ)` (`witnesses/quantum-support.ts`, W5) at\n * one point, with step `h = h0/resolution` in both variables.\n *\n * The residual measures whether the Wick rotation `t = −iτ` of the free\n * Schrödinger equation really lands on the DIFFUSION equation with\n * `D = ħ/(2m)`. Its exact value is zero; the finite-difference estimate\n * approaches zero as `h` shrinks, and the runner records how fast.\n *\n * @internal\n */\nexport function wickHeatResidual(\n resolution: number,\n f: WickFixture,\n kernel: (x: number, tau: number, s: number, hbar: number, m: number) => number,\n): number {\n const h = f.h0 / resolution;\n const phi = (x: number, tau: number): number => kernel(x, tau, f.s, f.hbar, f.m);\n const dTau = (phi(f.x, f.tau + h) - phi(f.x, f.tau - h)) / (2 * h);\n const dXX = (phi(f.x + h, f.tau) - 2 * phi(f.x, f.tau) + phi(f.x - h, f.tau)) / (h * h);\n return Math.abs(dTau - (f.hbar / (2 * f.m)) * dXX);\n}\n\n/**\n * WD3b — `∫ φ(x, τ)² dx` of the Wick-rotated free kernel, by the trapezoid\n * rule (MathTS `trapz` on the uniform grid, times its spacing) over\n * `[−halfWidth, halfWidth]`. The Schrödinger norm `∫|ψ|² dx` is conserved;\n * this one DECAYS with τ, which is the unitarity the continuation does not\n * preserve.\n *\n * @internal\n */\nexport function wickKernelSquaredNorm(\n tau: number,\n f: WickFixture,\n kernel: (x: number, tau: number, s: number, hbar: number, m: number) => number,\n halfWidth = 20,\n cells = 4000,\n): number {\n const dx = (2 * halfWidth) / cells;\n const squares = Array.from({ length: cells + 1 }, (_, i) => kernel(-halfWidth + i * dx, tau, f.s, f.hbar, f.m) ** 2);\n return trapz(squares) * dx;\n}\n\n// ── Sprint 4 closure: Langevin, telegraph, steady state ────────────────────\n\n/** Parameters of the Langevin (Ornstein–Uhlenbeck) fixture. @internal */\nexport interface LangevinFixture {\n /** Particle mass m. */\n readonly m: number;\n /** Friction coefficient γ (force per velocity). */\n readonly gamma: number;\n /** Thermal energy k_B T. */\n readonly kT: number;\n}\n\n/**\n * WD4 — `⟨x²⟩(t) / (2Dt)` for the Langevin model `m v̇ = −γv + ξ`,\n * `⟨ξ(t)ξ(t′)⟩ = 2γ k_B T δ(t − t′)`, started from x = 0 with a thermalized\n * velocity, at `t = resolution · τ_p` where `τ_p = m/γ`.\n *\n * The second moments are integrated from the LANGEVIN model's own moment\n * equations, `d⟨x²⟩/dt = 2⟨xv⟩`, `d⟨xv⟩/dt = ⟨v²⟩ − (γ/m)⟨xv⟩`, with\n * `⟨v²⟩ = k_B T/m` held at equipartition, by `integrateRK4` (MathTS `solveODESystem` with `dt`) on a fine fixed grid. The\n * diffusion coefficient `D = k_B T/γ` (Einstein) enters only the DENOMINATOR:\n * the ratio tends to 1 in the diffusive regime `t ≫ τ_p`.\n *\n * @internal\n */\nexport function langevinMsdRatio(resolution: number, f: LangevinFixture): number {\n const tauP = f.m / f.gamma;\n const tEnd = resolution * tauP;\n const v2 = f.kT / f.m;\n const steps = Math.max(2000, Math.ceil(200 * resolution));\n const h = tEnd / steps;\n const end = integrateRK4((_t, y) => [2 * y[1]!, v2 - y[1]! / tauP], [0, 0], 0, steps * h, steps);\n const x2 = end[0] ?? Number.NaN;\n const D = f.kT / f.gamma;\n return x2 / (2 * D * tEnd);\n}\n\n/**\n * The slow decay rate of a Fourier mode of the TELEGRAPH equation\n * `τ u_tt + u_t = D u_xx`, divided by the diffusion rate `D q²`:\n * `(1 − √(1 − 4ε)) / (2ε)` with `ε = τ D q²`. Tends to 1 as τ → 0; complex\n * (oscillatory) for `ε > 1/4`, where it returns NaN.\n *\n * @internal\n */\nexport function telegraphSlowRateRatio(tau: number, D: number, q: number): number {\n const eps = tau * D * q * q;\n if (eps === 0) return 1;\n const disc = 1 - 4 * eps;\n if (disc < 0) return Number.NaN;\n // `(1 − √(1 − 4ε))/(2ε)` is algebraically `2/(1 + √(1 − 4ε))`, which does not cancel as\n // ε → 0 (the naive form was 26× the true `ratio − 1` at ε = 1e-9).\n return 2 / (1 + Math.sqrt(disc));\n}\n\n/**\n * The slow-mode decay-rate EXCESS over diffusion, `telegraphSlowRateRatio − 1`,\n * as the cancellation-free `4ε / (1 + √(1 − 4ε))²` with `ε = τ D q²`: the\n * relative error `ab-telegraph-diffusion` states its bound in. Subtracting 1\n * from the ratio loses the leading digits as ε → 0 (at ε = 1e-9 the naive\n * difference was 8e-8 relative off), so the bridge reads this function.\n * NaN for ε > 1/4, as the ratio is.\n *\n * @internal\n */\nexport function telegraphSlowRateExcess(tau: number, D: number, q: number): number {\n const eps = tau * D * q * q;\n if (eps === 0) return 0;\n const disc = 1 - 4 * eps;\n if (disc < 0) return Number.NaN;\n const s = 1 + Math.sqrt(disc);\n return (4 * eps) / (s * s);\n}\n\n/**\n * The oscillation frequency of a telegraph mode in its underdamped range,\n * divided by the undamped wave frequency `c q` with `c² = D/τ`:\n * `√(1 − 1/(4ε))`, `ε = τ D q²`. Tends to 1 as ε grows.\n *\n * @internal\n */\nexport function telegraphWaveFrequencyRatio(tau: number, D: number, q: number): number {\n const eps = tau * D * q * q;\n if (eps <= 0.25) return Number.NaN;\n return Math.sqrt(1 - 1 / (4 * eps));\n}\n\n/** Parameters of the WD8 steady-state fixture. @internal */\nexport interface SteadyStateFixture {\n /** Thermal diffusivity α (= κ/(ρ c_p)). */\n readonly alpha: number;\n /** Rod length ℓ. */\n readonly ell: number;\n /** End temperatures. */\n readonly tLeft: number;\n readonly tRight: number;\n /** Base time; the resolution multiplies it. */\n readonly t0: number;\n readonly cells: number;\n}\n\n/**\n * WD8 — the largest deviation from the LINEAR steady profile (the Laplace\n * equation's solution) of an FTCS heat solution with fixed end temperatures,\n * started from a profile with a sin(πx/ℓ) bump, at `t = resolution · t0`.\n * Tends to zero as t → ∞: the steady state is the heat equation's attractor.\n * `reference` replaces the linear profile the deviation is measured against.\n *\n * @internal\n */\nexport function heatSteadyDeviation(\n resolution: number,\n f: SteadyStateFixture,\n reference?: (i: number, cells: number) => number,\n): number {\n const nx = f.cells;\n const dx = f.ell / nx;\n const dtMax = (0.25 * dx * dx) / f.alpha;\n const tEnd = resolution * f.t0;\n const steps = Math.ceil(tEnd / dtMax);\n const dt = tEnd / steps;\n const r = (f.alpha * dt) / (dx * dx);\n const linear = (i: number): number => f.tLeft + ((f.tRight - f.tLeft) * i) / nx;\n let u = new Float64Array(nx + 1);\n let next = new Float64Array(nx + 1);\n for (let i = 0; i <= nx; i++) u[i] = linear(i) + Math.sin((Math.PI * i) / nx);\n next[0] = f.tLeft;\n next[nx] = f.tRight;\n for (let n = 0; n < steps; n++) {\n for (let i = 1; i < nx; i++) next[i] = u[i]! + r * (u[i + 1]! - 2 * u[i]! + u[i - 1]!);\n [u, next] = [next, u];\n }\n // The deviation is measured against `reference` when given — the negative\n // control uses a WRONG steady state here — and against the linear Laplace\n // profile otherwise. The solver itself never sees the reference.\n const ref = reference ?? ((i: number) => linear(i));\n let worst = 0;\n for (let i = 0; i <= nx; i++) worst = Math.max(worst, Math.abs(u[i]! - ref(i, nx)));\n return worst;\n}\n"]}
|
|
@@ -13,7 +13,17 @@
|
|
|
13
13
|
* - **structural predictor** — common neighbours in the remaining graph, ties
|
|
14
14
|
* broken by sharing the premise's family, then by id;
|
|
15
15
|
* - **text baseline** — word-token overlap between the models' dynamics and
|
|
16
|
-
* state-space descriptions, ties broken by id.
|
|
16
|
+
* state-space descriptions (`text-overlap.ts`), ties broken by id.
|
|
17
|
+
*
|
|
18
|
+
* **The recorded result stands.** The negative result (typed neighbourhood below text
|
|
19
|
+
* overlap on twenty trials; NOTES.md, "Link prediction is NEGATIVE") is reproduced by
|
|
20
|
+
* {@link runLinkPrediction} exactly as recorded and is not re-run for a better answer. What
|
|
21
|
+
* was added beside it, never inside it: a seeded percentile-bootstrap interval on every
|
|
22
|
+
* recall and MRR (MathTS `bootstrapCI`), a seeded permutation test on the two per-trial
|
|
23
|
+
* reciprocal-rank vectors (MathTS `permutationTest`, stated for what it is), and McNemar's
|
|
24
|
+
* exact p on the paired hits (`benchmark/stats.ts`). The Katz-index predictor
|
|
25
|
+
* ({@link runKatzLinkPrediction}) is a SEPARATE result: every record it returns carries
|
|
26
|
+
* `postHoc: true` and the label, and it is never a field of the recorded comparison.
|
|
17
27
|
*
|
|
18
28
|
* ⚠ **What this result cannot carry.** The graph is small (24 models, 22 pairs)
|
|
19
29
|
* and was curated by the same agent that runs the test, in-distribution. It is a
|
|
@@ -21,7 +31,9 @@
|
|
|
21
31
|
* discovery claim, not a hub or gap claim, and not evidence about physics the
|
|
22
32
|
* atlas does not contain. ROADMAP Phase 6 asks for it as a hypothesis test, and
|
|
23
33
|
* that is its whole scope. Product A (`src/composition/discovery.ts`) is not
|
|
24
|
-
* touched: a test pins that nothing under `src/atlas/` imports it
|
|
34
|
+
* touched: a test pins that nothing under `src/atlas/` imports it, and the Katz
|
|
35
|
+
* predictor is not wired into discovery, whose candidates are in different
|
|
36
|
+
* components by construction (every path score there is 0).
|
|
25
37
|
*
|
|
26
38
|
* @module atlas/link-prediction
|
|
27
39
|
* @internal
|
|
@@ -38,6 +50,41 @@ export interface LinkPredictionTrial {
|
|
|
38
50
|
/** How many candidates the conclusion competed against. */
|
|
39
51
|
readonly candidates: number;
|
|
40
52
|
}
|
|
53
|
+
/** A percentile-bootstrap interval with the point estimate it brackets (MathTS `bootstrapCI`). @internal */
|
|
54
|
+
export interface BootstrapInterval {
|
|
55
|
+
readonly estimate: number;
|
|
56
|
+
readonly lower: number;
|
|
57
|
+
readonly upper: number;
|
|
58
|
+
/** The confidence level, 0.95. */
|
|
59
|
+
readonly confidence: number;
|
|
60
|
+
}
|
|
61
|
+
/** The seeded intervals of the recorded comparison. @internal */
|
|
62
|
+
export interface LinkPredictionIntervals {
|
|
63
|
+
/** The seed every resample used; stated so the interval is reproducible. */
|
|
64
|
+
readonly seed: number;
|
|
65
|
+
readonly resamples: number;
|
|
66
|
+
readonly structuralRecall: BootstrapInterval;
|
|
67
|
+
readonly textRecall: BootstrapInterval;
|
|
68
|
+
readonly structuralMrr: BootstrapInterval;
|
|
69
|
+
readonly textMrr: BootstrapInterval;
|
|
70
|
+
}
|
|
71
|
+
/** The seeded permutation test on the two per-trial reciprocal-rank vectors. @internal */
|
|
72
|
+
export interface ReciprocalRankPermutation {
|
|
73
|
+
/** Mean structural reciprocal rank minus mean text reciprocal rank (the observed MRR difference). */
|
|
74
|
+
readonly statistic: number;
|
|
75
|
+
/** Two-tailed p from MathTS `permutationTest`. */
|
|
76
|
+
readonly pValue: number;
|
|
77
|
+
readonly seed: number;
|
|
78
|
+
readonly resamples: number;
|
|
79
|
+
/**
|
|
80
|
+
* What the test is. MathTS has no paired permutation: `permutationTest` pools the two vectors
|
|
81
|
+
* and re-splits them, so the trial pairing is not kept and the null is looser than a sign-flip
|
|
82
|
+
* test's. The paired test on the hits is `mcnemarExactP`.
|
|
83
|
+
*/
|
|
84
|
+
readonly kind: typeof PERMUTATION_KIND;
|
|
85
|
+
}
|
|
86
|
+
/** The statement of the permutation test's kind, so no reader takes it for a paired test. @internal */
|
|
87
|
+
export declare const PERMUTATION_KIND: 'two-sample permutation of the reciprocal-rank vectors (pooled re-split; the pairing is not kept)';
|
|
41
88
|
/** The whole leave-one-bridge-out run. @internal */
|
|
42
89
|
export interface LinkPredictionResult {
|
|
43
90
|
readonly k: number;
|
|
@@ -59,13 +106,69 @@ export interface LinkPredictionResult {
|
|
|
59
106
|
/** Mean reciprocal rank of the held-out conclusion. */
|
|
60
107
|
readonly structuralMrr: number;
|
|
61
108
|
readonly textMrr: number;
|
|
109
|
+
/** Seeded bootstrap intervals on the four numbers above. */
|
|
110
|
+
readonly intervals: LinkPredictionIntervals;
|
|
111
|
+
/** The seeded permutation test on the per-trial reciprocal ranks. */
|
|
112
|
+
readonly permutation: ReciprocalRankPermutation;
|
|
113
|
+
/** McNemar's exact p on the paired hit table (both, structural only, text only, neither). */
|
|
114
|
+
readonly mcnemarExactP: number;
|
|
115
|
+
}
|
|
116
|
+
/** The label every Katz record carries. @internal */
|
|
117
|
+
export declare const POST_HOC_LABEL: 'post hoc: added after the negative result was recorded';
|
|
118
|
+
/** One held-out pair under the Katz-index predictor. @internal */
|
|
119
|
+
export interface KatzTrial {
|
|
120
|
+
readonly bridgeId: string;
|
|
121
|
+
readonly premise: string;
|
|
122
|
+
readonly conclusion: string;
|
|
123
|
+
/** 1-based rank of the held-out conclusion by Katz index; Infinity when it was not a candidate. */
|
|
124
|
+
readonly katzRank: number;
|
|
125
|
+
/** The Katz index K[premise][conclusion] = ((I − βA)⁻¹ − I)[premise][conclusion]; 0 when no path. */
|
|
126
|
+
readonly katzScore: number;
|
|
127
|
+
readonly candidates: number;
|
|
128
|
+
/** This trial's attenuation β = 1/(2·max degree) of its own held-out graph. */
|
|
129
|
+
readonly beta: number;
|
|
130
|
+
readonly postHoc: true;
|
|
131
|
+
}
|
|
132
|
+
/** The Katz-index run: a separate, post-hoc result, never merged into the recorded comparison. @internal */
|
|
133
|
+
export interface KatzLinkPredictionResult {
|
|
134
|
+
readonly postHoc: true;
|
|
135
|
+
readonly label: typeof POST_HOC_LABEL;
|
|
136
|
+
readonly k: number;
|
|
137
|
+
/**
|
|
138
|
+
* `[min, max]` of the trials' attenuations. Each held-out graph has its own maximum degree, so
|
|
139
|
+
* β = 1/(2·max degree) is per trial (`KatzTrial.beta`), each below its graph's spectral bound
|
|
140
|
+
* 1/λ_max since λ_max ≤ max degree. The result once reported one β, the last trial's.
|
|
141
|
+
*/
|
|
142
|
+
readonly betaRange: readonly [number, number];
|
|
143
|
+
readonly trials: readonly KatzTrial[];
|
|
144
|
+
readonly stillConnected: number;
|
|
145
|
+
readonly katzHits: number;
|
|
146
|
+
readonly katzMrr: number;
|
|
147
|
+
readonly chanceRecall: number;
|
|
148
|
+
readonly intervals: {
|
|
149
|
+
readonly seed: number;
|
|
150
|
+
readonly resamples: number;
|
|
151
|
+
readonly recall: BootstrapInterval;
|
|
152
|
+
readonly mrr: BootstrapInterval;
|
|
153
|
+
};
|
|
62
154
|
}
|
|
63
155
|
/**
|
|
64
|
-
* Run leave-one-bridge-out link prediction over the families' model graph.
|
|
156
|
+
* Run leave-one-bridge-out link prediction over the families' model graph. The recorded
|
|
157
|
+
* comparison (structural against text), with its seeded intervals and paired statistics.
|
|
65
158
|
*
|
|
66
159
|
* @param families - the atlas families (normally `ATLAS_FAMILIES`).
|
|
67
160
|
* @param k - the depth a hit must fall within (10, as pre-registered for recall).
|
|
68
161
|
* @internal
|
|
69
162
|
*/
|
|
70
163
|
export declare function runLinkPrediction(families: readonly AtlasFamily[], k?: number): LinkPredictionResult;
|
|
164
|
+
/**
|
|
165
|
+
* The Katz-index predictor, SEPARATE from the recorded comparison and labelled post hoc: it was
|
|
166
|
+
* added after the negative result was recorded, so its numbers are exploratory and are never
|
|
167
|
+
* merged into that result. Ranks each candidate by K[premise][candidate] (paths of every length,
|
|
168
|
+
* attenuated by β per step), ties by id. Not wired into discovery (`src/composition/`): Product A
|
|
169
|
+
* candidates are in different components by construction, so every path score there is 0.
|
|
170
|
+
*
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
173
|
+
export declare function runKatzLinkPrediction(families: readonly AtlasFamily[], k?: number): KatzLinkPredictionResult;
|
|
71
174
|
//# sourceMappingURL=link-prediction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-prediction.d.ts","sourceRoot":"","sources":["../../src/atlas/link-prediction.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"link-prediction.d.ts","sourceRoot":"","sources":["../../src/atlas/link-prediction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO/C,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qFAAqF;IACrF,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,4GAA4G;AAC5G,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CA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E,MAAM,CAAC;QAC3B,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;QACnC,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;KACjC,CAAC;CACH;AA0ED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,EAAE,CAAC,SAAK,GAAG,oBAAoB,CAyEhG;AA0CD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,EAAE,CAAC,SAAK,GAAG,wBAAwB,CAmCxG"}
|
|
@@ -13,7 +13,17 @@
|
|
|
13
13
|
* - **structural predictor** — common neighbours in the remaining graph, ties
|
|
14
14
|
* broken by sharing the premise's family, then by id;
|
|
15
15
|
* - **text baseline** — word-token overlap between the models' dynamics and
|
|
16
|
-
* state-space descriptions, ties broken by id.
|
|
16
|
+
* state-space descriptions (`text-overlap.ts`), ties broken by id.
|
|
17
|
+
*
|
|
18
|
+
* **The recorded result stands.** The negative result (typed neighbourhood below text
|
|
19
|
+
* overlap on twenty trials; NOTES.md, "Link prediction is NEGATIVE") is reproduced by
|
|
20
|
+
* {@link runLinkPrediction} exactly as recorded and is not re-run for a better answer. What
|
|
21
|
+
* was added beside it, never inside it: a seeded percentile-bootstrap interval on every
|
|
22
|
+
* recall and MRR (MathTS `bootstrapCI`), a seeded permutation test on the two per-trial
|
|
23
|
+
* reciprocal-rank vectors (MathTS `permutationTest`, stated for what it is), and McNemar's
|
|
24
|
+
* exact p on the paired hits (`benchmark/stats.ts`). The Katz-index predictor
|
|
25
|
+
* ({@link runKatzLinkPrediction}) is a SEPARATE result: every record it returns carries
|
|
26
|
+
* `postHoc: true` and the label, and it is never a field of the recorded comparison.
|
|
17
27
|
*
|
|
18
28
|
* ⚠ **What this result cannot carry.** The graph is small (24 models, 22 pairs)
|
|
19
29
|
* and was curated by the same agent that runs the test, in-distribution. It is a
|
|
@@ -21,50 +31,35 @@
|
|
|
21
31
|
* discovery claim, not a hub or gap claim, and not evidence about physics the
|
|
22
32
|
* atlas does not contain. ROADMAP Phase 6 asks for it as a hypothesis test, and
|
|
23
33
|
* that is its whole scope. Product A (`src/composition/discovery.ts`) is not
|
|
24
|
-
* touched: a test pins that nothing under `src/atlas/` imports it
|
|
34
|
+
* touched: a test pins that nothing under `src/atlas/` imports it, and the Katz
|
|
35
|
+
* predictor is not wired into discovery, whose candidates are in different
|
|
36
|
+
* components by construction (every path score there is 0).
|
|
25
37
|
*
|
|
26
38
|
* @module atlas/link-prediction
|
|
27
39
|
* @internal
|
|
28
40
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const sx = score(x);
|
|
43
|
-
const sy = score(y);
|
|
44
|
-
for (let i = 0; i < sx.length; i++)
|
|
45
|
-
if (sx[i] !== sy[i])
|
|
46
|
-
return sy[i] - sx[i];
|
|
47
|
-
return x < y ? -1 : x > y ? 1 : 0;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Run leave-one-bridge-out link prediction over the families' model graph.
|
|
52
|
-
*
|
|
53
|
-
* @param families - the atlas families (normally `ATLAS_FAMILIES`).
|
|
54
|
-
* @param k - the depth a hit must fall within (10, as pre-registered for recall).
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
57
|
-
export function runLinkPrediction(families, k = 10) {
|
|
41
|
+
import { bootstrapCI, inv, permutationTest } from '@danielsimonjr/mathts-functions';
|
|
42
|
+
import { jaccard, rankBy, tokens } from './text-overlap.js';
|
|
43
|
+
import { mcnemar } from './benchmark/stats.js';
|
|
44
|
+
import { meanOf } from '../numerical/statistics.js';
|
|
45
|
+
/** The statement of the permutation test's kind, so no reader takes it for a paired test. @internal */
|
|
46
|
+
export const PERMUTATION_KIND = 'two-sample permutation of the reciprocal-rank vectors (pooled re-split; the pairing is not kept)';
|
|
47
|
+
/** The label every Katz record carries. @internal */
|
|
48
|
+
export const POST_HOC_LABEL = 'post hoc: added after the negative result was recorded';
|
|
49
|
+
/** The one seed every resample in this module uses, and the resample count. Stated, not hidden. */
|
|
50
|
+
const RESAMPLE_SEED = 20260924;
|
|
51
|
+
const RESAMPLES = 10000;
|
|
52
|
+
/** Every held-out query of the families, and the pairs excluded as still connected. */
|
|
53
|
+
function holdOuts(families) {
|
|
58
54
|
const models = new Map();
|
|
59
55
|
for (const f of families)
|
|
60
56
|
for (const m of f.models)
|
|
61
57
|
models.set(m.id, m);
|
|
62
58
|
const bridges = families.flatMap((f) => f.bridges);
|
|
63
59
|
const edgesOf = (b) => b.premises.map((p) => [p, b.conclusion]);
|
|
64
|
-
const
|
|
60
|
+
const queries = [];
|
|
65
61
|
let stillConnected = 0;
|
|
66
62
|
for (const held of bridges) {
|
|
67
|
-
// The graph WITHOUT the held-out bridge.
|
|
68
63
|
const adj = new Map();
|
|
69
64
|
for (const id of models.keys())
|
|
70
65
|
adj.set(id, new Set());
|
|
@@ -77,8 +72,8 @@ export function runLinkPrediction(families, k = 10) {
|
|
|
77
72
|
}
|
|
78
73
|
}
|
|
79
74
|
for (const [premise, conclusion] of edgesOf(held)) {
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
75
|
+
const premiseModel = models.get(premise);
|
|
76
|
+
if (premiseModel === undefined)
|
|
82
77
|
continue;
|
|
83
78
|
const neighbours = adj.get(premise) ?? new Set();
|
|
84
79
|
if (neighbours.has(conclusion)) {
|
|
@@ -86,43 +81,194 @@ export function runLinkPrediction(families, k = 10) {
|
|
|
86
81
|
continue;
|
|
87
82
|
}
|
|
88
83
|
const candidates = [...models.keys()].filter((id) => id !== premise && !neighbours.has(id));
|
|
89
|
-
|
|
90
|
-
let n = 0;
|
|
91
|
-
for (const x of adj.get(id) ?? [])
|
|
92
|
-
if (neighbours.has(x))
|
|
93
|
-
n++;
|
|
94
|
-
return n;
|
|
95
|
-
};
|
|
96
|
-
const structural = rank(candidates, (id) => [common(id), models.get(id).family === pModel.family ? 1 : 0]);
|
|
97
|
-
const pText = tokens(`${pModel.dynamics} ${pModel.stateSpace}`);
|
|
98
|
-
const text = rank(candidates, (id) => {
|
|
99
|
-
const m = models.get(id);
|
|
100
|
-
return [jaccard(pText, tokens(`${m.dynamics} ${m.stateSpace}`))];
|
|
101
|
-
});
|
|
102
|
-
const at = (list) => {
|
|
103
|
-
const i = list.indexOf(conclusion);
|
|
104
|
-
return i < 0 ? Number.POSITIVE_INFINITY : i + 1;
|
|
105
|
-
};
|
|
106
|
-
trials.push({
|
|
107
|
-
bridgeId: held.id,
|
|
108
|
-
premise,
|
|
109
|
-
conclusion,
|
|
110
|
-
structuralRank: at(structural),
|
|
111
|
-
textRank: at(text),
|
|
112
|
-
candidates: candidates.length,
|
|
113
|
-
});
|
|
84
|
+
queries.push({ held, premise, conclusion, premiseModel, adj, candidates });
|
|
114
85
|
}
|
|
115
86
|
}
|
|
116
|
-
|
|
87
|
+
return { models, queries, stillConnected };
|
|
88
|
+
}
|
|
89
|
+
/** 1-based position of `id` in a ranking; Infinity when absent. */
|
|
90
|
+
const rankOf = (list, id) => {
|
|
91
|
+
const i = list.indexOf(id);
|
|
92
|
+
return i < 0 ? Number.POSITIVE_INFINITY : i + 1;
|
|
93
|
+
};
|
|
94
|
+
/** Seeded percentile bootstrap of the mean of per-trial values (a 0/1 hit, or a reciprocal rank). */
|
|
95
|
+
function bootstrapMean(values) {
|
|
96
|
+
const ci = bootstrapCI([...values], (sample) => meanOf(sample), {
|
|
97
|
+
confidence: 0.95,
|
|
98
|
+
resamples: RESAMPLES,
|
|
99
|
+
seed: RESAMPLE_SEED,
|
|
100
|
+
});
|
|
101
|
+
return { estimate: ci.estimate, lower: ci.lower, upper: ci.upper, confidence: ci.confidence };
|
|
102
|
+
}
|
|
103
|
+
/** The mean of a trial statistic; NaN with no trials, as the recorded result always read it. */
|
|
104
|
+
const meanOrNaN = (xs) => (xs.length === 0 ? Number.NaN : meanOf(xs));
|
|
105
|
+
/**
|
|
106
|
+
* Run leave-one-bridge-out link prediction over the families' model graph. The recorded
|
|
107
|
+
* comparison (structural against text), with its seeded intervals and paired statistics.
|
|
108
|
+
*
|
|
109
|
+
* @param families - the atlas families (normally `ATLAS_FAMILIES`).
|
|
110
|
+
* @param k - the depth a hit must fall within (10, as pre-registered for recall).
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
export function runLinkPrediction(families, k = 10) {
|
|
114
|
+
const { models, queries, stillConnected } = holdOuts(families);
|
|
115
|
+
const trials = queries.map((q) => {
|
|
116
|
+
const neighbours = q.adj.get(q.premise) ?? new Set();
|
|
117
|
+
const common = (id) => {
|
|
118
|
+
let n = 0;
|
|
119
|
+
for (const x of q.adj.get(id) ?? [])
|
|
120
|
+
if (neighbours.has(x))
|
|
121
|
+
n++;
|
|
122
|
+
return n;
|
|
123
|
+
};
|
|
124
|
+
const structural = rankBy(q.candidates, (id) => [common(id), models.get(id).family === q.premiseModel.family ? 1 : 0]);
|
|
125
|
+
const pText = tokens(`${q.premiseModel.dynamics} ${q.premiseModel.stateSpace}`);
|
|
126
|
+
const text = rankBy(q.candidates, (id) => {
|
|
127
|
+
const m = models.get(id);
|
|
128
|
+
return [jaccard(pText, tokens(`${m.dynamics} ${m.stateSpace}`))];
|
|
129
|
+
});
|
|
130
|
+
return {
|
|
131
|
+
bridgeId: q.held.id,
|
|
132
|
+
premise: q.premise,
|
|
133
|
+
conclusion: q.conclusion,
|
|
134
|
+
structuralRank: rankOf(structural, q.conclusion),
|
|
135
|
+
textRank: rankOf(text, q.conclusion),
|
|
136
|
+
candidates: q.candidates.length,
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
const structuralHit = trials.map((t) => (t.structuralRank <= k ? 1 : 0));
|
|
140
|
+
const textHit = trials.map((t) => (t.textRank <= k ? 1 : 0));
|
|
141
|
+
const structuralRR = trials.map((t) => 1 / t.structuralRank);
|
|
142
|
+
const textRR = trials.map((t) => 1 / t.textRank);
|
|
143
|
+
// The paired hit table: both, structural only, text only, neither.
|
|
144
|
+
let a = 0;
|
|
145
|
+
let b = 0;
|
|
146
|
+
let c = 0;
|
|
147
|
+
let d = 0;
|
|
148
|
+
trials.forEach((_, i) => {
|
|
149
|
+
if (structuralHit[i] && textHit[i])
|
|
150
|
+
a++;
|
|
151
|
+
else if (structuralHit[i])
|
|
152
|
+
b++;
|
|
153
|
+
else if (textHit[i])
|
|
154
|
+
c++;
|
|
155
|
+
else
|
|
156
|
+
d++;
|
|
157
|
+
});
|
|
158
|
+
const permuted = permutationTest(structuralRR, textRR, (x, y) => meanOrNaN(x) - meanOrNaN(y), {
|
|
159
|
+
resamples: RESAMPLES,
|
|
160
|
+
seed: RESAMPLE_SEED,
|
|
161
|
+
});
|
|
162
|
+
return {
|
|
163
|
+
k,
|
|
164
|
+
trials,
|
|
165
|
+
stillConnected,
|
|
166
|
+
structuralHits: structuralHit.reduce((acc, x) => acc + x, 0),
|
|
167
|
+
textHits: textHit.reduce((acc, x) => acc + x, 0),
|
|
168
|
+
chanceRecall: meanOrNaN(trials.map((t) => Math.min(k, t.candidates) / t.candidates)),
|
|
169
|
+
structuralMrr: meanOrNaN(structuralRR),
|
|
170
|
+
textMrr: meanOrNaN(textRR),
|
|
171
|
+
intervals: {
|
|
172
|
+
seed: RESAMPLE_SEED,
|
|
173
|
+
resamples: RESAMPLES,
|
|
174
|
+
structuralRecall: bootstrapMean(structuralHit),
|
|
175
|
+
textRecall: bootstrapMean(textHit),
|
|
176
|
+
structuralMrr: bootstrapMean(structuralRR),
|
|
177
|
+
textMrr: bootstrapMean(textRR),
|
|
178
|
+
},
|
|
179
|
+
permutation: {
|
|
180
|
+
statistic: permuted.statistic,
|
|
181
|
+
pValue: permuted.pValue,
|
|
182
|
+
seed: RESAMPLE_SEED,
|
|
183
|
+
resamples: RESAMPLES,
|
|
184
|
+
kind: PERMUTATION_KIND,
|
|
185
|
+
},
|
|
186
|
+
mcnemarExactP: mcnemar({ a, b, c, d }).exactP,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/** A square number matrix of order n, read back from MathTS `inv`, which types its result `unknown`. */
|
|
190
|
+
function squareMatrix(value, n) {
|
|
191
|
+
if (!Array.isArray(value) || value.length !== n) {
|
|
192
|
+
throw new TypeError(`inv did not return a ${n}×${n} matrix`);
|
|
193
|
+
}
|
|
194
|
+
for (const row of value) {
|
|
195
|
+
if (!Array.isArray(row) || row.length !== n || !row.every((x) => typeof x === 'number' && Number.isFinite(x))) {
|
|
196
|
+
throw new TypeError(`inv did not return a ${n}×${n} matrix of finite numbers`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return value;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The Katz index of the graph without the held-out bridge: K = (I − βA)⁻¹ − I through MathTS
|
|
203
|
+
* `inv`, with β = 1/(2·max degree). The largest eigenvalue of a 0/1 adjacency is at most the
|
|
204
|
+
* maximum degree, so β is below the spectral bound 1/λ_max and the series Σ βˡ Aˡ converges.
|
|
205
|
+
* A graph with no edge has K = 0 everywhere, and β is stated as 0.5 (there is nothing to attenuate).
|
|
206
|
+
*/
|
|
207
|
+
function katzIndex(adj, ids) {
|
|
208
|
+
const n = ids.length;
|
|
209
|
+
const index = new Map(ids.map((id, i) => [id, i]));
|
|
210
|
+
const A = Array.from({ length: n }, () => new Array(n).fill(0));
|
|
211
|
+
let maxDegree = 0;
|
|
212
|
+
for (const [u, neighbours] of adj) {
|
|
213
|
+
const i = index.get(u);
|
|
214
|
+
if (i === undefined)
|
|
215
|
+
continue;
|
|
216
|
+
maxDegree = Math.max(maxDegree, neighbours.size);
|
|
217
|
+
for (const v of neighbours) {
|
|
218
|
+
const j = index.get(v);
|
|
219
|
+
if (j !== undefined)
|
|
220
|
+
A[i][j] = 1;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
const beta = maxDegree === 0 ? 0.5 : 1 / (2 * maxDegree);
|
|
224
|
+
const M = A.map((row, i) => row.map((x, j) => (i === j ? 1 : 0) - beta * x));
|
|
225
|
+
const inverse = squareMatrix(inv(M), n);
|
|
226
|
+
const K = inverse.map((row, i) => row.map((x, j) => (i === j ? x - 1 : x)));
|
|
227
|
+
return { K, beta };
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* The Katz-index predictor, SEPARATE from the recorded comparison and labelled post hoc: it was
|
|
231
|
+
* added after the negative result was recorded, so its numbers are exploratory and are never
|
|
232
|
+
* merged into that result. Ranks each candidate by K[premise][candidate] (paths of every length,
|
|
233
|
+
* attenuated by β per step), ties by id. Not wired into discovery (`src/composition/`): Product A
|
|
234
|
+
* candidates are in different components by construction, so every path score there is 0.
|
|
235
|
+
*
|
|
236
|
+
* @internal
|
|
237
|
+
*/
|
|
238
|
+
export function runKatzLinkPrediction(families, k = 10) {
|
|
239
|
+
const { models, queries, stillConnected } = holdOuts(families);
|
|
240
|
+
const ids = [...models.keys()];
|
|
241
|
+
const index = new Map(ids.map((id, i) => [id, i]));
|
|
242
|
+
const trials = queries.map((q) => {
|
|
243
|
+
const katz = katzIndex(q.adj, ids);
|
|
244
|
+
const p = index.get(q.premise);
|
|
245
|
+
const score = (id) => katz.K[p][index.get(id)];
|
|
246
|
+
const ranked = rankBy(q.candidates, (id) => [score(id)]);
|
|
247
|
+
return {
|
|
248
|
+
bridgeId: q.held.id,
|
|
249
|
+
premise: q.premise,
|
|
250
|
+
conclusion: q.conclusion,
|
|
251
|
+
katzRank: rankOf(ranked, q.conclusion),
|
|
252
|
+
katzScore: q.candidates.includes(q.conclusion) ? score(q.conclusion) : 0,
|
|
253
|
+
candidates: q.candidates.length,
|
|
254
|
+
beta: katz.beta,
|
|
255
|
+
postHoc: true,
|
|
256
|
+
};
|
|
257
|
+
});
|
|
258
|
+
const betas = trials.map((t) => t.beta);
|
|
259
|
+
const hit = trials.map((t) => (t.katzRank <= k ? 1 : 0));
|
|
260
|
+
const rr = trials.map((t) => 1 / t.katzRank);
|
|
117
261
|
return {
|
|
262
|
+
postHoc: true,
|
|
263
|
+
label: POST_HOC_LABEL,
|
|
118
264
|
k,
|
|
265
|
+
betaRange: betas.length === 0 ? [Number.NaN, Number.NaN] : [Math.min(...betas), Math.max(...betas)],
|
|
119
266
|
trials,
|
|
120
267
|
stillConnected,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
chanceRecall:
|
|
124
|
-
|
|
125
|
-
textMrr: mean(trials.map((t) => 1 / t.textRank)),
|
|
268
|
+
katzHits: hit.reduce((acc, x) => acc + x, 0),
|
|
269
|
+
katzMrr: meanOrNaN(rr),
|
|
270
|
+
chanceRecall: meanOrNaN(trials.map((t) => Math.min(k, t.candidates) / t.candidates)),
|
|
271
|
+
intervals: { seed: RESAMPLE_SEED, resamples: RESAMPLES, recall: bootstrapMean(hit), mrr: bootstrapMean(rr) },
|
|
126
272
|
};
|
|
127
273
|
}
|
|
128
274
|
//# sourceMappingURL=link-prediction.js.map
|