universal-physics-tensor 10.0.0 → 11.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.
Files changed (720) hide show
  1. package/README.md +4 -3
  2. package/bin/upt.mjs +13 -1
  3. package/data/atlas/atlas.json +25 -25
  4. package/data/atlas/atlas.jsonld +1 -1
  5. package/data/atlas/diffusion.json +6 -6
  6. package/data/atlas/oscillators.json +7 -7
  7. package/data/atlas/waves.json +14 -14
  8. package/data/atlas/witness-results.json +11 -11
  9. package/data/bridge-catalog.json +371 -228
  10. package/data/bridge-catalog.schema.json +45 -7
  11. package/dist/atlas/applicability.d.ts.map +1 -1
  12. package/dist/atlas/applicability.js +21 -15
  13. package/dist/atlas/applicability.js.map +1 -1
  14. package/dist/atlas/benchmark/hybrid-retrieval.d.ts +9 -1
  15. package/dist/atlas/benchmark/hybrid-retrieval.d.ts.map +1 -1
  16. package/dist/atlas/benchmark/hybrid-retrieval.js +15 -13
  17. package/dist/atlas/benchmark/hybrid-retrieval.js.map +1 -1
  18. package/dist/atlas/benchmark/loader.js +2 -2
  19. package/dist/atlas/benchmark/loader.js.map +1 -1
  20. package/dist/atlas/benchmark/stats.d.ts +2 -2
  21. package/dist/atlas/benchmark/stats.d.ts.map +1 -1
  22. package/dist/atlas/benchmark/stats.js +15 -7
  23. package/dist/atlas/benchmark/stats.js.map +1 -1
  24. package/dist/atlas/catalog-formal-ref.d.ts +26 -3
  25. package/dist/atlas/catalog-formal-ref.d.ts.map +1 -1
  26. package/dist/atlas/catalog-formal-ref.js +52 -5
  27. package/dist/atlas/catalog-formal-ref.js.map +1 -1
  28. package/dist/atlas/chain-pipeline.d.ts.map +1 -1
  29. package/dist/atlas/chain-pipeline.js +7 -8
  30. package/dist/atlas/chain-pipeline.js.map +1 -1
  31. package/dist/atlas/diffusion/bridges-closure.d.ts +0 -4
  32. package/dist/atlas/diffusion/bridges-closure.d.ts.map +1 -1
  33. package/dist/atlas/diffusion/bridges-closure.js +8 -12
  34. package/dist/atlas/diffusion/bridges-closure.js.map +1 -1
  35. package/dist/atlas/diffusion/bridges.d.ts.map +1 -1
  36. package/dist/atlas/diffusion/bridges.js +27 -39
  37. package/dist/atlas/diffusion/bridges.js.map +1 -1
  38. package/dist/atlas/diffusion/dimensions.d.ts +6 -14
  39. package/dist/atlas/diffusion/dimensions.d.ts.map +1 -1
  40. package/dist/atlas/diffusion/dimensions.js +8 -16
  41. package/dist/atlas/diffusion/dimensions.js.map +1 -1
  42. package/dist/atlas/diffusion/models.d.ts +3 -3
  43. package/dist/atlas/diffusion/models.d.ts.map +1 -1
  44. package/dist/atlas/diffusion/models.js +5 -10
  45. package/dist/atlas/diffusion/models.js.map +1 -1
  46. package/dist/atlas/diffusion/numerics.d.ts +16 -4
  47. package/dist/atlas/diffusion/numerics.d.ts.map +1 -1
  48. package/dist/atlas/diffusion/numerics.js +38 -24
  49. package/dist/atlas/diffusion/numerics.js.map +1 -1
  50. package/dist/atlas/link-prediction.d.ts +106 -3
  51. package/dist/atlas/link-prediction.d.ts.map +1 -1
  52. package/dist/atlas/link-prediction.js +212 -66
  53. package/dist/atlas/link-prediction.js.map +1 -1
  54. package/dist/atlas/oscillators/bridges-coarse.d.ts.map +1 -1
  55. package/dist/atlas/oscillators/bridges-coarse.js +7 -11
  56. package/dist/atlas/oscillators/bridges-coarse.js.map +1 -1
  57. package/dist/atlas/oscillators/bridges-exact.d.ts.map +1 -1
  58. package/dist/atlas/oscillators/bridges-exact.js +6 -7
  59. package/dist/atlas/oscillators/bridges-exact.js.map +1 -1
  60. package/dist/atlas/oscillators/bridges-limits.d.ts +3 -16
  61. package/dist/atlas/oscillators/bridges-limits.d.ts.map +1 -1
  62. package/dist/atlas/oscillators/bridges-limits.js +23 -34
  63. package/dist/atlas/oscillators/bridges-limits.js.map +1 -1
  64. package/dist/atlas/oscillators/dimensions.d.ts +9 -21
  65. package/dist/atlas/oscillators/dimensions.d.ts.map +1 -1
  66. package/dist/atlas/oscillators/dimensions.js +9 -21
  67. package/dist/atlas/oscillators/dimensions.js.map +1 -1
  68. package/dist/atlas/oscillators/limit-witnesses.d.ts +2 -2
  69. package/dist/atlas/oscillators/limit-witnesses.d.ts.map +1 -1
  70. package/dist/atlas/oscillators/limit-witnesses.js +17 -15
  71. package/dist/atlas/oscillators/limit-witnesses.js.map +1 -1
  72. package/dist/atlas/oscillators/models.d.ts.map +1 -1
  73. package/dist/atlas/oscillators/models.js +2 -6
  74. package/dist/atlas/oscillators/models.js.map +1 -1
  75. package/dist/atlas/oscillators/pendulum-motion.d.ts +29 -6
  76. package/dist/atlas/oscillators/pendulum-motion.d.ts.map +1 -1
  77. package/dist/atlas/oscillators/pendulum-motion.js +60 -40
  78. package/dist/atlas/oscillators/pendulum-motion.js.map +1 -1
  79. package/dist/atlas/oscillators/phase-translation.d.ts +0 -11
  80. package/dist/atlas/oscillators/phase-translation.d.ts.map +1 -1
  81. package/dist/atlas/oscillators/phase-translation.js +3 -4
  82. package/dist/atlas/oscillators/phase-translation.js.map +1 -1
  83. package/dist/atlas/oscillators/position-translation.d.ts +68 -7
  84. package/dist/atlas/oscillators/position-translation.d.ts.map +1 -1
  85. package/dist/atlas/oscillators/position-translation.js +123 -12
  86. package/dist/atlas/oscillators/position-translation.js.map +1 -1
  87. package/dist/atlas/oscillators/rejections.d.ts +0 -2
  88. package/dist/atlas/oscillators/rejections.d.ts.map +1 -1
  89. package/dist/atlas/oscillators/rejections.js +0 -7
  90. package/dist/atlas/oscillators/rejections.js.map +1 -1
  91. package/dist/atlas/physjs-entries.generated.d.ts +25 -24
  92. package/dist/atlas/physjs-entries.generated.d.ts.map +1 -1
  93. package/dist/atlas/physjs-entries.generated.js +25 -24
  94. package/dist/atlas/physjs-entries.generated.js.map +1 -1
  95. package/dist/atlas/physjs-ref.d.ts +34 -31
  96. package/dist/atlas/physjs-ref.d.ts.map +1 -1
  97. package/dist/atlas/physjs-ref.js +55 -53
  98. package/dist/atlas/physjs-ref.js.map +1 -1
  99. package/dist/atlas/physjs-reviewed.d.ts +1 -1
  100. package/dist/atlas/physjs-reviewed.js +15 -15
  101. package/dist/atlas/physjs-reviewed.js.map +1 -1
  102. package/dist/atlas/poster/statements.d.ts +0 -19
  103. package/dist/atlas/poster/statements.d.ts.map +1 -1
  104. package/dist/atlas/poster/statements.js +1 -1
  105. package/dist/atlas/poster/statements.js.map +1 -1
  106. package/dist/atlas/proof-target.d.ts +1 -1
  107. package/dist/atlas/proof-target.js +1 -1
  108. package/dist/atlas/proof-target.js.map +1 -1
  109. package/dist/atlas/regime.d.ts +1 -1
  110. package/dist/atlas/regime.d.ts.map +1 -1
  111. package/dist/atlas/regime.js +1 -1
  112. package/dist/atlas/regime.js.map +1 -1
  113. package/dist/atlas/text-overlap.d.ts +23 -0
  114. package/dist/atlas/text-overlap.d.ts.map +1 -0
  115. package/dist/atlas/text-overlap.js +41 -0
  116. package/dist/atlas/text-overlap.js.map +1 -0
  117. package/dist/atlas/waves/bridges-closure.d.ts.map +1 -1
  118. package/dist/atlas/waves/bridges-closure.js +2 -6
  119. package/dist/atlas/waves/bridges-closure.js.map +1 -1
  120. package/dist/atlas/waves/bridges.d.ts.map +1 -1
  121. package/dist/atlas/waves/bridges.js +32 -48
  122. package/dist/atlas/waves/bridges.js.map +1 -1
  123. package/dist/atlas/waves/models.d.ts +5 -6
  124. package/dist/atlas/waves/models.d.ts.map +1 -1
  125. package/dist/atlas/waves/models.js +7 -13
  126. package/dist/atlas/waves/models.js.map +1 -1
  127. package/dist/atlas/waves/numerics.d.ts.map +1 -1
  128. package/dist/atlas/waves/numerics.js +10 -3
  129. package/dist/atlas/waves/numerics.js.map +1 -1
  130. package/dist/atlas/witness-numeric.d.ts +30 -0
  131. package/dist/atlas/witness-numeric.d.ts.map +1 -1
  132. package/dist/atlas/witness-numeric.js +53 -0
  133. package/dist/atlas/witness-numeric.js.map +1 -1
  134. package/dist/atlas/witness-specs.d.ts.map +1 -1
  135. package/dist/atlas/witness-specs.js +19 -0
  136. package/dist/atlas/witness-specs.js.map +1 -1
  137. package/dist/atlas/witness-symbolic.d.ts +75 -3
  138. package/dist/atlas/witness-symbolic.d.ts.map +1 -1
  139. package/dist/atlas/witness-symbolic.js +116 -10
  140. package/dist/atlas/witness-symbolic.js.map +1 -1
  141. package/dist/bridges/catalog-load.d.ts.map +1 -1
  142. package/dist/bridges/catalog-load.js +13 -8
  143. package/dist/bridges/catalog-load.js.map +1 -1
  144. package/dist/bridges/catalog-types.d.ts +26 -2
  145. package/dist/bridges/catalog-types.d.ts.map +1 -1
  146. package/dist/bridges/catalog-types.js +11 -1
  147. package/dist/bridges/catalog-types.js.map +1 -1
  148. package/dist/bridges/evaluation-errors.d.ts +31 -1
  149. package/dist/bridges/evaluation-errors.d.ts.map +1 -1
  150. package/dist/bridges/evaluation-errors.js +20 -2
  151. package/dist/bridges/evaluation-errors.js.map +1 -1
  152. package/dist/bridges/evaluator-inputs.d.ts.map +1 -1
  153. package/dist/bridges/evaluator-inputs.js +7 -5
  154. package/dist/bridges/evaluator-inputs.js.map +1 -1
  155. package/dist/bridges/evaluators.d.ts.map +1 -1
  156. package/dist/bridges/evaluators.js +27 -12
  157. package/dist/bridges/evaluators.js.map +1 -1
  158. package/dist/bridges/expr-parse.d.ts +11 -0
  159. package/dist/bridges/expr-parse.d.ts.map +1 -1
  160. package/dist/bridges/expr-parse.js +14 -5
  161. package/dist/bridges/expr-parse.js.map +1 -1
  162. package/dist/bridges/holds.d.ts +35 -3
  163. package/dist/bridges/holds.d.ts.map +1 -1
  164. package/dist/bridges/holds.js +117 -23
  165. package/dist/bridges/holds.js.map +1 -1
  166. package/dist/bridges/notices.d.ts.map +1 -1
  167. package/dist/bridges/notices.js +5 -5
  168. package/dist/bridges/notices.js.map +1 -1
  169. package/dist/bridges/relation-eval.d.ts +4 -4
  170. package/dist/bridges/relation-eval.d.ts.map +1 -1
  171. package/dist/bridges/relation-eval.js +15 -16
  172. package/dist/bridges/relation-eval.js.map +1 -1
  173. package/dist/bridges/sensitivity.d.ts.map +1 -1
  174. package/dist/bridges/sensitivity.js +3 -3
  175. package/dist/bridges/sensitivity.js.map +1 -1
  176. package/dist/bridges/validity.d.ts +33 -0
  177. package/dist/bridges/validity.d.ts.map +1 -0
  178. package/dist/bridges/validity.js +67 -0
  179. package/dist/bridges/validity.js.map +1 -0
  180. package/dist/canonical/entries/atomic.js +1 -3
  181. package/dist/canonical/entries/atomic.js.map +1 -1
  182. package/dist/canonical/entries/condensed-matter.d.ts.map +1 -1
  183. package/dist/canonical/entries/condensed-matter.js +4 -5
  184. package/dist/canonical/entries/condensed-matter.js.map +1 -1
  185. package/dist/canonical/entries/dimensional-classics.d.ts.map +1 -1
  186. package/dist/canonical/entries/dimensional-classics.js +3 -4
  187. package/dist/canonical/entries/dimensional-classics.js.map +1 -1
  188. package/dist/canonical/entries/electromagnetism.d.ts.map +1 -1
  189. package/dist/canonical/entries/electromagnetism.js +4 -10
  190. package/dist/canonical/entries/electromagnetism.js.map +1 -1
  191. package/dist/canonical/entries/fluids-waves.d.ts.map +1 -1
  192. package/dist/canonical/entries/fluids-waves.js +3 -7
  193. package/dist/canonical/entries/fluids-waves.js.map +1 -1
  194. package/dist/canonical/entries/mechanics.d.ts.map +1 -1
  195. package/dist/canonical/entries/mechanics.js +4 -6
  196. package/dist/canonical/entries/mechanics.js.map +1 -1
  197. package/dist/canonical/entries/nonmonomial.d.ts.map +1 -1
  198. package/dist/canonical/entries/nonmonomial.js +9 -17
  199. package/dist/canonical/entries/nonmonomial.js.map +1 -1
  200. package/dist/canonical/entries/relativity.d.ts.map +1 -1
  201. package/dist/canonical/entries/relativity.js +6 -6
  202. package/dist/canonical/entries/relativity.js.map +1 -1
  203. package/dist/canonical/entries/thermo-nuclear-cosmo.d.ts.map +1 -1
  204. package/dist/canonical/entries/thermo-nuclear-cosmo.js +6 -10
  205. package/dist/canonical/entries/thermo-nuclear-cosmo.js.map +1 -1
  206. package/dist/canonical/fixed-points.d.ts +94 -0
  207. package/dist/canonical/fixed-points.d.ts.map +1 -0
  208. package/dist/canonical/fixed-points.js +81 -0
  209. package/dist/canonical/fixed-points.js.map +1 -0
  210. package/dist/canonical/linkage.d.ts.map +1 -1
  211. package/dist/canonical/linkage.js +25 -44
  212. package/dist/canonical/linkage.js.map +1 -1
  213. package/dist/canonical/normal-form.d.ts.map +1 -1
  214. package/dist/canonical/normal-form.js +5 -11
  215. package/dist/canonical/normal-form.js.map +1 -1
  216. package/dist/canonical/structural.d.ts +21 -21
  217. package/dist/canonical/structural.d.ts.map +1 -1
  218. package/dist/canonical/structural.js +40 -19
  219. package/dist/canonical/structural.js.map +1 -1
  220. package/dist/cases/brownian-sphere.d.ts +3 -3
  221. package/dist/cases/brownian-sphere.d.ts.map +1 -1
  222. package/dist/cases/brownian-sphere.js +6 -5
  223. package/dist/cases/brownian-sphere.js.map +1 -1
  224. package/dist/cases/damped-resonator.d.ts.map +1 -1
  225. package/dist/cases/damped-resonator.js +6 -9
  226. package/dist/cases/damped-resonator.js.map +1 -1
  227. package/dist/cases/kepler-rv.d.ts +1 -1
  228. package/dist/cases/kepler-rv.d.ts.map +1 -1
  229. package/dist/cases/kepler-rv.js +3 -2
  230. package/dist/cases/kepler-rv.js.map +1 -1
  231. package/dist/cases/lumped-cooling.d.ts +8 -3
  232. package/dist/cases/lumped-cooling.d.ts.map +1 -1
  233. package/dist/cases/lumped-cooling.js +21 -23
  234. package/dist/cases/lumped-cooling.js.map +1 -1
  235. package/dist/cases/quadrature.d.ts +7 -9
  236. package/dist/cases/quadrature.d.ts.map +1 -1
  237. package/dist/cases/quadrature.js +28 -32
  238. package/dist/cases/quadrature.js.map +1 -1
  239. package/dist/cases/resistor-noise.js +4 -4
  240. package/dist/cases/resistor-noise.js.map +1 -1
  241. package/dist/cases/skin-depth.d.ts +0 -4
  242. package/dist/cases/skin-depth.d.ts.map +1 -1
  243. package/dist/cases/skin-depth.js +3 -7
  244. package/dist/cases/skin-depth.js.map +1 -1
  245. package/dist/cli/args.d.ts +23 -1
  246. package/dist/cli/args.d.ts.map +1 -1
  247. package/dist/cli/args.js +30 -8
  248. package/dist/cli/args.js.map +1 -1
  249. package/dist/cli/bindings.d.ts.map +1 -1
  250. package/dist/cli/bindings.js +5 -4
  251. package/dist/cli/bindings.js.map +1 -1
  252. package/dist/cli/command.d.ts +8 -1
  253. package/dist/cli/command.d.ts.map +1 -1
  254. package/dist/cli/command.js.map +1 -1
  255. package/dist/cli/commands/_atlas-map.d.ts +0 -9
  256. package/dist/cli/commands/_atlas-map.d.ts.map +1 -1
  257. package/dist/cli/commands/_atlas-map.js +8 -18
  258. package/dist/cli/commands/_atlas-map.js.map +1 -1
  259. package/dist/cli/commands/_atlas-route.d.ts.map +1 -1
  260. package/dist/cli/commands/_atlas-route.js +6 -2
  261. package/dist/cli/commands/_atlas-route.js.map +1 -1
  262. package/dist/cli/commands/_discovery-opts.d.ts.map +1 -1
  263. package/dist/cli/commands/_discovery-opts.js +8 -9
  264. package/dist/cli/commands/_discovery-opts.js.map +1 -1
  265. package/dist/cli/commands/atlas.d.ts.map +1 -1
  266. package/dist/cli/commands/atlas.js +8 -5
  267. package/dist/cli/commands/atlas.js.map +1 -1
  268. package/dist/cli/commands/audit.d.ts.map +1 -1
  269. package/dist/cli/commands/audit.js +8 -1
  270. package/dist/cli/commands/audit.js.map +1 -1
  271. package/dist/cli/commands/axes.d.ts.map +1 -1
  272. package/dist/cli/commands/axes.js +20 -1
  273. package/dist/cli/commands/axes.js.map +1 -1
  274. package/dist/cli/commands/confront.d.ts.map +1 -1
  275. package/dist/cli/commands/confront.js +8 -14
  276. package/dist/cli/commands/confront.js.map +1 -1
  277. package/dist/cli/commands/derive.d.ts.map +1 -1
  278. package/dist/cli/commands/derive.js +22 -22
  279. package/dist/cli/commands/derive.js.map +1 -1
  280. package/dist/cli/commands/discover.d.ts.map +1 -1
  281. package/dist/cli/commands/discover.js +6 -2
  282. package/dist/cli/commands/discover.js.map +1 -1
  283. package/dist/cli/commands/eval.d.ts.map +1 -1
  284. package/dist/cli/commands/eval.js +1 -0
  285. package/dist/cli/commands/eval.js.map +1 -1
  286. package/dist/cli/commands/evaluate.d.ts.map +1 -1
  287. package/dist/cli/commands/evaluate.js +65 -37
  288. package/dist/cli/commands/evaluate.js.map +1 -1
  289. package/dist/cli/commands/explain.d.ts.map +1 -1
  290. package/dist/cli/commands/explain.js +2 -1
  291. package/dist/cli/commands/explain.js.map +1 -1
  292. package/dist/cli/commands/ground.d.ts.map +1 -1
  293. package/dist/cli/commands/ground.js +1 -0
  294. package/dist/cli/commands/ground.js.map +1 -1
  295. package/dist/cli/commands/map.d.ts.map +1 -1
  296. package/dist/cli/commands/map.js +75 -5
  297. package/dist/cli/commands/map.js.map +1 -1
  298. package/dist/cli/commands/metric.d.ts.map +1 -1
  299. package/dist/cli/commands/metric.js +12 -9
  300. package/dist/cli/commands/metric.js.map +1 -1
  301. package/dist/cli/commands/path.d.ts +10 -0
  302. package/dist/cli/commands/path.d.ts.map +1 -1
  303. package/dist/cli/commands/path.js +25 -3
  304. package/dist/cli/commands/path.js.map +1 -1
  305. package/dist/cli/commands/probe.d.ts.map +1 -1
  306. package/dist/cli/commands/probe.js +59 -16
  307. package/dist/cli/commands/probe.js.map +1 -1
  308. package/dist/cli/commands/regime.d.ts.map +1 -1
  309. package/dist/cli/commands/regime.js +1 -0
  310. package/dist/cli/commands/regime.js.map +1 -1
  311. package/dist/cli/commands/retrieve.d.ts.map +1 -1
  312. package/dist/cli/commands/retrieve.js +1 -0
  313. package/dist/cli/commands/retrieve.js.map +1 -1
  314. package/dist/cli/commands/search.d.ts.map +1 -1
  315. package/dist/cli/commands/search.js +1 -0
  316. package/dist/cli/commands/search.js.map +1 -1
  317. package/dist/cli/commands/symbolic.d.ts.map +1 -1
  318. package/dist/cli/commands/symbolic.js +19 -28
  319. package/dist/cli/commands/symbolic.js.map +1 -1
  320. package/dist/cli/commands/testplan.d.ts.map +1 -1
  321. package/dist/cli/commands/testplan.js +4 -2
  322. package/dist/cli/commands/testplan.js.map +1 -1
  323. package/dist/cli/expr-print.d.ts +0 -2
  324. package/dist/cli/expr-print.d.ts.map +1 -1
  325. package/dist/cli/expr-print.js +7 -31
  326. package/dist/cli/expr-print.js.map +1 -1
  327. package/dist/cli/main.d.ts +7 -0
  328. package/dist/cli/main.d.ts.map +1 -1
  329. package/dist/cli/main.js +18 -3
  330. package/dist/cli/main.js.map +1 -1
  331. package/dist/cli/numeric-flag.d.ts +12 -0
  332. package/dist/cli/numeric-flag.d.ts.map +1 -0
  333. package/dist/cli/numeric-flag.js +44 -0
  334. package/dist/cli/numeric-flag.js.map +1 -0
  335. package/dist/cli/output.d.ts +20 -0
  336. package/dist/cli/output.d.ts.map +1 -1
  337. package/dist/cli/output.js +15 -0
  338. package/dist/cli/output.js.map +1 -1
  339. package/dist/cli/record-reach.js +2 -2
  340. package/dist/cli/record-reach.js.map +1 -1
  341. package/dist/cli/record-tables.d.ts.map +1 -1
  342. package/dist/cli/record-tables.js +6 -5
  343. package/dist/cli/record-tables.js.map +1 -1
  344. package/dist/cli/record.d.ts +1 -5
  345. package/dist/cli/record.d.ts.map +1 -1
  346. package/dist/cli/record.js +9 -8
  347. package/dist/cli/record.js.map +1 -1
  348. package/dist/cli/search-index.d.ts.map +1 -1
  349. package/dist/cli/search-index.js +7 -6
  350. package/dist/cli/search-index.js.map +1 -1
  351. package/dist/cli/statuses.d.ts +0 -2
  352. package/dist/cli/statuses.d.ts.map +1 -1
  353. package/dist/cli/statuses.js +0 -7
  354. package/dist/cli/statuses.js.map +1 -1
  355. package/dist/cli/stored-results.d.ts +7 -0
  356. package/dist/cli/stored-results.d.ts.map +1 -0
  357. package/dist/cli/stored-results.js +23 -0
  358. package/dist/cli/stored-results.js.map +1 -0
  359. package/dist/cli/version.d.ts.map +1 -1
  360. package/dist/cli/version.js +7 -5
  361. package/dist/cli/version.js.map +1 -1
  362. package/dist/cli-api.d.ts +34 -5
  363. package/dist/cli-api.d.ts.map +1 -1
  364. package/dist/cli-api.js +28 -4
  365. package/dist/cli-api.js.map +1 -1
  366. package/dist/composition/algebraic-equivalence.d.ts +43 -0
  367. package/dist/composition/algebraic-equivalence.d.ts.map +1 -0
  368. package/dist/composition/algebraic-equivalence.js +115 -0
  369. package/dist/composition/algebraic-equivalence.js.map +1 -0
  370. package/dist/composition/axes.d.ts +0 -6
  371. package/dist/composition/axes.d.ts.map +1 -1
  372. package/dist/composition/axes.js +6 -6
  373. package/dist/composition/axes.js.map +1 -1
  374. package/dist/composition/axis-audit.d.ts +47 -20
  375. package/dist/composition/axis-audit.d.ts.map +1 -1
  376. package/dist/composition/axis-audit.js +82 -9
  377. package/dist/composition/axis-audit.js.map +1 -1
  378. package/dist/composition/bridge-analysis.d.ts +17 -0
  379. package/dist/composition/bridge-analysis.d.ts.map +1 -1
  380. package/dist/composition/bridge-analysis.js +102 -55
  381. package/dist/composition/bridge-analysis.js.map +1 -1
  382. package/dist/composition/canonical-compare.d.ts +40 -0
  383. package/dist/composition/canonical-compare.d.ts.map +1 -1
  384. package/dist/composition/canonical-compare.js +122 -24
  385. package/dist/composition/canonical-compare.js.map +1 -1
  386. package/dist/composition/canonical-graph.d.ts +1 -1
  387. package/dist/composition/canonical-graph.d.ts.map +1 -1
  388. package/dist/composition/canonical-graph.js +9 -36
  389. package/dist/composition/canonical-graph.js.map +1 -1
  390. package/dist/composition/canonical-json.js +2 -2
  391. package/dist/composition/canonical-json.js.map +1 -1
  392. package/dist/composition/catalog-graph.d.ts.map +1 -1
  393. package/dist/composition/catalog-graph.js +2 -5
  394. package/dist/composition/catalog-graph.js.map +1 -1
  395. package/dist/composition/chain-candidate.d.ts +8 -0
  396. package/dist/composition/chain-candidate.d.ts.map +1 -1
  397. package/dist/composition/chain-candidate.js +9 -2
  398. package/dist/composition/chain-candidate.js.map +1 -1
  399. package/dist/composition/chain-match.d.ts +6 -3
  400. package/dist/composition/chain-match.d.ts.map +1 -1
  401. package/dist/composition/chain-match.js +4 -1
  402. package/dist/composition/chain-match.js.map +1 -1
  403. package/dist/composition/chain-result.d.ts.map +1 -1
  404. package/dist/composition/chain-result.js +2 -14
  405. package/dist/composition/chain-result.js.map +1 -1
  406. package/dist/composition/compose-symbolic.d.ts.map +1 -1
  407. package/dist/composition/compose-symbolic.js +3 -2
  408. package/dist/composition/compose-symbolic.js.map +1 -1
  409. package/dist/composition/compose.d.ts.map +1 -1
  410. package/dist/composition/compose.js +13 -5
  411. package/dist/composition/compose.js.map +1 -1
  412. package/dist/composition/composition-recovery.d.ts.map +1 -1
  413. package/dist/composition/composition-recovery.js +4 -7
  414. package/dist/composition/composition-recovery.js.map +1 -1
  415. package/dist/composition/discovery.d.ts +56 -0
  416. package/dist/composition/discovery.d.ts.map +1 -1
  417. package/dist/composition/discovery.js +114 -60
  418. package/dist/composition/discovery.js.map +1 -1
  419. package/dist/composition/edge.d.ts +21 -2
  420. package/dist/composition/edge.d.ts.map +1 -1
  421. package/dist/composition/edge.js +23 -1
  422. package/dist/composition/edge.js.map +1 -1
  423. package/dist/composition/enumerate.d.ts.map +1 -1
  424. package/dist/composition/enumerate.js +18 -3
  425. package/dist/composition/enumerate.js.map +1 -1
  426. package/dist/composition/evaluate-relation.d.ts +35 -11
  427. package/dist/composition/evaluate-relation.d.ts.map +1 -1
  428. package/dist/composition/evaluate-relation.js +60 -39
  429. package/dist/composition/evaluate-relation.js.map +1 -1
  430. package/dist/composition/explain.d.ts +3 -12
  431. package/dist/composition/explain.d.ts.map +1 -1
  432. package/dist/composition/explain.js +7 -20
  433. package/dist/composition/explain.js.map +1 -1
  434. package/dist/composition/expr-eval.d.ts.map +1 -1
  435. package/dist/composition/expr-eval.js +2 -11
  436. package/dist/composition/expr-eval.js.map +1 -1
  437. package/dist/composition/expr-simplify.d.ts +16 -0
  438. package/dist/composition/expr-simplify.d.ts.map +1 -1
  439. package/dist/composition/expr-simplify.js +15 -20
  440. package/dist/composition/expr-simplify.js.map +1 -1
  441. package/dist/composition/formula-shape.d.ts +23 -4
  442. package/dist/composition/formula-shape.d.ts.map +1 -1
  443. package/dist/composition/formula-shape.js +57 -17
  444. package/dist/composition/formula-shape.js.map +1 -1
  445. package/dist/composition/graph-structure.d.ts +98 -0
  446. package/dist/composition/graph-structure.d.ts.map +1 -0
  447. package/dist/composition/graph-structure.js +167 -0
  448. package/dist/composition/graph-structure.js.map +1 -0
  449. package/dist/composition/graph-viz-svg.d.ts.map +1 -1
  450. package/dist/composition/graph-viz-svg.js +1 -1
  451. package/dist/composition/graph-viz-svg.js.map +1 -1
  452. package/dist/composition/graph-viz.d.ts.map +1 -1
  453. package/dist/composition/graph-viz.js +8 -37
  454. package/dist/composition/graph-viz.js.map +1 -1
  455. package/dist/composition/identifiability.d.ts +91 -4
  456. package/dist/composition/identifiability.d.ts.map +1 -1
  457. package/dist/composition/identifiability.js +363 -6
  458. package/dist/composition/identifiability.js.map +1 -1
  459. package/dist/composition/index.d.ts +8 -4
  460. package/dist/composition/index.d.ts.map +1 -1
  461. package/dist/composition/index.js +3 -2
  462. package/dist/composition/index.js.map +1 -1
  463. package/dist/composition/mathts-quiet.d.ts +4 -3
  464. package/dist/composition/mathts-quiet.d.ts.map +1 -1
  465. package/dist/composition/mathts-quiet.js +4 -3
  466. package/dist/composition/mathts-quiet.js.map +1 -1
  467. package/dist/composition/mathts-scalar-symbols.d.ts.map +1 -1
  468. package/dist/composition/mathts-scalar-symbols.js +2 -1
  469. package/dist/composition/mathts-scalar-symbols.js.map +1 -1
  470. package/dist/composition/probe/corpus.d.ts +4 -2
  471. package/dist/composition/probe/corpus.d.ts.map +1 -1
  472. package/dist/composition/probe/corpus.js +20 -9
  473. package/dist/composition/probe/corpus.js.map +1 -1
  474. package/dist/composition/probe/dataset.d.ts +17 -0
  475. package/dist/composition/probe/dataset.d.ts.map +1 -1
  476. package/dist/composition/probe/dataset.js +95 -50
  477. package/dist/composition/probe/dataset.js.map +1 -1
  478. package/dist/composition/probe/experiment-design.d.ts +5 -1
  479. package/dist/composition/probe/experiment-design.d.ts.map +1 -1
  480. package/dist/composition/probe/experiment-design.js +44 -24
  481. package/dist/composition/probe/experiment-design.js.map +1 -1
  482. package/dist/composition/probe/falsify.d.ts.map +1 -1
  483. package/dist/composition/probe/falsify.js +2 -0
  484. package/dist/composition/probe/falsify.js.map +1 -1
  485. package/dist/composition/probe/fit.d.ts +6 -0
  486. package/dist/composition/probe/fit.d.ts.map +1 -1
  487. package/dist/composition/probe/fit.js +46 -22
  488. package/dist/composition/probe/fit.js.map +1 -1
  489. package/dist/composition/probe/frontier.d.ts.map +1 -1
  490. package/dist/composition/probe/frontier.js +33 -15
  491. package/dist/composition/probe/frontier.js.map +1 -1
  492. package/dist/composition/probe/generator.d.ts +27 -1
  493. package/dist/composition/probe/generator.d.ts.map +1 -1
  494. package/dist/composition/probe/generator.js +53 -30
  495. package/dist/composition/probe/generator.js.map +1 -1
  496. package/dist/composition/probe/index.d.ts +14 -0
  497. package/dist/composition/probe/index.d.ts.map +1 -1
  498. package/dist/composition/probe/index.js +6 -0
  499. package/dist/composition/probe/index.js.map +1 -1
  500. package/dist/composition/probe/limits.d.ts +24 -1
  501. package/dist/composition/probe/limits.d.ts.map +1 -1
  502. package/dist/composition/probe/limits.js +53 -11
  503. package/dist/composition/probe/limits.js.map +1 -1
  504. package/dist/composition/probe/pipeline.d.ts.map +1 -1
  505. package/dist/composition/probe/pipeline.js +10 -4
  506. package/dist/composition/probe/pipeline.js.map +1 -1
  507. package/dist/composition/probe/power-law.d.ts +121 -0
  508. package/dist/composition/probe/power-law.d.ts.map +1 -0
  509. package/dist/composition/probe/power-law.js +255 -0
  510. package/dist/composition/probe/power-law.js.map +1 -0
  511. package/dist/composition/probe/problem.d.ts +7 -4
  512. package/dist/composition/probe/problem.d.ts.map +1 -1
  513. package/dist/composition/probe/problem.js +177 -49
  514. package/dist/composition/probe/problem.js.map +1 -1
  515. package/dist/composition/probe/report.js +1 -1
  516. package/dist/composition/probe/report.js.map +1 -1
  517. package/dist/composition/probe/residual.d.ts +6 -1
  518. package/dist/composition/probe/residual.d.ts.map +1 -1
  519. package/dist/composition/probe/residual.js +9 -7
  520. package/dist/composition/probe/residual.js.map +1 -1
  521. package/dist/composition/probe/structure.d.ts +82 -17
  522. package/dist/composition/probe/structure.d.ts.map +1 -1
  523. package/dist/composition/probe/structure.js +129 -55
  524. package/dist/composition/probe/structure.js.map +1 -1
  525. package/dist/composition/probe/study.d.ts +31 -9
  526. package/dist/composition/probe/study.d.ts.map +1 -1
  527. package/dist/composition/probe/study.js +236 -181
  528. package/dist/composition/probe/study.js.map +1 -1
  529. package/dist/composition/probe/t-tail.d.ts +17 -0
  530. package/dist/composition/probe/t-tail.d.ts.map +1 -0
  531. package/dist/composition/probe/t-tail.js +32 -0
  532. package/dist/composition/probe/t-tail.js.map +1 -0
  533. package/dist/composition/probe/types.d.ts +3 -0
  534. package/dist/composition/probe/types.d.ts.map +1 -1
  535. package/dist/composition/probe/types.js.map +1 -1
  536. package/dist/composition/proposed-bridges.d.ts +41 -10
  537. package/dist/composition/proposed-bridges.d.ts.map +1 -1
  538. package/dist/composition/proposed-bridges.js +100 -55
  539. package/dist/composition/proposed-bridges.js.map +1 -1
  540. package/dist/composition/quantity-clusters.d.ts +48 -0
  541. package/dist/composition/quantity-clusters.d.ts.map +1 -0
  542. package/dist/composition/quantity-clusters.js +98 -0
  543. package/dist/composition/quantity-clusters.js.map +1 -0
  544. package/dist/composition/rational-exponent.d.ts +40 -0
  545. package/dist/composition/rational-exponent.d.ts.map +1 -0
  546. package/dist/composition/rational-exponent.js +65 -0
  547. package/dist/composition/rational-exponent.js.map +1 -0
  548. package/dist/composition/representative-values.d.ts +22 -0
  549. package/dist/composition/representative-values.d.ts.map +1 -1
  550. package/dist/composition/representative-values.js +23 -0
  551. package/dist/composition/representative-values.js.map +1 -1
  552. package/dist/composition/retrodiction.d.ts.map +1 -1
  553. package/dist/composition/retrodiction.js +2 -1
  554. package/dist/composition/retrodiction.js.map +1 -1
  555. package/dist/composition/user-equation.d.ts.map +1 -1
  556. package/dist/composition/user-equation.js +2 -2
  557. package/dist/composition/user-equation.js.map +1 -1
  558. package/dist/core/assignment.d.ts +19 -0
  559. package/dist/core/assignment.d.ts.map +1 -0
  560. package/dist/core/assignment.js +19 -0
  561. package/dist/core/assignment.js.map +1 -0
  562. package/dist/core/compare.d.ts +32 -0
  563. package/dist/core/compare.d.ts.map +1 -0
  564. package/dist/core/compare.js +46 -0
  565. package/dist/core/compare.js.map +1 -0
  566. package/dist/core/constants.d.ts +30 -30
  567. package/dist/core/constants.d.ts.map +1 -1
  568. package/dist/core/constants.js +47 -30
  569. package/dist/core/constants.js.map +1 -1
  570. package/dist/core/data-file.d.ts +7 -0
  571. package/dist/core/data-file.d.ts.map +1 -1
  572. package/dist/core/data-file.js +17 -0
  573. package/dist/core/data-file.js.map +1 -1
  574. package/dist/core/format.d.ts +36 -0
  575. package/dist/core/format.d.ts.map +1 -0
  576. package/dist/core/format.js +39 -0
  577. package/dist/core/format.js.map +1 -0
  578. package/dist/core/hash.d.ts +14 -0
  579. package/dist/core/hash.d.ts.map +1 -0
  580. package/dist/core/hash.js +17 -0
  581. package/dist/core/hash.js.map +1 -0
  582. package/dist/core/json-schema.d.ts +2 -0
  583. package/dist/core/json-schema.d.ts.map +1 -1
  584. package/dist/core/json-schema.js +14 -13
  585. package/dist/core/json-schema.js.map +1 -1
  586. package/dist/core/labeled-tensor.d.ts.map +1 -1
  587. package/dist/core/labeled-tensor.js +0 -8
  588. package/dist/core/labeled-tensor.js.map +1 -1
  589. package/dist/core/mathts-read.d.ts +25 -0
  590. package/dist/core/mathts-read.d.ts.map +1 -0
  591. package/dist/core/mathts-read.js +51 -0
  592. package/dist/core/mathts-read.js.map +1 -0
  593. package/dist/core/tensor.d.ts.map +1 -1
  594. package/dist/core/tensor.js +24 -0
  595. package/dist/core/tensor.js.map +1 -1
  596. package/dist/core/types.d.ts +5 -5
  597. package/dist/diff/bridge-gradient.d.ts +19 -6
  598. package/dist/diff/bridge-gradient.d.ts.map +1 -1
  599. package/dist/diff/bridge-gradient.js +19 -11
  600. package/dist/diff/bridge-gradient.js.map +1 -1
  601. package/dist/diff/bridge-specs.d.ts.map +1 -1
  602. package/dist/diff/bridge-specs.js +3 -0
  603. package/dist/diff/bridge-specs.js.map +1 -1
  604. package/dist/dimensional/algebra.d.ts +18 -0
  605. package/dist/dimensional/algebra.d.ts.map +1 -1
  606. package/dist/dimensional/algebra.js +41 -1
  607. package/dist/dimensional/algebra.js.map +1 -1
  608. package/dist/dimensional/ast-builders.d.ts +7 -0
  609. package/dist/dimensional/ast-builders.d.ts.map +1 -1
  610. package/dist/dimensional/ast-builders.js +11 -0
  611. package/dist/dimensional/ast-builders.js.map +1 -1
  612. package/dist/dimensional/ast-leaves.d.ts +81 -0
  613. package/dist/dimensional/ast-leaves.d.ts.map +1 -0
  614. package/dist/dimensional/ast-leaves.js +146 -0
  615. package/dist/dimensional/ast-leaves.js.map +1 -0
  616. package/dist/dimensional/buckingham.d.ts.map +1 -1
  617. package/dist/dimensional/buckingham.js +15 -27
  618. package/dist/dimensional/buckingham.js.map +1 -1
  619. package/dist/dimensional/constant-rows.js +9 -9
  620. package/dist/dimensional/constant-rows.js.map +1 -1
  621. package/dist/dimensional/dimension-inference.d.ts.map +1 -1
  622. package/dist/dimensional/dimension-inference.js +1 -2
  623. package/dist/dimensional/dimension-inference.js.map +1 -1
  624. package/dist/dimensional/errors.d.ts +1 -1
  625. package/dist/dimensional/errors.d.ts.map +1 -1
  626. package/dist/dimensional/errors.js +1 -15
  627. package/dist/dimensional/errors.js.map +1 -1
  628. package/dist/dimensional/exact-scale.d.ts +0 -17
  629. package/dist/dimensional/exact-scale.d.ts.map +1 -1
  630. package/dist/dimensional/exact-scale.js +8 -8
  631. package/dist/dimensional/exact-scale.js.map +1 -1
  632. package/dist/dimensional/gauge-field.d.ts.map +1 -1
  633. package/dist/dimensional/gauge-field.js +2 -2
  634. package/dist/dimensional/gauge-field.js.map +1 -1
  635. package/dist/dimensional/hyphen-names.d.ts +12 -2
  636. package/dist/dimensional/hyphen-names.d.ts.map +1 -1
  637. package/dist/dimensional/hyphen-names.js +44 -19
  638. package/dist/dimensional/hyphen-names.js.map +1 -1
  639. package/dist/dimensional/metric.d.ts.map +1 -1
  640. package/dist/dimensional/metric.js +0 -1
  641. package/dist/dimensional/metric.js.map +1 -1
  642. package/dist/dimensional/symbolic-constants.d.ts +9 -0
  643. package/dist/dimensional/symbolic-constants.d.ts.map +1 -1
  644. package/dist/dimensional/symbolic-constants.js +13 -1
  645. package/dist/dimensional/symbolic-constants.js.map +1 -1
  646. package/dist/dimensional/types.d.ts +36 -0
  647. package/dist/dimensional/types.d.ts.map +1 -1
  648. package/dist/dimensional/types.js +45 -7
  649. package/dist/dimensional/types.js.map +1 -1
  650. package/dist/dimensional/unit-data.js +2 -2
  651. package/dist/dimensional/unit-data.js.map +1 -1
  652. package/dist/index.d.ts +9 -3
  653. package/dist/index.d.ts.map +1 -1
  654. package/dist/index.js +10 -4
  655. package/dist/index.js.map +1 -1
  656. package/dist/numerical/christoffel-flat.d.ts.map +1 -1
  657. package/dist/numerical/christoffel-flat.js +3 -2
  658. package/dist/numerical/christoffel-flat.js.map +1 -1
  659. package/dist/numerical/covariant-eikonal.d.ts.map +1 -1
  660. package/dist/numerical/covariant-eikonal.js +34 -11
  661. package/dist/numerical/covariant-eikonal.js.map +1 -1
  662. package/dist/numerical/curvature-lowering-helpers.js +3 -2
  663. package/dist/numerical/curvature-lowering-helpers.js.map +1 -1
  664. package/dist/numerical/errors.d.ts.map +1 -1
  665. package/dist/numerical/errors.js +0 -3
  666. package/dist/numerical/errors.js.map +1 -1
  667. package/dist/numerical/finite-difference.d.ts +22 -0
  668. package/dist/numerical/finite-difference.d.ts.map +1 -0
  669. package/dist/numerical/finite-difference.js +27 -0
  670. package/dist/numerical/finite-difference.js.map +1 -0
  671. package/dist/numerical/geodesic-integrator.d.ts.map +1 -1
  672. package/dist/numerical/geodesic-integrator.js +22 -14
  673. package/dist/numerical/geodesic-integrator.js.map +1 -1
  674. package/dist/numerical/geometrized.d.ts.map +1 -1
  675. package/dist/numerical/geometrized.js +0 -1
  676. package/dist/numerical/geometrized.js.map +1 -1
  677. package/dist/numerical/mathts-engine.d.ts.map +1 -1
  678. package/dist/numerical/mathts-engine.js +10 -24
  679. package/dist/numerical/mathts-engine.js.map +1 -1
  680. package/dist/numerical/metric-inverse.d.ts.map +1 -1
  681. package/dist/numerical/metric-inverse.js +83 -46
  682. package/dist/numerical/metric-inverse.js.map +1 -1
  683. package/dist/numerical/null-ray-integrator.d.ts +2 -1
  684. package/dist/numerical/null-ray-integrator.d.ts.map +1 -1
  685. package/dist/numerical/null-ray-integrator.js +12 -12
  686. package/dist/numerical/null-ray-integrator.js.map +1 -1
  687. package/dist/numerical/painleve-gullstrand-metric.js +2 -2
  688. package/dist/numerical/painleve-gullstrand-metric.js.map +1 -1
  689. package/dist/numerical/perihelion-finder.d.ts +0 -36
  690. package/dist/numerical/perihelion-finder.d.ts.map +1 -1
  691. package/dist/numerical/perihelion-finder.js +41 -87
  692. package/dist/numerical/perihelion-finder.js.map +1 -1
  693. package/dist/numerical/quadrature.d.ts.map +1 -1
  694. package/dist/numerical/quadrature.js +8 -10
  695. package/dist/numerical/quadrature.js.map +1 -1
  696. package/dist/numerical/rk4-trajectory.d.ts +10 -0
  697. package/dist/numerical/rk4-trajectory.d.ts.map +1 -0
  698. package/dist/numerical/rk4-trajectory.js +37 -0
  699. package/dist/numerical/rk4-trajectory.js.map +1 -0
  700. package/dist/numerical/schwarzschild.d.ts +14 -0
  701. package/dist/numerical/schwarzschild.d.ts.map +1 -0
  702. package/dist/numerical/schwarzschild.js +17 -0
  703. package/dist/numerical/schwarzschild.js.map +1 -0
  704. package/dist/numerical/spacetime-metrics.d.ts +12 -0
  705. package/dist/numerical/spacetime-metrics.d.ts.map +1 -1
  706. package/dist/numerical/spacetime-metrics.js +72 -56
  707. package/dist/numerical/spacetime-metrics.js.map +1 -1
  708. package/dist/numerical/statistics.d.ts +24 -0
  709. package/dist/numerical/statistics.d.ts.map +1 -0
  710. package/dist/numerical/statistics.js +52 -0
  711. package/dist/numerical/statistics.js.map +1 -0
  712. package/dist/numerical/tensor-engine.d.ts +21 -0
  713. package/dist/numerical/tensor-engine.d.ts.map +1 -1
  714. package/dist/numerical/tensor-engine.js +12 -0
  715. package/dist/numerical/tensor-engine.js.map +1 -1
  716. package/dist/relations/regime.d.ts +10 -0
  717. package/dist/relations/regime.d.ts.map +1 -1
  718. package/dist/relations/regime.js +18 -1
  719. package/dist/relations/regime.js.map +1 -1
  720. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"constant-rows.js","sourceRoot":"","sources":["../../src/dimensional/constant-rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,WAAW,EACX,UAAU,EACV,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,iBAAiB,EACjB,MAAM,EACN,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,WAAW,EACX,wBAAwB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AA6CnE,MAAM,GAAG,GAAG,CAAC,KAAe,EAAe,EAAE,CAAC,CAAC;IAC7C,GAAG,KAAK;IACR,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,EAAE;IAChC,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,KAAK;CACpC,CAAC,CAAC;AAEH,MAAM,KAAK,GAAG,mBAAmB,CAAC;AAElC,2FAA2F;AAC3F,MAAM,CAAC,MAAM,aAAa,GAA2B;IACnD,0EAA0E;IAC1E,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,yBAAyB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EA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,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,oBAAoB,CAAC,CAAC;QACpG,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;AACH,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,OAAO,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC","sourcesContent":["/**\n * The constant registry's rows as written: name, spellings, SI value, SI unit\n * text, meaning, source and flags, one row per physical constant a formula or\n * the unit table may name.\n *\n * `symbolic-constants.ts` derives each row's dimension from its unit with\n * `parseUnit` and owns every projection. The rows live here, apart from that\n * derivation, because the unit table reads constants too: `data/units.json`\n * names `c`, `e`, `m_u`, `M_sun`, `Msun_iau` and `ln2` by these spellings, and\n * the unit parser cannot import a module that imports the unit parser. This\n * module imports only `core/constants.ts`, the owner of every value, so the\n * unit loader and the registry read one set of spellings with no cycle.\n *\n * INTERNAL — not on the public surface.\n *\n * @module dimensional/constant-rows\n */\n\nimport {\n B_WIEN_SI,\n C_SI,\n E_SI,\n EPS0_SI,\n EULER_GAMMA,\n FARADAY_SI,\n G_SI,\n GM_SUN_SI,\n H_SI,\n HBAR_CODATA_DISPLAY,\n HBAR_SI,\n K_B_SI,\n LANE_EMDEN_OMEGA3,\n M_E_SI,\n M_PROTON_SI,\n M_SUN_IAU_SI,\n M_SUN_SI,\n M_U_SI,\n MU0_SI,\n N_A_SI,\n SIGMA_SB_SI,\n THOMSON_CROSS_SECTION_SI, R_INF_SI } from '../core/constants.js';\n\n/** One registered constant as written: everything but the dimension, which `symbolic-constants.ts` derives from `unit`. @internal */\nexport interface ConstantRow {\n /** The formula name; the first spelling, and the key of every projection. */\n readonly name: string;\n /** Other exact-case spellings a caller may type. */\n readonly spellings: readonly string[];\n readonly value: number;\n /** The SI unit, in the syntax `parseUnit` reads. The dimension is derived from it. */\n readonly unit: string;\n readonly meaning: string;\n readonly source: string;\n /** A universal constant a canonical `governing` list may bake. */\n readonly canonical: boolean;\n /** A caveat printed wherever the constant is used (`upt eval`, a relation that names it). */\n readonly note?: string;\n /** The `@danielsimonjr/mathts-functions` export that states the same constant (CODATA 2022 there), when one exists. The second method. */\n readonly mathts?: string;\n /** The two libraries agree to the last bit: exact in the 2019 SI, or a product of exact constants. */\n readonly exact?: true;\n /**\n * The `data/quantities.json` id this constant is also a quantity of. The\n * quantity registry takes the constant's spellings as that row's aliases;\n * the file does not repeat them, so a spelling has one owner.\n */\n readonly quantity?: string;\n /**\n * A mathematical constant no rational states (ln 2, 2π, 4π, 8π). An exact\n * reader (`data/units.json`'s scale expressions) carries `value` as the\n * irrational factor instead of reading its decimal as a rational.\n */\n readonly irrational?: true;\n}\n\ntype RowInput = Omit<ConstantRow, 'spellings' | 'canonical' | 'note' | 'mathts' | 'exact' | 'quantity' | 'irrational'> & {\n readonly quantity?: string;\n readonly irrational?: true;\n readonly note?: string;\n readonly mathts?: string;\n readonly exact?: true;\n readonly spellings?: readonly string[];\n readonly canonical?: boolean;\n};\n\nconst row = (input: RowInput): ConstantRow => ({\n ...input,\n spellings: input.spellings ?? [],\n canonical: input.canonical ?? false,\n});\n\nconst OWNER = 'core/constants.ts';\n\n/** Every registered constant as written. Order is the order the tables print. @internal */\nexport const CONSTANT_ROWS: readonly ConstantRow[] = [\n // ── universal constants a canonical equation may bake ──────────────────\n row({ name: 'hbar', spellings: ['ℏ', 'reduced-planck-constant'], value: HBAR_SI, unit: 'J*s', canonical: true, mathts: 'reducedPlanckConstant', exact: true,\n meaning: 'reduced Planck constant h/(2π)', source: `exact H_SI/(2π) (${OWNER} HBAR_SI)`,\n note:\n `hbar is HBAR_SI = H_SI/(2π), the exact reduced Planck constant. The CODATA display ${HBAR_CODATA_DISPLAY} ` +\n `is that quotient truncated (relative difference ${(Math.abs(HBAR_CODATA_DISPLAY - HBAR_SI) / HBAR_SI).toExponential(3)}).` }),\n row({ name: 'h', quantity: 'planck-constant', value: H_SI, unit: 'J*s', canonical: true, mathts: 'planckConstant', exact: true,\n meaning: 'Planck constant', source: `exact SI, 2019 redefinition (${OWNER} H_SI)` }),\n row({ name: 'c', spellings: ['speed-of-light', 'speed_of_light'], value: C_SI, unit: 'm/s', canonical: true, mathts: 'speedOfLight', exact: true,\n meaning: 'speed of light in vacuum', source: `exact SI (${OWNER} C_SI)` }),\n row({ name: 'R_inf', spellings: ['Rinf', 'R_infinity', 'rydberg'], quantity: 'rydberg-constant', value: R_INF_SI, unit: '1/m', canonical: true, mathts: 'rydberg',\n meaning: 'Rydberg constant R∞, infinite nuclear mass (the reduced-mass correction R_M = R∞/(1 + m_e/M) is not applied)', source: `CODATA 2018 (${OWNER} R_INF_SI)` }),\n row({ name: 'G', value: G_SI, unit: 'm^3/(kg*s^2)', canonical: true, mathts: 'gravitationConstant',\n meaning: 'Newtonian gravitational constant', source: `CODATA 2018 (${OWNER} G_SI)` }),\n row({ name: 'k_B', spellings: ['kB', 'boltzmann'], quantity: 'boltzmann-constant', value: K_B_SI, unit: 'J/K', canonical: true, mathts: 'boltzmann', exact: true,\n meaning: 'Boltzmann constant', source: `exact SI, 2019 redefinition (${OWNER} K_B_SI)` }),\n row({ name: 'ln2', value: Math.LN2, unit: '1', canonical: true, irrational: true,\n meaning: 'natural logarithm of 2', source: 'mathematical constant (Math.LN2)' }),\n row({ name: '8pi', value: 8 * Math.PI, unit: '1', canonical: true, irrational: true,\n meaning: '8π', source: 'mathematical constant (8·Math.PI)' }),\n row({ name: '4pi', value: 4 * Math.PI, unit: '1', canonical: true, irrational: true,\n meaning: '4π', source: 'mathematical constant (4·Math.PI)' }),\n row({ name: '2pi', value: 2 * Math.PI, unit: '1', canonical: true, irrational: true,\n meaning: '2π', source: 'mathematical constant (2·Math.PI)' }),\n // ISO 80000 / CODATA: a bare e is the elementary charge. Eccentricity is\n // one_minus_e_sq. The canonical dimension guard still refuses to bake a\n // dimensionless governing name e.\n row({ name: 'e', spellings: ['e_charge'], value: E_SI, unit: 'C', canonical: true, mathts: 'elementaryCharge', exact: true,\n meaning: 'elementary charge', source: `exact SI, 2019 redefinition (${OWNER} E_SI)` }),\n row({ name: 'epsilon_0', spellings: ['epsilon0', 'eps0', 'vacuum-permittivity'], value: EPS0_SI, unit: 'F/m', canonical: true,\n meaning: 'vacuum permittivity', source: `CODATA 2018 (${OWNER} EPS0_SI)` }),\n row({ name: 'sigma_sb', spellings: ['stefan-boltzmann-constant'], value: SIGMA_SB_SI, unit: 'W/(m^2*K^4)', canonical: true, mathts: 'stefanBoltzmann',\n meaning: 'Stefan–Boltzmann constant', source: `CODATA 2018 (${OWNER} SIGMA_SB_SI)` }),\n row({ name: 'b', spellings: ['wien-constant'], value: B_WIEN_SI, unit: 'm*K', canonical: true, mathts: 'wienDisplacement',\n meaning: 'Wien displacement constant', source: `CODATA 2018 (${OWNER} B_WIEN_SI)` }),\n // IAU 2015 nominal solar parameter. M_sun in eval stays the rounded kilogram M_SUN_SI.\n row({ name: 'GM_sun', value: GM_SUN_SI, unit: 'm^3/s^2', canonical: true,\n meaning: 'IAU nominal solar gravitational parameter (GM)☉', source: `IAU 2015 Resolution B3 (${OWNER} GM_SUN_SI)` }),\n row({ name: 'Msun_iau', value: M_SUN_IAU_SI, unit: 'kg', canonical: true,\n meaning: 'IAU solar mass (GM)☉/G, the mass that reproduces GM_sun with G_SI', source: `GM_SUN_SI/G_SI (${OWNER} M_SUN_IAU_SI)` }),\n row({ name: 'm_u', value: M_U_SI, unit: 'kg', canonical: true, mathts: 'atomicMass',\n meaning: 'unified atomic mass unit (atomic mass constant)', source: `CODATA 2018 (${OWNER} M_U_SI)` }),\n row({ name: 'm_e', spellings: ['electron_mass', 'electron-mass'], value: M_E_SI, unit: 'kg', canonical: true, mathts: 'electronMass',\n meaning: 'electron mass', source: `CODATA 2018 (${OWNER} M_E_SI)` }),\n // ── overlay names for `upt eval` and the dimensional assignment only ────\n row({ name: 'mu_0', spellings: ['mu0'], value: MU0_SI, unit: 'H/m', mathts: 'magneticConstant',\n meaning: 'vacuum permeability 1/(ε₀ c²)', source: `1/(EPS0_SI·C_SI²) (${OWNER} MU0_SI)` }),\n row({ name: 'm_p', spellings: ['m_proton'], value: M_PROTON_SI, unit: 'kg', mathts: 'protonMass',\n meaning: 'proton mass', source: `CODATA 2018 (${OWNER} M_PROTON_SI)` }),\n row({ name: 'N_A', value: N_A_SI, unit: 'mol^-1', mathts: 'avogadro', exact: true,\n meaning: 'Avogadro constant', source: `exact SI, 2019 redefinition (${OWNER} N_A_SI)` }),\n row({ name: 'F', value: FARADAY_SI, unit: 'C/mol', mathts: 'faraday', exact: true,\n meaning: 'Faraday constant N_A e', source: `N_A_SI·E_SI (${OWNER} FARADAY_SI)` }),\n // R = N_A k_B, the molar gas constant the thermochemical records state in their titles.\n row({ name: 'R', value: N_A_SI * K_B_SI, unit: 'J/(mol*K)', mathts: 'gasConstant', exact: true,\n meaning: 'molar gas constant N_A k_B', source: `N_A_SI·K_B_SI (${OWNER})` }),\n row({ name: 'M_sun', value: M_SUN_SI, unit: 'kg',\n meaning: 'solar mass, the repo-conventional kilogram value', source: `${OWNER} M_SUN_SI` }),\n // `curvature_k` and `scale_factor` are the Friedmann curvature extension\n // (the frozen `CE-friedmann` entry is the flat term).\n row({ name: 'curvature_k', value: 0, unit: '1',\n meaning: 'Friedmann curvature index, flat by default', source: 'this registry (flat default 0)' }),\n row({ name: 'scale_factor', value: 1, unit: 'm',\n meaning: 'Friedmann scale factor, unit by default', source: 'this registry (default 1)' }),\n row({ name: 'sigma_T', value: THOMSON_CROSS_SECTION_SI, unit: 'm^2', mathts: 'thomsonCrossSection',\n meaning: 'Thomson cross section', source: `CODATA 2018 (${OWNER} THOMSON_CROSS_SECTION_SI)` }),\n row({ name: 'lane_emden_omega_3', quantity: 'lane-emden-omega-3', value: LANE_EMDEN_OMEGA3, unit: '1',\n meaning: 'Lane–Emden n = 3 dimensionless radius', source: `${OWNER} LANE_EMDEN_OMEGA3` }),\n row({ name: 'euler_gamma', value: EULER_GAMMA, unit: '1',\n meaning: 'Euler–Mascheroni constant γ', source: `${OWNER} EULER_GAMMA` }),\n // GRW mass amplification: λ = λ₀ · (m / m₀), with λ₀ a rate and m₀ a mass.\n // The two numbers are the catalog expression's, so the rate is unchanged.\n row({ name: 'grw_lambda0', value: 1e-16, unit: 'Hz',\n meaning: 'GRW localization rate λ₀', source: 'catalog expression (Ghirardi–Rimini–Weber 1986)' }),\n row({ name: 'grw_m0', value: 1.67e-27, unit: 'kg',\n meaning: 'GRW reference mass m₀ (a nucleon)', source: 'catalog expression (Ghirardi–Rimini–Weber 1986)' }),\n];\n\nconst BY_SPELLING = new Map<string, ConstantRow>();\nfor (const constant of CONSTANT_ROWS) {\n for (const spelling of [constant.name, ...constant.spellings]) {\n if (BY_SPELLING.has(spelling)) throw new Error(`constant registry: '${spelling}' is spelled twice`);\n BY_SPELLING.set(spelling, constant);\n }\n}\n\n/** The registered constant row `spelling` names, or undefined. @internal */\nexport function constantRow(spelling: string): ConstantRow | undefined {\n return BY_SPELLING.get(spelling);\n}\n"]}
1
+ {"version":3,"file":"constant-rows.js","sourceRoot":"","sources":["../../src/dimensional/constant-rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,WAAW,EACX,UAAU,EACV,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,iBAAiB,EACjB,MAAM,EACN,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,WAAW,EACX,wBAAwB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AA6CnE,MAAM,GAAG,GAAG,CAAC,KAAe,EAAe,EAAE,CAAC,CAAC;IAC7C,GAAG,KAAK;IACR,SAAS,EAAE,KAAK,CAAC,SAAS,IAA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E,QAAQ,EAAE,IAAI,EAAE,IAAI;QAC/C,OAAO,EAAE,mCAAmC,EAAE,MAAM,EAAE,iDAAiD,EAAE,CAAC;CAC7G,CAAC;AAEF,MAAM,WAAW,GAAG,IAAI,GAAG,EAAuB,CAAC;AACnD,KAAK,MAAM,QAAQ,IAAI,aAAa,EAAE,CAAC;IACrC,KAAK,MAAM,QAAQ,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9D,IAAI,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,oBAAoB,CAAC,CAAC;QACpG,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;AACH,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,OAAO,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC","sourcesContent":["/**\n * The constant registry's rows as written: name, spellings, SI value, SI unit\n * text, meaning, source and flags, one row per physical constant a formula or\n * the unit table may name.\n *\n * `symbolic-constants.ts` derives each row's dimension from its unit with\n * `parseUnit` and owns every projection. The rows live here, apart from that\n * derivation, because the unit table reads constants too: `data/units.json`\n * names `c`, `e`, `m_u`, `M_sun`, `Msun_iau` and `ln2` by these spellings, and\n * the unit parser cannot import a module that imports the unit parser. This\n * module imports only `core/constants.ts`, the owner of every value, so the\n * unit loader and the registry read one set of spellings with no cycle.\n *\n * INTERNAL — not on the public surface.\n *\n * @module dimensional/constant-rows\n */\n\nimport {\n B_WIEN_SI,\n C_SI,\n E_SI,\n EPS0_SI,\n EULER_GAMMA,\n FARADAY_SI,\n G_SI,\n GM_SUN_SI,\n H_SI,\n HBAR_CODATA_DISPLAY,\n HBAR_SI,\n K_B_SI,\n LANE_EMDEN_OMEGA3,\n M_E_SI,\n M_PROTON_SI,\n M_SUN_IAU_SI,\n M_SUN_SI,\n M_U_SI,\n MU0_SI,\n N_A_SI,\n SIGMA_SB_SI,\n THOMSON_CROSS_SECTION_SI, R_INF_SI } from '../core/constants.js';\n\n/** One registered constant as written: everything but the dimension, which `symbolic-constants.ts` derives from `unit`. @internal */\nexport interface ConstantRow {\n /** The formula name; the first spelling, and the key of every projection. */\n readonly name: string;\n /** Other exact-case spellings a caller may type. */\n readonly spellings: readonly string[];\n readonly value: number;\n /** The SI unit, in the syntax `parseUnit` reads. The dimension is derived from it. */\n readonly unit: string;\n readonly meaning: string;\n readonly source: string;\n /** A universal constant a canonical `governing` list may bake. */\n readonly canonical: boolean;\n /** A caveat printed wherever the constant is used (`upt eval`, a relation that names it). */\n readonly note?: string;\n /** The `@danielsimonjr/mathts-functions` export that states the same constant (CODATA 2022 there), when one exists. The second method. */\n readonly mathts?: string;\n /** The two libraries agree to the last bit: exact in the 2019 SI, or a product of exact constants. */\n readonly exact?: true;\n /**\n * The `data/quantities.json` id this constant is also a quantity of. The\n * quantity registry takes the constant's spellings as that row's aliases;\n * the file does not repeat them, so a spelling has one owner.\n */\n readonly quantity?: string;\n /**\n * A mathematical constant no rational states (ln 2, 2π, 4π, 8π). An exact\n * reader (`data/units.json`'s scale expressions) carries `value` as the\n * irrational factor instead of reading its decimal as a rational.\n */\n readonly irrational?: true;\n}\n\ntype RowInput = Omit<ConstantRow, 'spellings' | 'canonical' | 'note' | 'mathts' | 'exact' | 'quantity' | 'irrational'> & {\n readonly quantity?: string;\n readonly irrational?: true;\n readonly note?: string;\n readonly mathts?: string;\n readonly exact?: true;\n readonly spellings?: readonly string[];\n readonly canonical?: boolean;\n};\n\nconst row = (input: RowInput): ConstantRow => ({\n ...input,\n spellings: input.spellings ?? [],\n canonical: input.canonical ?? false,\n});\n\nconst OWNER = 'core/constants.ts';\n\n/** Every registered constant as written. Order is the order the tables print. @internal */\nexport const CONSTANT_ROWS: readonly ConstantRow[] = [\n // ── universal constants a canonical equation may bake ──────────────────\n row({ name: 'hbar', spellings: ['ℏ', 'reduced-planck-constant'], value: HBAR_SI, unit: 'J*s', canonical: true, mathts: 'reducedPlanckConstant', exact: true,\n meaning: 'reduced Planck constant h/(2π)', source: `exact H_SI/(2π) (${OWNER} HBAR_SI)`,\n note:\n `hbar is HBAR_SI = H_SI/(2π), the exact reduced Planck constant. The CODATA display ${HBAR_CODATA_DISPLAY} ` +\n `is that quotient truncated (relative difference ${(Math.abs(HBAR_CODATA_DISPLAY - HBAR_SI) / HBAR_SI).toExponential(3)}).` }),\n row({ name: 'h', quantity: 'planck-constant', value: H_SI, unit: 'J*s', canonical: true, mathts: 'planckConstant', exact: true,\n meaning: 'Planck constant', source: `exact SI, 2019 redefinition (${OWNER} H_SI)` }),\n row({ name: 'c', spellings: ['speed-of-light', 'speed_of_light'], value: C_SI, unit: 'm/s', canonical: true, mathts: 'speedOfLight', exact: true,\n meaning: 'speed of light in vacuum', source: `exact SI (${OWNER} C_SI)` }),\n row({ name: 'R_inf', spellings: ['Rinf', 'R_infinity', 'rydberg'], quantity: 'rydberg-constant', value: R_INF_SI, unit: '1/m', canonical: true, mathts: 'rydberg',\n meaning: 'Rydberg constant R∞, infinite nuclear mass (the reduced-mass correction R_M = R∞/(1 + m_e/M) is not applied)', source: `CODATA 2022, MathTS (${OWNER} R_INF_SI)` }),\n row({ name: 'G', value: G_SI, unit: 'm^3/(kg*s^2)', canonical: true, mathts: 'gravitationConstant',\n meaning: 'Newtonian gravitational constant', source: `CODATA 2022, MathTS (${OWNER} G_SI)` }),\n row({ name: 'k_B', spellings: ['kB', 'boltzmann'], quantity: 'boltzmann-constant', value: K_B_SI, unit: 'J/K', canonical: true, mathts: 'boltzmann', exact: true,\n meaning: 'Boltzmann constant', source: `exact SI, 2019 redefinition (${OWNER} K_B_SI)` }),\n row({ name: 'ln2', value: Math.LN2, unit: '1', canonical: true, irrational: true,\n meaning: 'natural logarithm of 2', source: 'mathematical constant (Math.LN2)' }),\n row({ name: '8pi', value: 8 * Math.PI, unit: '1', canonical: true, irrational: true,\n meaning: '8π', source: 'mathematical constant (8·Math.PI)' }),\n row({ name: '4pi', value: 4 * Math.PI, unit: '1', canonical: true, irrational: true,\n meaning: '4π', source: 'mathematical constant (4·Math.PI)' }),\n row({ name: '2pi', value: 2 * Math.PI, unit: '1', canonical: true, irrational: true,\n meaning: '2π', source: 'mathematical constant (2·Math.PI)' }),\n // ISO 80000 / CODATA: a bare e is the elementary charge. Eccentricity is\n // one_minus_e_sq. The canonical dimension guard still refuses to bake a\n // dimensionless governing name e.\n row({ name: 'e', spellings: ['e_charge'], value: E_SI, unit: 'C', canonical: true, mathts: 'elementaryCharge', exact: true,\n meaning: 'elementary charge', source: `exact SI, 2019 redefinition (${OWNER} E_SI)` }),\n row({ name: 'epsilon_0', spellings: ['epsilon0', 'eps0', 'vacuum-permittivity'], value: EPS0_SI, unit: 'F/m', canonical: true,\n meaning: 'vacuum permittivity', source: `CODATA 2022, MathTS (${OWNER} EPS0_SI)` }),\n row({ name: 'sigma_sb', spellings: ['stefan-boltzmann-constant'], value: SIGMA_SB_SI, unit: 'W/(m^2*K^4)', canonical: true, mathts: 'stefanBoltzmann',\n meaning: 'Stefan–Boltzmann constant', source: `CODATA 2022, MathTS (${OWNER} SIGMA_SB_SI)` }),\n row({ name: 'b', spellings: ['wien-constant'], value: B_WIEN_SI, unit: 'm*K', canonical: true, mathts: 'wienDisplacement',\n meaning: 'Wien displacement constant', source: `CODATA 2022, MathTS (${OWNER} B_WIEN_SI)` }),\n // IAU 2015 nominal solar parameter. M_sun in eval stays the rounded kilogram M_SUN_SI.\n row({ name: 'GM_sun', value: GM_SUN_SI, unit: 'm^3/s^2', canonical: true,\n meaning: 'IAU nominal solar gravitational parameter (GM)☉', source: `IAU 2015 Resolution B3 (${OWNER} GM_SUN_SI)` }),\n row({ name: 'Msun_iau', value: M_SUN_IAU_SI, unit: 'kg', canonical: true,\n meaning: 'IAU solar mass (GM)☉/G, the mass that reproduces GM_sun with G_SI', source: `GM_SUN_SI/G_SI (${OWNER} M_SUN_IAU_SI)` }),\n row({ name: 'm_u', value: M_U_SI, unit: 'kg', canonical: true, mathts: 'atomicMass',\n meaning: 'unified atomic mass unit (atomic mass constant)', source: `CODATA 2022, MathTS (${OWNER} M_U_SI)` }),\n row({ name: 'm_e', spellings: ['electron_mass', 'electron-mass'], value: M_E_SI, unit: 'kg', canonical: true, mathts: 'electronMass',\n meaning: 'electron mass', source: `CODATA 2022, MathTS (${OWNER} M_E_SI)` }),\n // ── overlay names for `upt eval` and the dimensional assignment only ────\n row({ name: 'mu_0', spellings: ['mu0'], value: MU0_SI, unit: 'H/m', mathts: 'magneticConstant',\n meaning: 'vacuum permeability 1/(ε₀ c²)', source: `1/(EPS0_SI·C_SI²) (${OWNER} MU0_SI)` }),\n row({ name: 'm_p', spellings: ['m_proton'], value: M_PROTON_SI, unit: 'kg', mathts: 'protonMass',\n meaning: 'proton mass', source: `CODATA 2022, MathTS (${OWNER} M_PROTON_SI)` }),\n row({ name: 'N_A', value: N_A_SI, unit: 'mol^-1', mathts: 'avogadro', exact: true,\n meaning: 'Avogadro constant', source: `exact SI, 2019 redefinition (${OWNER} N_A_SI)` }),\n row({ name: 'F', value: FARADAY_SI, unit: 'C/mol', mathts: 'faraday', exact: true,\n meaning: 'Faraday constant N_A e', source: `N_A_SI·E_SI (${OWNER} FARADAY_SI)` }),\n // R = N_A k_B, the molar gas constant the thermochemical records state in their titles.\n row({ name: 'R', value: N_A_SI * K_B_SI, unit: 'J/(mol*K)', mathts: 'gasConstant', exact: true,\n meaning: 'molar gas constant N_A k_B', source: `N_A_SI·K_B_SI (${OWNER})` }),\n row({ name: 'M_sun', value: M_SUN_SI, unit: 'kg',\n meaning: 'solar mass, the repo-conventional kilogram value', source: `${OWNER} M_SUN_SI` }),\n // `curvature_k` and `scale_factor` are the Friedmann curvature extension\n // (the frozen `CE-friedmann` entry is the flat term).\n row({ name: 'curvature_k', value: 0, unit: '1',\n meaning: 'Friedmann curvature index, flat by default', source: 'this registry (flat default 0)' }),\n row({ name: 'scale_factor', value: 1, unit: 'm',\n meaning: 'Friedmann scale factor, unit by default', source: 'this registry (default 1)' }),\n row({ name: 'sigma_T', value: THOMSON_CROSS_SECTION_SI, unit: 'm^2', mathts: 'thomsonCrossSection',\n meaning: 'Thomson cross section', source: `CODATA 2022, MathTS (${OWNER} THOMSON_CROSS_SECTION_SI)` }),\n row({ name: 'lane_emden_omega_3', quantity: 'lane-emden-omega-3', value: LANE_EMDEN_OMEGA3, unit: '1',\n meaning: 'Lane–Emden n = 3 dimensionless radius', source: `${OWNER} LANE_EMDEN_OMEGA3` }),\n row({ name: 'euler_gamma', value: EULER_GAMMA, unit: '1',\n meaning: 'Euler–Mascheroni constant γ', source: `${OWNER} EULER_GAMMA` }),\n // GRW mass amplification: λ = λ₀ · (m / m₀), with λ₀ a rate and m₀ a mass.\n // The two numbers are the catalog expression's, so the rate is unchanged.\n row({ name: 'grw_lambda0', value: 1e-16, unit: 'Hz',\n meaning: 'GRW localization rate λ₀', source: 'catalog expression (Ghirardi–Rimini–Weber 1986)' }),\n row({ name: 'grw_m0', value: 1.67e-27, unit: 'kg',\n meaning: 'GRW reference mass m₀ (a nucleon)', source: 'catalog expression (Ghirardi–Rimini–Weber 1986)' }),\n];\n\nconst BY_SPELLING = new Map<string, ConstantRow>();\nfor (const constant of CONSTANT_ROWS) {\n for (const spelling of [constant.name, ...constant.spellings]) {\n if (BY_SPELLING.has(spelling)) throw new Error(`constant registry: '${spelling}' is spelled twice`);\n BY_SPELLING.set(spelling, constant);\n }\n}\n\n/** The registered constant row `spelling` names, or undefined. @internal */\nexport function constantRow(spelling: string): ConstantRow | undefined {\n return BY_SPELLING.get(spelling);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"dimension-inference.d.ts","sourceRoot":"","sources":["../../src/dimensional/dimension-inference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAK/C;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,QAAQ,CAa1F;AAQD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,SAAS,GACnB,SAAS,GAAG,IAAI,CAyBlB"}
1
+ {"version":3,"file":"dimension-inference.d.ts","sourceRoot":"","sources":["../../src/dimensional/dimension-inference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,QAAQ,CAa1F;AAQD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,SAAS,GACnB,SAAS,GAAG,IAAI,CAyBlB"}
@@ -18,9 +18,8 @@
18
18
  * @module dimensional/dimension-inference
19
19
  */
20
20
  import { DIMENSIONLESS, LENGTH } from './types.js';
21
- import { divide, power, EXPONENT_TOL } from './algebra.js';
21
+ import { BASES, divide, power, EXPONENT_TOL } from './algebra.js';
22
22
  import { validate } from './validator.js';
23
- const BASES = ['L', 'M', 'T', 'I', 'Theta', 'N', 'J'];
24
23
  /**
25
24
  * Rebuild `node`, replacing the dimension of every `symbol` named `name` with
26
25
  * `dim`. Walks the scalar arms (`symbol`/`op`/`transcendental`/`abs`); other
@@ -1 +1 @@
1
- {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IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACzC,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,YAAY;YAAE,OAAO,IAAI,CAAC;QACjE,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IAC1B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["/**\n * Single-unknown dimensional inference.\n *\n * Given a parsed scalar `ExprNode` (e.g. the RHS of a user equation) in which\n * exactly one symbol's dimension is unknown, and the known dimension the whole\n * expression must equal (the target), recover the unknown's dimension from\n * dimensional homogeneity — or abstain (`null`) when it is not uniquely pinned\n * (the unknown is sum-constrained, absent, or appears non-cleanly).\n *\n * Method (no symbolic differentiation): probe the unknown with two dimensions\n * and read off its net power. With the unknown set to `DIMENSIONLESS` the\n * expression has dimension `D0`; set to `LENGTH` it has `D1`. The unknown enters\n * the dimension as a single power `p`, so `D1 / D0 = LENGTH^p`; if that quotient\n * is a clean power of the probe (only the `L` component nonzero), then from\n * `target = D0 · unknown^p` we get `unknown = (target / D0)^(1/p)`. Pure; reuses\n * the dimensional `algebra`.\n *\n * @module dimensional/dimension-inference\n */\n\nimport type { Dimension } from './types.js';\nimport { DIMENSIONLESS, LENGTH } from './types.js';\nimport { divide, power, EXPONENT_TOL } from './algebra.js';\nimport type { ExprNode } from './validator.js';\nimport { validate } from './validator.js';\n\nconst BASES: ReadonlyArray<keyof Dimension> = ['L', 'M', 'T', 'I', 'Theta', 'N', 'J'];\n\n/**\n * Rebuild `node`, replacing the dimension of every `symbol` named `name` with\n * `dim`. Walks the scalar arms (`symbol`/`op`/`transcendental`/`abs`); other\n * arms are returned unchanged (they do not occur in parsed scalar expressions).\n *\n * @public\n */\nexport function substituteSymbolDim(node: ExprNode, name: string, dim: Dimension): ExprNode {\n switch (node.kind) {\n case 'symbol':\n return node.name === name ? { ...node, dim } : node;\n case 'op':\n return { ...node, args: node.args.map((a) => substituteSymbolDim(a, name, dim)) };\n case 'transcendental':\n return { ...node, arg: substituteSymbolDim(node.arg, name, dim) };\n case 'abs':\n return { ...node, arg: substituteSymbolDim(node.arg, name, dim) };\n default:\n return node;\n }\n}\n\n/** Homogeneous dimension of `node`, or `null` if it is not well-formed. */\nfunction dimensionOrNull(node: ExprNode): Dimension | null {\n const r = validate(node);\n return r.ok && r.inferredDimension !== null ? r.inferredDimension : null;\n}\n\n/**\n * Infer the dimension of `unknown` in `expr` such that `expr` has dimension\n * `targetDim`, or `null` when it is not uniquely determined.\n *\n * @public\n */\nexport function inferUnknownDimension(\n expr: ExprNode,\n unknown: string,\n targetDim: Dimension,\n): Dimension | null {\n const d0 = dimensionOrNull(substituteSymbolDim(expr, unknown, DIMENSIONLESS));\n const d1 = dimensionOrNull(substituteSymbolDim(expr, unknown, LENGTH));\n if (d0 === null || d1 === null) return null;\n\n // D1 / D0 must be a clean power of the probe (LENGTH): only the L exponent.\n const quotient = divide(d1, d0);\n const p = quotient.L;\n if (p === 0) return null; // the unknown does not affect the dimension\n for (const base of BASES) {\n if (base !== 'L' && quotient[base] !== 0) return null; // not a clean power\n }\n const result = power(divide(targetDim, d0), 1 / p);\n // Snap each exponent to its nearest integer within tolerance, then abstain if\n // any is GENUINELY fractional (e.g. x^2 = [length] ⟹ [length]^½ is not a real\n // physical dimension). The tolerance absorbs FP round-off that arrives in the\n // target from a v0.20 fractional-power computation, so a real integer answer\n // (L = 2 + ε) is not spuriously rejected — consistent with `equals` (bb15432).\n const snapped = { ...result };\n for (const base of BASES) {\n const rounded = Math.round(result[base]);\n if (Math.abs(result[base] - rounded) > EXPONENT_TOL) return null;\n snapped[base] = rounded;\n }\n return snapped;\n}\n"]}
1
+ {"version":3,"file":"dimension-inference.js","sourceRoot":"","sources":["../../src/dimensional/dimension-inference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;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O,IAAI,CAAC;QACjE,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IAC1B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["/**\n * Single-unknown dimensional inference.\n *\n * Given a parsed scalar `ExprNode` (e.g. the RHS of a user equation) in which\n * exactly one symbol's dimension is unknown, and the known dimension the whole\n * expression must equal (the target), recover the unknown's dimension from\n * dimensional homogeneity — or abstain (`null`) when it is not uniquely pinned\n * (the unknown is sum-constrained, absent, or appears non-cleanly).\n *\n * Method (no symbolic differentiation): probe the unknown with two dimensions\n * and read off its net power. With the unknown set to `DIMENSIONLESS` the\n * expression has dimension `D0`; set to `LENGTH` it has `D1`. The unknown enters\n * the dimension as a single power `p`, so `D1 / D0 = LENGTH^p`; if that quotient\n * is a clean power of the probe (only the `L` component nonzero), then from\n * `target = D0 · unknown^p` we get `unknown = (target / D0)^(1/p)`. Pure; reuses\n * the dimensional `algebra`.\n *\n * @module dimensional/dimension-inference\n */\n\nimport type { Dimension } from './types.js';\nimport { DIMENSIONLESS, LENGTH } from './types.js';\nimport { BASES, divide, power, EXPONENT_TOL } from './algebra.js';\nimport type { ExprNode } from './validator.js';\nimport { validate } from './validator.js';\n\n/**\n * Rebuild `node`, replacing the dimension of every `symbol` named `name` with\n * `dim`. Walks the scalar arms (`symbol`/`op`/`transcendental`/`abs`); other\n * arms are returned unchanged (they do not occur in parsed scalar expressions).\n *\n * @public\n */\nexport function substituteSymbolDim(node: ExprNode, name: string, dim: Dimension): ExprNode {\n switch (node.kind) {\n case 'symbol':\n return node.name === name ? { ...node, dim } : node;\n case 'op':\n return { ...node, args: node.args.map((a) => substituteSymbolDim(a, name, dim)) };\n case 'transcendental':\n return { ...node, arg: substituteSymbolDim(node.arg, name, dim) };\n case 'abs':\n return { ...node, arg: substituteSymbolDim(node.arg, name, dim) };\n default:\n return node;\n }\n}\n\n/** Homogeneous dimension of `node`, or `null` if it is not well-formed. */\nfunction dimensionOrNull(node: ExprNode): Dimension | null {\n const r = validate(node);\n return r.ok && r.inferredDimension !== null ? r.inferredDimension : null;\n}\n\n/**\n * Infer the dimension of `unknown` in `expr` such that `expr` has dimension\n * `targetDim`, or `null` when it is not uniquely determined.\n *\n * @public\n */\nexport function inferUnknownDimension(\n expr: ExprNode,\n unknown: string,\n targetDim: Dimension,\n): Dimension | null {\n const d0 = dimensionOrNull(substituteSymbolDim(expr, unknown, DIMENSIONLESS));\n const d1 = dimensionOrNull(substituteSymbolDim(expr, unknown, LENGTH));\n if (d0 === null || d1 === null) return null;\n\n // D1 / D0 must be a clean power of the probe (LENGTH): only the L exponent.\n const quotient = divide(d1, d0);\n const p = quotient.L;\n if (p === 0) return null; // the unknown does not affect the dimension\n for (const base of BASES) {\n if (base !== 'L' && quotient[base] !== 0) return null; // not a clean power\n }\n const result = power(divide(targetDim, d0), 1 / p);\n // Snap each exponent to its nearest integer within tolerance, then abstain if\n // any is GENUINELY fractional (e.g. x^2 = [length] ⟹ [length]^½ is not a real\n // physical dimension). The tolerance absorbs FP round-off that arrives in the\n // target from a v0.20 fractional-power computation, so a real integer answer\n // (L = 2 + ε) is not spuriously rejected — consistent with `equals` (bb15432).\n const snapped = { ...result };\n for (const base of BASES) {\n const rounded = Math.round(result[base]);\n if (Math.abs(result[base] - rounded) > EXPONENT_TOL) return null;\n snapped[base] = rounded;\n }\n return snapped;\n}\n"]}
@@ -153,7 +153,7 @@ export declare class PartialDerivativeIndexVarianceError extends UPTError {
153
153
  * a dimensional → numerical import cycle; re-exported from numerical/index.ts
154
154
  * for the public API surface per v0.4.0-Implementation-Plan Task 13.
155
155
  *
156
- * Uses `Object.setPrototypeOf` for correct `instanceof` after ES5 transpilation.
156
+ * A plain `class extends Error` under the ES2022 target: `instanceof` holds without a prototype reset.
157
157
  *
158
158
  * @public
159
159
  */
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/dimensional/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA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 @@ export class UPTError extends Error {
11
11
  super(message, options);
12
12
  this.name = 'UPTError';
13
13
  // Restore prototype chain (needed for instanceof after ES5 transpilation).
14
- Object.setPrototypeOf(this, UPTError.prototype);
15
14
  }
16
15
  }
17
16
  /**
@@ -27,7 +26,6 @@ export class DimensionMismatchError extends UPTError {
27
26
  this.name = 'DimensionMismatchError';
28
27
  this.expected = expected;
29
28
  this.actual = actual;
30
- Object.setPrototypeOf(this, DimensionMismatchError.prototype);
31
29
  }
32
30
  }
33
31
  /**
@@ -50,7 +48,6 @@ export class DuplicateIndexLabelError extends UPTError {
50
48
  this.name = 'DuplicateIndexLabelError';
51
49
  this.tensorName = tensorName;
52
50
  this.label = label;
53
- Object.setPrototypeOf(this, DuplicateIndexLabelError.prototype);
54
51
  }
55
52
  }
56
53
  /**
@@ -78,7 +75,6 @@ export class IndexLabelCollisionError extends UPTError {
78
75
  this.label = label;
79
76
  this.totalCount = totalCount;
80
77
  this.sources = sources;
81
- Object.setPrototypeOf(this, IndexLabelCollisionError.prototype);
82
78
  }
83
79
  }
84
80
  /**
@@ -99,7 +95,6 @@ export class VarianceMismatchError extends UPTError {
99
95
  this.name = 'VarianceMismatchError';
100
96
  this.label = label;
101
97
  this.variance = variance;
102
- Object.setPrototypeOf(this, VarianceMismatchError.prototype);
103
98
  }
104
99
  }
105
100
  /**
@@ -115,7 +110,6 @@ export class TensorInScalarOpError extends UPTError {
115
110
  `non-empty freeIndices. Use 'tensor-product' for tensor multiplication.`);
116
111
  this.name = 'TensorInScalarOpError';
117
112
  this.op = op;
118
- Object.setPrototypeOf(this, TensorInScalarOpError.prototype);
119
113
  }
120
114
  }
121
115
  /**
@@ -128,7 +122,6 @@ export class FreeIndexMismatchError extends UPTError {
128
122
  constructor(message) {
129
123
  super(message);
130
124
  this.name = 'FreeIndexMismatchError';
131
- Object.setPrototypeOf(this, FreeIndexMismatchError.prototype);
132
125
  }
133
126
  }
134
127
  /**
@@ -142,7 +135,6 @@ export class TensorProductChildInferenceError extends UPTError {
142
135
  constructor(message) {
143
136
  super(message);
144
137
  this.name = 'TensorProductChildInferenceError';
145
- Object.setPrototypeOf(this, TensorProductChildInferenceError.prototype);
146
138
  }
147
139
  }
148
140
  /**
@@ -160,7 +152,6 @@ export class InvalidMetricRankError extends UPTError {
160
152
  this.name = 'InvalidMetricRankError';
161
153
  this.tensorName = tensorName;
162
154
  this.actualRank = actualRank;
163
- Object.setPrototypeOf(this, InvalidMetricRankError.prototype);
164
155
  }
165
156
  }
166
157
  /**
@@ -177,7 +168,6 @@ export class MetricSignatureError extends UPTError {
177
168
  this.name = 'MetricSignatureError';
178
169
  this.tensorName = tensorName;
179
170
  this.reason = reason;
180
- Object.setPrototypeOf(this, MetricSignatureError.prototype);
181
171
  }
182
172
  }
183
173
  /**
@@ -191,7 +181,6 @@ export class InvalidKroneckerRankError extends UPTError {
191
181
  `(exactly one upper + one lower index). Per Part-VIII §VIII.3.`);
192
182
  this.name = 'InvalidKroneckerRankError';
193
183
  this.actualRank = actualRank;
194
- Object.setPrototypeOf(this, InvalidKroneckerRankError.prototype);
195
184
  }
196
185
  }
197
186
  /**
@@ -207,7 +196,6 @@ export class KroneckerVarianceError extends UPTError {
207
196
  `Per Part-VIII §VIII.3.`);
208
197
  this.name = 'KroneckerVarianceError';
209
198
  this.bothVariance = bothVariance;
210
- Object.setPrototypeOf(this, KroneckerVarianceError.prototype);
211
199
  }
212
200
  }
213
201
  /**
@@ -224,7 +212,6 @@ export class PartialDerivativeIndexVarianceError extends UPTError {
224
212
  `be 'lower'. Per Part-VIII §VIII.4.`);
225
213
  this.name = 'PartialDerivativeIndexVarianceError';
226
214
  this.label = label;
227
- Object.setPrototypeOf(this, PartialDerivativeIndexVarianceError.prototype);
228
215
  }
229
216
  }
230
217
  /**
@@ -238,7 +225,7 @@ export class PartialDerivativeIndexVarianceError extends UPTError {
238
225
  * a dimensional → numerical import cycle; re-exported from numerical/index.ts
239
226
  * for the public API surface per v0.4.0-Implementation-Plan Task 13.
240
227
  *
241
- * Uses `Object.setPrototypeOf` for correct `instanceof` after ES5 transpilation.
228
+ * A plain `class extends Error` under the ES2022 target: `instanceof` holds without a prototype reset.
242
229
  *
243
230
  * @public
244
231
  */
@@ -248,7 +235,6 @@ export class DuplicateCoordinateWarning extends Error {
248
235
  `'${conflictingIndex}' of the operand; result will silently misbehave. ` +
249
236
  `Rename the operand's free index or pick a different wrt label.`);
250
237
  this.name = 'DuplicateCoordinateWarning';
251
- Object.setPrototypeOf(this, DuplicateCoordinateWarning.prototype);
252
238
  }
253
239
  }
254
240
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/dimensional/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,4CAA4C;AAC5C,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,YAAY,OAAe,EAAE,OAAsC;QACjE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,2EAA2E;QAC3E,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClD,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,sBAAuB,SAAQ,QAAQ;IAClC,QAAQ,CAAY;IACpB,MAAM,CAAY;IAClC,YAAY,OAAe,EAAE,QAAmB,EAAE,MAAiB;QACjE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,wBAAyB,SAAQ,QAAQ;IACpC,UAAU,CAAS;IACnB,KAA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,wBAAwB,CACzB,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,mCAAoC,SAAQ,QAAQ;IAC/C,KAAK,CAAS;IAC9B,YAAY,KAAa;QACvB,KAAK,CACH,6BAA6B,KAAK,8BAA8B;YAChE,iEAAiE;YACjE,oCAAoC,CACrC,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,qCAAqC,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mCAAmC,CAAC,SAAS,CAAC,CAAC;IAC7E,CAAC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD,YAAY,KAAa,EAAE,gBAAwB;QACjD,KAAK,CACH,6BAA6B,KAAK,sCAAsC;YACxE,IAAI,gBAAgB,oDAAoD;YACxE,gEAAgE,CACjE,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,0BAA0B,CAAC,SAAS,CAAC,CAAC;IACpE,CAAC;CACF","sourcesContent":["/**\n * UPT error hierarchy. All UPT-source errors subclass UPTError so\n * downstream consumers (mathjs, threejs, TensorJS) can discriminate\n * with `err instanceof UPTError`.\n *\n * @module dimensional/errors\n */\n\nimport { Dimension } from './types.js';\n\n/** Base class for all UPT-source errors. */\nexport class UPTError extends Error {\n constructor(message: string, options?: { readonly cause?: unknown }) {\n super(message, options);\n this.name = 'UPTError';\n // Restore prototype chain (needed for instanceof after ES5 transpilation).\n Object.setPrototypeOf(this, UPTError.prototype);\n }\n}\n\n/**\n * Thrown by add/sub and equation-level checks when dimensions disagree.\n * (Moved from src/dimensional/algebra.ts as part of the v0.2.0 UPTError\n * refactor. Behavior unchanged.)\n */\nexport class DimensionMismatchError extends UPTError {\n public readonly expected: Dimension;\n public readonly actual: Dimension;\n constructor(message: string, expected: Dimension, actual: Dimension) {\n super(message);\n this.name = 'DimensionMismatchError';\n this.expected = expected;\n this.actual = actual;\n Object.setPrototypeOf(this, DimensionMismatchError.prototype);\n }\n}\n\n/**\n * Thrown when a tensor-symbol's indices list contains the same label\n * more than once (e.g., T^μ_μ_μ). Per Part-VII §VII.4.\n *\n * NOTE: this error fires on DECLARATION-TIME duplicates within a single\n * tensor-symbol's indices list. Those indices are *free*, not \"dummy\"\n * (a dummy index in tensor calculus is one that is summed over). The\n * earlier name `RepeatedDummyLabelError` was a misnomer; that deprecated\n * alias was removed in v0.4.5.\n */\nexport class DuplicateIndexLabelError extends UPTError {\n public readonly tensorName: string;\n public readonly label: string;\n constructor(tensorName: string, label: string) {\n super(\n `Tensor '${tensorName}' has repeated index label '${label}'. ` +\n `A label may appear at most twice (once upper, once lower) within ` +\n `a single tensor-symbol's indices list.`,\n );\n this.name = 'DuplicateIndexLabelError';\n this.tensorName = tensorName;\n this.label = label;\n Object.setPrototypeOf(this, DuplicateIndexLabelError.prototype);\n }\n}\n\n/**\n * Thrown when an index label appears more than twice across a\n * tensor-product's operands. Einstein contraction requires exactly two\n * occurrences (one upper + one lower) per dummy label. Per Part-VII §VII.4.\n */\nexport class IndexLabelCollisionError extends UPTError {\n public readonly label: string;\n public readonly totalCount: number;\n /**\n * Tensor names that contributed occurrences of the colliding label,\n * if the caller has them available. May be undefined for callers that\n * don't track per-operand provenance.\n */\n public readonly sources?: ReadonlyArray<string>;\n constructor(\n label: string,\n totalCount: number,\n sources?: ReadonlyArray<string>,\n ) {\n const sourceClause =\n sources && sources.length > 0\n ? ` (sources: ${sources.join(', ')})`\n : '';\n super(\n `Index label '${label}' appears ${totalCount} times across the ` +\n `tensor-product operands${sourceClause} (max allowed: 2 for Einstein ` +\n `contraction). Rename one of the offending indices.`,\n );\n this.name = 'IndexLabelCollisionError';\n this.label = label;\n this.totalCount = totalCount;\n this.sources = sources;\n Object.setPrototypeOf(this, IndexLabelCollisionError.prototype);\n }\n}\n\n/**\n * Thrown when an index label appears twice in a tensor-product but both\n * occurrences share the same variance (both upper or both lower). v0.2.0\n * has no metric tensor available to raise/lower indices, so such a\n * contraction is rejected at validation time. Per Part-VII §VII.4.\n */\nexport class VarianceMismatchError extends UPTError {\n public readonly label: string;\n public readonly variance: 'upper' | 'lower';\n constructor(label: string, variance: 'upper' | 'lower') {\n super(\n `Index label '${label}' appears twice but both with variance '${variance}'. ` +\n `Einstein contraction requires one upper and one lower. ` +\n `If this is intentional, use raise(operand, gInverse, '${label}') or ` +\n `lower(operand, g, '${label}') to traverse variance via the metric ` +\n `before contracting.`,\n );\n this.name = 'VarianceMismatchError';\n this.label = label;\n this.variance = variance;\n Object.setPrototypeOf(this, VarianceMismatchError.prototype);\n }\n}\n\n/**\n * Thrown by `op '*'` / `'/'` / `'^'` when an operand carries non-empty\n * freeIndices. Scalar operators in v0.2.0 are strict: any tensor-valued\n * operand must instead pass through `tensor-product`. Per Part-VII §VII.5\n * (op-tensor boundary rules).\n */\nexport class TensorInScalarOpError extends UPTError {\n public readonly op: string;\n constructor(op: string) {\n super(\n `Operator '${op}' is scalar-only; received a tensor argument with ` +\n `non-empty freeIndices. Use 'tensor-product' for tensor multiplication.`,\n );\n this.name = 'TensorInScalarOpError';\n this.op = op;\n Object.setPrototypeOf(this, TensorInScalarOpError.prototype);\n }\n}\n\n/**\n * Thrown by `op '+'` / `'-'` when the operand freeIndices maps differ.\n * Addition / subtraction across tensors requires identical free-index\n * signatures (same labels, same per-label upper/lower counts). Per\n * Part-VII §VII.5.\n */\nexport class FreeIndexMismatchError extends UPTError {\n constructor(message: string) {\n super(message);\n this.name = 'FreeIndexMismatchError';\n Object.setPrototypeOf(this, FreeIndexMismatchError.prototype);\n }\n}\n\n/**\n * Thrown by the validator's tensor-product child resolver when a non-tensor\n * operand to a `tensor-product` fails dimension inference. Subclassing\n * UPTError (rather than throwing a plain `Error`) preserves the §14.7\n * forward-compat invariant that downstream consumers can discriminate\n * UPT-source errors with `err instanceof UPTError`.\n */\nexport class TensorProductChildInferenceError extends UPTError {\n constructor(message: string) {\n super(message);\n this.name = 'TensorProductChildInferenceError';\n Object.setPrototypeOf(this, TensorProductChildInferenceError.prototype);\n }\n}\n\n/**\n * Thrown when a `metric-tensor` node has rank other than 2. Per\n * Part-VIII §VIII.2 (metric-tensor-rank-2-only TENSOR-RULE). The metric\n * is fundamentally a rank-2 object in v0.3.0; higher-rank generalizations\n * are out of scope.\n */\nexport class InvalidMetricRankError extends UPTError {\n public readonly tensorName: string;\n public readonly actualRank: number;\n constructor(tensorName: string, actualRank: number) {\n super(\n `Metric tensor '${tensorName}' has rank ${actualRank}, but a ` +\n `metric must be rank-2 (exactly two indices). Per Part-VIII §VIII.2.`,\n );\n this.name = 'InvalidMetricRankError';\n this.tensorName = tensorName;\n this.actualRank = actualRank;\n Object.setPrototypeOf(this, InvalidMetricRankError.prototype);\n }\n}\n\n/**\n * Thrown when a `metric-tensor` has mixed-variance indices, an empty\n * signature, an invalid signature string, or other structural problem\n * orthogonal to rank. Per Part-VIII §VIII.2 and §VIII.5 (raise/lower\n * variance requirements).\n */\nexport class MetricSignatureError extends UPTError {\n public readonly tensorName: string;\n public readonly reason: string;\n constructor(tensorName: string, reason: string) {\n super(\n `Metric tensor '${tensorName}': ${reason}. Per Part-VIII §VIII.2.`,\n );\n this.name = 'MetricSignatureError';\n this.tensorName = tensorName;\n this.reason = reason;\n Object.setPrototypeOf(this, MetricSignatureError.prototype);\n }\n}\n\n/**\n * Thrown when a `kronecker-delta` node has rank other than 2.\n * Per Part-VIII §VIII.3.\n */\nexport class InvalidKroneckerRankError extends UPTError {\n public readonly actualRank: number;\n constructor(actualRank: number) {\n super(\n `Kronecker delta has rank ${actualRank}, but must be rank-2 ` +\n `(exactly one upper + one lower index). Per Part-VIII §VIII.3.`,\n );\n this.name = 'InvalidKroneckerRankError';\n this.actualRank = actualRank;\n Object.setPrototypeOf(this, InvalidKroneckerRankError.prototype);\n }\n}\n\n/**\n * Thrown when a `kronecker-delta`'s two indices share the same variance\n * (both upper or both lower). Per Part-VIII §VIII.3, the canonical\n * δ^μ_ν requires mixed variance.\n */\nexport class KroneckerVarianceError extends UPTError {\n public readonly bothVariance: 'upper' | 'lower';\n constructor(bothVariance: 'upper' | 'lower') {\n super(\n `Kronecker delta indices both have variance '${bothVariance}'; ` +\n `must be one upper + one lower (canonical δ^μ_ν form). ` +\n `Per Part-VIII §VIII.3.`,\n );\n this.name = 'KroneckerVarianceError';\n this.bothVariance = bothVariance;\n Object.setPrototypeOf(this, KroneckerVarianceError.prototype);\n }\n}\n\n/**\n * Thrown when a `tensor-partial-derivative` node's `wrtIndex.variance`\n * is `'upper'`. The differentiation operator ∂/∂x^μ is fundamentally\n * covariant (lower) regardless of the variance of the coordinate. Per\n * Part-VIII §VIII.4 (pderiv-wrtIndex-always-lower TENSOR-RULE).\n */\nexport class PartialDerivativeIndexVarianceError extends UPTError {\n public readonly label: string;\n constructor(label: string) {\n super(\n `Partial-derivative index '${label}' has variance 'upper', but ` +\n `∂_μ is fundamentally covariant — wrtIndex.variance must always ` +\n `be 'lower'. Per Part-VIII §VIII.4.`,\n );\n this.name = 'PartialDerivativeIndexVarianceError';\n this.label = label;\n Object.setPrototypeOf(this, PartialDerivativeIndexVarianceError.prototype);\n }\n}\n\n/**\n * Emitted (not thrown) via `process.emitWarning` when a covariant-derivative's\n * `wrt` coordinate label collides with an existing free index of the operand\n * and the env var `UPT_ALLOW_COORD_SHADOW=1` has opted in to downgraded\n * handling. By default the collision throws `MetricSignatureError` (soundness\n * over friendliness — silent wrong results are the worst failure mode).\n *\n * Lives here (dimensional/errors.ts) rather than numerical/index.ts to avoid\n * a dimensional → numerical import cycle; re-exported from numerical/index.ts\n * for the public API surface per v0.4.0-Implementation-Plan Task 13.\n *\n * Uses `Object.setPrototypeOf` for correct `instanceof` after ES5 transpilation.\n *\n * @public\n */\nexport class DuplicateCoordinateWarning extends Error {\n constructor(coord: string, conflictingIndex: string) {\n super(\n `Covariant-derivative wrt='${coord}' collides with existing free index ` +\n `'${conflictingIndex}' of the operand; result will silently misbehave. ` +\n `Rename the operand's free index or pick a different wrt label.`,\n );\n this.name = 'DuplicateCoordinateWarning';\n Object.setPrototypeOf(this, DuplicateCoordinateWarning.prototype);\n }\n}\n"]}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/dimensional/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,4CAA4C;AAC5C,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,YAAY,OAAe,EAAE,OAAsC;QACjE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,2EAA2E;IAC7E,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,sBAAuB,SAAQ,QAAQ;IAClC,QAAQ,CAAY;IACpB,MAAM,CAAY;IAClC,YAAY,OAAe,EAAE,QAAmB,EAAE,MAAiB;QACjE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,wBAAyB,SAAQ,QAAQ;IACpC,UAAU,CAAS;IACnB,KAAK,CAAS;IAC9B,YAAY,UAAkB,EAAE,KAAa;QAC3C,KAAK,CACH,WAAW,UAAU,+BAA+B,KAAK,KAAK;YAC9D,mEAAmE;YACnE,wCAAwC,CACzC,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CA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IACnC,YAAY,UAAkB;QAC5B,KAAK,CACH,4BAA4B,UAAU,uBAAuB;YAC7D,+DAA+D,CAChE,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,sBAAuB,SAAQ,QAAQ;IAClC,YAAY,CAAoB;IAChD,YAAY,YAA+B;QACzC,KAAK,CACH,+CAA+C,YAAY,KAAK;YAChE,wDAAwD;YACxD,wBAAwB,CACzB,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,mCAAoC,SAAQ,QAAQ;IAC/C,KAAK,CAAS;IAC9B,YAAY,KAAa;QACvB,KAAK,CACH,6BAA6B,KAAK,8BAA8B;YAChE,iEAAiE;YACjE,oCAAoC,CACrC,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,qCAAqC,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD,YAAY,KAAa,EAAE,gBAAwB;QACjD,KAAK,CACH,6BAA6B,KAAK,sCAAsC;YACxE,IAAI,gBAAgB,oDAAoD;YACxE,gEAAgE,CACjE,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;IAC3C,CAAC;CACF","sourcesContent":["/**\n * UPT error hierarchy. All UPT-source errors subclass UPTError so\n * downstream consumers (mathjs, threejs, TensorJS) can discriminate\n * with `err instanceof UPTError`.\n *\n * @module dimensional/errors\n */\n\nimport { Dimension } from './types.js';\n\n/** Base class for all UPT-source errors. */\nexport class UPTError extends Error {\n constructor(message: string, options?: { readonly cause?: unknown }) {\n super(message, options);\n this.name = 'UPTError';\n // Restore prototype chain (needed for instanceof after ES5 transpilation).\n }\n}\n\n/**\n * Thrown by add/sub and equation-level checks when dimensions disagree.\n * (Moved from src/dimensional/algebra.ts as part of the v0.2.0 UPTError\n * refactor. Behavior unchanged.)\n */\nexport class DimensionMismatchError extends UPTError {\n public readonly expected: Dimension;\n public readonly actual: Dimension;\n constructor(message: string, expected: Dimension, actual: Dimension) {\n super(message);\n this.name = 'DimensionMismatchError';\n this.expected = expected;\n this.actual = actual;\n }\n}\n\n/**\n * Thrown when a tensor-symbol's indices list contains the same label\n * more than once (e.g., T^μ_μ_μ). Per Part-VII §VII.4.\n *\n * NOTE: this error fires on DECLARATION-TIME duplicates within a single\n * tensor-symbol's indices list. Those indices are *free*, not \"dummy\"\n * (a dummy index in tensor calculus is one that is summed over). The\n * earlier name `RepeatedDummyLabelError` was a misnomer; that deprecated\n * alias was removed in v0.4.5.\n */\nexport class DuplicateIndexLabelError extends UPTError {\n public readonly tensorName: string;\n public readonly label: string;\n constructor(tensorName: string, label: string) {\n super(\n `Tensor '${tensorName}' has repeated index label '${label}'. ` +\n `A label may appear at most twice (once upper, once lower) within ` +\n `a single tensor-symbol's indices list.`,\n );\n this.name = 'DuplicateIndexLabelError';\n this.tensorName = tensorName;\n this.label = label;\n }\n}\n\n/**\n * Thrown when an index label appears more than twice across a\n * tensor-product's operands. Einstein contraction requires exactly two\n * occurrences (one upper + one lower) per dummy label. Per Part-VII §VII.4.\n */\nexport class IndexLabelCollisionError extends UPTError {\n public readonly label: string;\n public readonly totalCount: number;\n /**\n * Tensor names that contributed occurrences of the colliding label,\n * if the caller has them available. May be undefined for callers that\n * don't track per-operand provenance.\n */\n public readonly sources?: ReadonlyArray<string>;\n constructor(\n label: string,\n totalCount: number,\n sources?: ReadonlyArray<string>,\n ) {\n const sourceClause =\n sources && sources.length > 0\n ? ` (sources: ${sources.join(', ')})`\n : '';\n super(\n `Index label '${label}' appears ${totalCount} times across the ` +\n `tensor-product operands${sourceClause} (max allowed: 2 for Einstein ` +\n `contraction). Rename one of the offending indices.`,\n );\n this.name = 'IndexLabelCollisionError';\n this.label = label;\n this.totalCount = totalCount;\n this.sources = sources;\n }\n}\n\n/**\n * Thrown when an index label appears twice in a tensor-product but both\n * occurrences share the same variance (both upper or both lower). v0.2.0\n * has no metric tensor available to raise/lower indices, so such a\n * contraction is rejected at validation time. Per Part-VII §VII.4.\n */\nexport class VarianceMismatchError extends UPTError {\n public readonly label: string;\n public readonly variance: 'upper' | 'lower';\n constructor(label: string, variance: 'upper' | 'lower') {\n super(\n `Index label '${label}' appears twice but both with variance '${variance}'. ` +\n `Einstein contraction requires one upper and one lower. ` +\n `If this is intentional, use raise(operand, gInverse, '${label}') or ` +\n `lower(operand, g, '${label}') to traverse variance via the metric ` +\n `before contracting.`,\n );\n this.name = 'VarianceMismatchError';\n this.label = label;\n this.variance = variance;\n }\n}\n\n/**\n * Thrown by `op '*'` / `'/'` / `'^'` when an operand carries non-empty\n * freeIndices. Scalar operators in v0.2.0 are strict: any tensor-valued\n * operand must instead pass through `tensor-product`. Per Part-VII §VII.5\n * (op-tensor boundary rules).\n */\nexport class TensorInScalarOpError extends UPTError {\n public readonly op: string;\n constructor(op: string) {\n super(\n `Operator '${op}' is scalar-only; received a tensor argument with ` +\n `non-empty freeIndices. Use 'tensor-product' for tensor multiplication.`,\n );\n this.name = 'TensorInScalarOpError';\n this.op = op;\n }\n}\n\n/**\n * Thrown by `op '+'` / `'-'` when the operand freeIndices maps differ.\n * Addition / subtraction across tensors requires identical free-index\n * signatures (same labels, same per-label upper/lower counts). Per\n * Part-VII §VII.5.\n */\nexport class FreeIndexMismatchError extends UPTError {\n constructor(message: string) {\n super(message);\n this.name = 'FreeIndexMismatchError';\n }\n}\n\n/**\n * Thrown by the validator's tensor-product child resolver when a non-tensor\n * operand to a `tensor-product` fails dimension inference. Subclassing\n * UPTError (rather than throwing a plain `Error`) preserves the §14.7\n * forward-compat invariant that downstream consumers can discriminate\n * UPT-source errors with `err instanceof UPTError`.\n */\nexport class TensorProductChildInferenceError extends UPTError {\n constructor(message: string) {\n super(message);\n this.name = 'TensorProductChildInferenceError';\n }\n}\n\n/**\n * Thrown when a `metric-tensor` node has rank other than 2. Per\n * Part-VIII §VIII.2 (metric-tensor-rank-2-only TENSOR-RULE). The metric\n * is fundamentally a rank-2 object in v0.3.0; higher-rank generalizations\n * are out of scope.\n */\nexport class InvalidMetricRankError extends UPTError {\n public readonly tensorName: string;\n public readonly actualRank: number;\n constructor(tensorName: string, actualRank: number) {\n super(\n `Metric tensor '${tensorName}' has rank ${actualRank}, but a ` +\n `metric must be rank-2 (exactly two indices). Per Part-VIII §VIII.2.`,\n );\n this.name = 'InvalidMetricRankError';\n this.tensorName = tensorName;\n this.actualRank = actualRank;\n }\n}\n\n/**\n * Thrown when a `metric-tensor` has mixed-variance indices, an empty\n * signature, an invalid signature string, or other structural problem\n * orthogonal to rank. Per Part-VIII §VIII.2 and §VIII.5 (raise/lower\n * variance requirements).\n */\nexport class MetricSignatureError extends UPTError {\n public readonly tensorName: string;\n public readonly reason: string;\n constructor(tensorName: string, reason: string) {\n super(\n `Metric tensor '${tensorName}': ${reason}. Per Part-VIII §VIII.2.`,\n );\n this.name = 'MetricSignatureError';\n this.tensorName = tensorName;\n this.reason = reason;\n }\n}\n\n/**\n * Thrown when a `kronecker-delta` node has rank other than 2.\n * Per Part-VIII §VIII.3.\n */\nexport class InvalidKroneckerRankError extends UPTError {\n public readonly actualRank: number;\n constructor(actualRank: number) {\n super(\n `Kronecker delta has rank ${actualRank}, but must be rank-2 ` +\n `(exactly one upper + one lower index). Per Part-VIII §VIII.3.`,\n );\n this.name = 'InvalidKroneckerRankError';\n this.actualRank = actualRank;\n }\n}\n\n/**\n * Thrown when a `kronecker-delta`'s two indices share the same variance\n * (both upper or both lower). Per Part-VIII §VIII.3, the canonical\n * δ^μ_ν requires mixed variance.\n */\nexport class KroneckerVarianceError extends UPTError {\n public readonly bothVariance: 'upper' | 'lower';\n constructor(bothVariance: 'upper' | 'lower') {\n super(\n `Kronecker delta indices both have variance '${bothVariance}'; ` +\n `must be one upper + one lower (canonical δ^μ_ν form). ` +\n `Per Part-VIII §VIII.3.`,\n );\n this.name = 'KroneckerVarianceError';\n this.bothVariance = bothVariance;\n }\n}\n\n/**\n * Thrown when a `tensor-partial-derivative` node's `wrtIndex.variance`\n * is `'upper'`. The differentiation operator ∂/∂x^μ is fundamentally\n * covariant (lower) regardless of the variance of the coordinate. Per\n * Part-VIII §VIII.4 (pderiv-wrtIndex-always-lower TENSOR-RULE).\n */\nexport class PartialDerivativeIndexVarianceError extends UPTError {\n public readonly label: string;\n constructor(label: string) {\n super(\n `Partial-derivative index '${label}' has variance 'upper', but ` +\n `∂_μ is fundamentally covariant — wrtIndex.variance must always ` +\n `be 'lower'. Per Part-VIII §VIII.4.`,\n );\n this.name = 'PartialDerivativeIndexVarianceError';\n this.label = label;\n }\n}\n\n/**\n * Emitted (not thrown) via `process.emitWarning` when a covariant-derivative's\n * `wrt` coordinate label collides with an existing free index of the operand\n * and the env var `UPT_ALLOW_COORD_SHADOW=1` has opted in to downgraded\n * handling. By default the collision throws `MetricSignatureError` (soundness\n * over friendliness — silent wrong results are the worst failure mode).\n *\n * Lives here (dimensional/errors.ts) rather than numerical/index.ts to avoid\n * a dimensional → numerical import cycle; re-exported from numerical/index.ts\n * for the public API surface per v0.4.0-Implementation-Plan Task 13.\n *\n * A plain `class extends Error` under the ES2022 target: `instanceof` holds without a prototype reset.\n *\n * @public\n */\nexport class DuplicateCoordinateWarning extends Error {\n constructor(coord: string, conflictingIndex: string) {\n super(\n `Covariant-derivative wrt='${coord}' collides with existing free index ` +\n `'${conflictingIndex}' of the operand; result will silently misbehave. ` +\n `Rename the operand's free index or pick a different wrt label.`,\n );\n this.name = 'DuplicateCoordinateWarning';\n }\n}\n"]}
@@ -1,20 +1,3 @@
1
- /**
2
- * Exact unit scales.
3
- *
4
- * A unit's scale to SI is a rational number times one floating factor that
5
- * holds its irrational part (π for an angle, ln 2 for a bit). Prefixes,
6
- * products, quotients and integer powers multiply the rationals exactly, so
7
- * `g/cm^3` is 1000 and `72 mN/m` is 0.072 with no float noise to round away.
8
- * The one rounding is {@link scaleToNumber}, which rounds the rational
9
- * correctly and then multiplies by the irrational factor once.
10
- *
11
- * A decimal literal is read digit for digit. A JavaScript number is read
12
- * through its shortest round-trip decimal (`String(x)`), which is the
13
- * literal a constant was written with.
14
- *
15
- * @module dimensional/exact-scale
16
- * @internal
17
- */
18
1
  /** `num / den × irrational`, with `den > 0` and the fraction in lowest terms. @internal */
19
2
  export interface ExactScale {
20
3
  readonly num: bigint;
@@ -1 +1 @@
1
- {"version":3,"file":"exact-scale.d.ts","sourceRoot":"","sources":["../../src/dimensional/exact-scale.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,2FAA2F;AAC3F,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAmBD,6BAA6B;AAC7B,eAAO,MAAM,UAAU,EAAE,UAAgD,CAAC;AAI1E;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAW5D;AAED,2EAA2E;AAC3E,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAG7C;AAED,sCAAsC;AACtC,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAEjF;AAED,gEAAgE;AAChE,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAGrD;AAED,6BAA6B;AAC7B,wBAAgB,cAAc,CAAC,GAAG,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,UAAU,CAU5E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,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAEjF;AAED,gEAAgE;AAChE,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAGrD;AAED,6BAA6B;AAC7B,wBAAgB,cAAc,CAAC,GAAG,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,UAAU,CAU5E;AAED,yBAAyB;AACzB,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,UAAU,CAGrE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,CAO/D;AAED,+FAA+F;AAC/F,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,UAAU,CAGlE;AAwDD,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAGnD;AAID;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CASvG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,GAAG,UAAU,CAiB/G"}
@@ -15,12 +15,12 @@
15
15
  * @module dimensional/exact-scale
16
16
  * @internal
17
17
  */
18
- function gcd(a, b) {
19
- let x = a < 0n ? -a : a;
20
- let y = b < 0n ? -b : b;
21
- while (y !== 0n)
22
- [x, y] = [y, x % y];
23
- return x;
18
+ import { gcd } from '@danielsimonjr/mathts-functions';
19
+ import { bigintFrom } from '../core/mathts-read.js';
20
+ /** The bigint gcd, MathTS `gcd` on its `bigint, bigint` signature, read back as the bigint it is. */
21
+ function bigGcd(a, b) {
22
+ const g = bigintFrom('gcd', gcd(a, b));
23
+ return g < 0n ? -g : g;
24
24
  }
25
25
  function make(num, den, irrational) {
26
26
  if (den === 0n)
@@ -29,7 +29,7 @@ function make(num, den, irrational) {
29
29
  num = -num;
30
30
  den = -den;
31
31
  }
32
- const g = gcd(num, den);
32
+ const g = bigGcd(num, den);
33
33
  return g > 1n ? { num: num / g, den: den / g, irrational } : { num, den, irrational };
34
34
  }
35
35
  /** The scale 1. @internal */
@@ -141,7 +141,7 @@ function rationalToNumber(num, den) {
141
141
  if (num === 0n)
142
142
  return 0;
143
143
  const negative = num < 0n;
144
- const g = gcd(num, den);
144
+ const g = bigGcd(num, den);
145
145
  const a = (negative ? -num : num) / g;
146
146
  den /= g;
147
147
  const places = terminatingPlaces(den);
@@ -1 +1 @@
1
- {"version":3,"file":"exact-scale.js","sourceRoot":"","sources":["../../src/dimensional/exact-scale.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH,SAAS,GAAG,CAAC,CAAS,EAAE,CAAS;IAC/B,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxB,OAAO,CAAC,KAAK,EAAE;QAAE,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,IAAI,CAAC,GAAW,EAAE,GAAW,EAAE,UAAkB;IACxD,IAAI,GAAG,KAAK,EAAE;QAAE,MAAM,IAAI,UAAU,CAAC,+BAA+B,CAAC,CAAC;IACtE,IAAI,GAAG,G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,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;YACjD,IAAI,IAAI,KAAK,SAAS;gBAAE,MAAM,IAAI,UAAU,CAAC,iBAAiB,IAAI,YAAY,IAAI,+BAA+B,CAAC,CAAC;YACnH,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5F,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACzD,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC/E,CAAC","sourcesContent":["/**\n * Exact unit scales.\n *\n * A unit's scale to SI is a rational number times one floating factor that\n * holds its irrational part (π for an angle, ln 2 for a bit). Prefixes,\n * products, quotients and integer powers multiply the rationals exactly, so\n * `g/cm^3` is 1000 and `72 mN/m` is 0.072 with no float noise to round away.\n * The one rounding is {@link scaleToNumber}, which rounds the rational\n * correctly and then multiplies by the irrational factor once.\n *\n * A decimal literal is read digit for digit. A JavaScript number is read\n * through its shortest round-trip decimal (`String(x)`), which is the\n * literal a constant was written with.\n *\n * @module dimensional/exact-scale\n * @internal\n */\n\n/** `num / den × irrational`, with `den > 0` and the fraction in lowest terms. @internal */\nexport interface ExactScale {\n readonly num: bigint;\n readonly den: bigint;\n /** The factor no rational states (π, ln 2). 1 for a rational scale. */\n readonly irrational: number;\n}\n\nfunction gcd(a: bigint, b: bigint): bigint {\n let x = a < 0n ? -a : a;\n let y = b < 0n ? -b : b;\n while (y !== 0n) [x, y] = [y, x % y];\n return x;\n}\n\nfunction make(num: bigint, den: bigint, irrational: number): ExactScale {\n if (den === 0n) throw new RangeError('exact scale: zero denominator');\n if (den < 0n) {\n num = -num;\n den = -den;\n }\n const g = gcd(num, den);\n return g > 1n ? { num: num / g, den: den / g, irrational } : { num, den, irrational };\n}\n\n/** The scale 1. @internal */\nexport const UNIT_SCALE: ExactScale = { num: 1n, den: 1n, irrational: 1 };\n\nconst DECIMAL = /^([+-]?)(\\d*)(?:\\.(\\d*))?(?:[eE]([+-]?\\d+))?$/;\n\n/**\n * The exact value of a decimal literal (`72`, `0.45359237`, `1.602176634e-19`),\n * or null when `text` is not one.\n * @internal\n */\nexport function decimalScale(text: string): ExactScale | null {\n const m = DECIMAL.exec(text.trim());\n if (m === null) return null;\n const whole = m[2] ?? '';\n const fraction = m[3] ?? '';\n if (whole === '' && fraction === '') return null;\n const exponent = Number(m[4] ?? '0') - fraction.length;\n if (!Number.isSafeInteger(exponent) || Math.abs(exponent) > 10_000) return null;\n let num = BigInt(whole + fraction);\n if (m[1] === '-') num = -num;\n return exponent >= 0 ? make(num * 10n ** BigInt(exponent), 1n, 1) : make(num, 10n ** BigInt(-exponent), 1);\n}\n\n/** The exact scale a finite JavaScript number was written as. @internal */\nexport function scaleOf(x: number): ExactScale {\n if (!Number.isFinite(x)) throw new RangeError(`exact scale: ${x} is not finite`);\n return decimalScale(String(x))!;\n}\n\n/** `num / den`, exactly. @internal */\nexport function ratioScale(num: number | bigint, den: number | bigint): ExactScale {\n return make(BigInt(num), BigInt(den), 1);\n}\n\n/** A factor no rational states, such as π or ln 2. @internal */\nexport function irrationalScale(x: number): ExactScale {\n if (!Number.isFinite(x)) throw new RangeError(`exact scale: ${x} is not finite`);\n return { num: 1n, den: 1n, irrational: x };\n}\n\n/** `a × b × …`. @internal */\nexport function multiplyScales(...factors: readonly ExactScale[]): ExactScale {\n let num = 1n;\n let den = 1n;\n let irrational = 1;\n for (const f of factors) {\n num *= f.num;\n den *= f.den;\n irrational *= f.irrational;\n }\n return make(num, den, irrational);\n}\n\n/** `a / b`. @internal */\nexport function divideScales(a: ExactScale, b: ExactScale): ExactScale {\n if (b.num === 0n) throw new RangeError('exact scale: division by zero');\n return make(a.num * b.den, a.den * b.num, a.irrational / b.irrational);\n}\n\n/**\n * `a ^ n`. An integer power stays exact. A fractional power has no exact\n * rational in general, so it becomes one floating factor.\n * @internal\n */\nexport function powerScale(a: ExactScale, n: number): ExactScale {\n if (Number.isInteger(n)) {\n const k = BigInt(Math.abs(n));\n const up = make(a.num ** k, a.den ** k, a.irrational ** Math.abs(n));\n return n >= 0 ? up : divideScales(UNIT_SCALE, up);\n }\n return irrationalScale(scaleToNumber(a) ** n);\n}\n\n/** `a + b`: exact when both are rational multiples of the same irrational factor. @internal */\nexport function addScales(a: ExactScale, b: ExactScale): ExactScale {\n if (a.irrational === b.irrational) return make(a.num * b.den + b.num * a.den, a.den * b.den, a.irrational);\n return irrationalScale(scaleToNumber(a) + scaleToNumber(b));\n}\n\n/** The fewest significant digits kept before the sticky digit; far beyond a double's 17. */\nconst MIN_DIGITS = 40;\n\n/** Decimal places of `1 / den` when it terminates (`den` = 2^a·5^b): max(a, b). Null otherwise. */\nfunction terminatingPlaces(den: bigint): number | null {\n let d = den;\n let twos = 0;\n let fives = 0;\n while (d % 2n === 0n) {\n d /= 2n;\n twos++;\n }\n while (d % 5n === 0n) {\n d /= 5n;\n fives++;\n }\n return d === 1n ? Math.max(twos, fives) : null;\n}\n\n/**\n * The rational `num / den` (`den > 0`), reduced, rounded once to the nearest double.\n *\n * A terminating quotient (`den` = 2^a·5^b) is written out exactly, every digit,\n * and parsed: a tie between two doubles is a dyadic rational, so it always\n * lands here and rounds half to even. Any other quotient is not a tie, and it\n * is at least `1 / (den·2^54)` of its magnitude away from every tie; truncating\n * it to `max(40, digits(den) + 20)` significant digits stays closer than that,\n * and a sticky `1` puts the string strictly inside the truncation interval, so\n * the string rounds the way the quotient does for any denominator.\n */\nfunction rationalToNumber(num: bigint, den: bigint): number {\n if (num === 0n) return 0;\n const negative = num < 0n;\n const g = gcd(num, den);\n const a = (negative ? -num : num) / g;\n den /= g;\n const places = terminatingPlaces(den);\n if (places !== null) {\n const value = Number(`${(a * 10n ** BigInt(places)) / den}e-${places}`);\n return negative ? -value : value;\n }\n const digits = Math.max(MIN_DIGITS, den.toString().length + 20);\n const shift = digits - (a.toString().length - den.toString().length);\n let q: bigint;\n if (shift >= 0) {\n q = (a * 10n ** BigInt(shift)) / den;\n } else {\n q = a / (den * 10n ** BigInt(-shift));\n }\n // Not terminating, so the remainder is never zero: the sticky digit is always due.\n const value = Number(`${q.toString()}1e${-(shift + 1)}`);\n return negative ? -value : value;\n}\n\n/** The scale as a double: the rational rounded once, times the irrational factor. @internal */\nexport function scaleToNumber(s: ExactScale): number {\n const rational = rationalToNumber(s.num, s.den);\n return s.irrational === 1 ? rational : rational * s.irrational;\n}\n\nconst FACTOR = /^([^*/^\\s]+)(?:\\^([+-]?\\d+))?$/;\n\n/**\n * The two sides of a unit text or a scale expression under the single-solidus\n * convention of ISO 80000-1: everything after the first `/` is the\n * denominator, so a chain is one denominator (`km/s/Mpc` is km/(s·Mpc), and\n * `W/m*K` is W/(m·K), not (W/m)·K). The denominator comes back as one\n * `*`-joined product, each `/`-part's outer parentheses dropped. `units.ts`\n * and {@link readScaleExpression} both split here, so a unit text and a scale\n * expression in `data/units.json` read a `/` the same way.\n * @internal\n */\nexport function solidusSides(text: string): { readonly numerator: string; readonly denominator: string } {\n const parts = text.split('/');\n return {\n numerator: parts[0]!,\n denominator: parts\n .slice(1)\n .map((part) => part.replace(/^\\((.*)\\)$/, '$1'))\n .join('*'),\n };\n}\n\n/**\n * The exact value of a scale expression, the form `data/units.json` stores:\n * factors joined by `*`, then optionally `/` and the denominator's factors,\n * each a decimal literal or a name with an optional integer power\n * (`4.1868*453.59237/1.8`, `pi/180`, `lbf/inch^2`). A `/` follows the unit\n * grammar ({@link solidusSides}): `a/b*c` is a/(b·c). `resolve` gives a name\n * its scale and returns undefined for a name it does not know, which throws\n * here. A decimal literal is read digit for digit, so the result is the\n * rational the text states.\n * @internal\n */\nexport function readScaleExpression(text: string, resolve: (name: string) => ExactScale | undefined): ExactScale {\n const product = (side: string): ExactScale => {\n let scale = UNIT_SCALE;\n for (const part of side.split('*')) {\n const m = FACTOR.exec(part);\n if (m === null) throw new RangeError(`exact scale: '${text}' is not a product of factors`);\n const atom = m[1]!;\n const base = decimalScale(atom) ?? resolve(atom);\n if (base === undefined) throw new RangeError(`exact scale: '${text}' names '${atom}', which is not a known scale`);\n scale = multiplyScales(scale, m[2] === undefined ? base : powerScale(base, Number(m[2])));\n }\n return scale;\n };\n const trimmed = text.trim();\n const { numerator, denominator } = solidusSides(trimmed);\n const top = product(numerator);\n return trimmed.includes('/') ? divideScales(top, product(denominator)) : top;\n}\n"]}
1
+ {"version":3,"file":"exact-scale.js","sourceRoot":"","sources":["../../src/dimensional/exact-scale.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAWpD,qGAAqG;AACrG,SAAS,MAAM,CAAC,CAAS,EAAE,CAAS;IAClC,MAAM,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,IAAI,CAAC,GAAW,EAAE,GAAW,EAAE,UAAkB;IACxD,IAAI,GAAG,KAAK,EAAE;QAAE,MAAM,IAAI,UAAU,CAAC,+BAA+B,CAAC,CAAC;IACtE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CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;YACjD,IAAI,IAAI,KAAK,SAAS;gBAAE,MAAM,IAAI,UAAU,CAAC,iBAAiB,IAAI,YAAY,IAAI,+BAA+B,CAAC,CAAC;YACnH,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5F,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACzD,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/B,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC/E,CAAC","sourcesContent":["/**\n * Exact unit scales.\n *\n * A unit's scale to SI is a rational number times one floating factor that\n * holds its irrational part (π for an angle, ln 2 for a bit). Prefixes,\n * products, quotients and integer powers multiply the rationals exactly, so\n * `g/cm^3` is 1000 and `72 mN/m` is 0.072 with no float noise to round away.\n * The one rounding is {@link scaleToNumber}, which rounds the rational\n * correctly and then multiplies by the irrational factor once.\n *\n * A decimal literal is read digit for digit. A JavaScript number is read\n * through its shortest round-trip decimal (`String(x)`), which is the\n * literal a constant was written with.\n *\n * @module dimensional/exact-scale\n * @internal\n */\nimport { gcd } from '@danielsimonjr/mathts-functions';\nimport { bigintFrom } from '../core/mathts-read.js';\n\n\n/** `num / den × irrational`, with `den > 0` and the fraction in lowest terms. @internal */\nexport interface ExactScale {\n readonly num: bigint;\n readonly den: bigint;\n /** The factor no rational states (π, ln 2). 1 for a rational scale. */\n readonly irrational: number;\n}\n\n/** The bigint gcd, MathTS `gcd` on its `bigint, bigint` signature, read back as the bigint it is. */\nfunction bigGcd(a: bigint, b: bigint): bigint {\n const g = bigintFrom('gcd', gcd(a, b));\n return g < 0n ? -g : g;\n}\n\nfunction make(num: bigint, den: bigint, irrational: number): ExactScale {\n if (den === 0n) throw new RangeError('exact scale: zero denominator');\n if (den < 0n) {\n num = -num;\n den = -den;\n }\n const g = bigGcd(num, den);\n return g > 1n ? { num: num / g, den: den / g, irrational } : { num, den, irrational };\n}\n\n/** The scale 1. @internal */\nexport const UNIT_SCALE: ExactScale = { num: 1n, den: 1n, irrational: 1 };\n\nconst DECIMAL = /^([+-]?)(\\d*)(?:\\.(\\d*))?(?:[eE]([+-]?\\d+))?$/;\n\n/**\n * The exact value of a decimal literal (`72`, `0.45359237`, `1.602176634e-19`),\n * or null when `text` is not one.\n * @internal\n */\nexport function decimalScale(text: string): ExactScale | null {\n const m = DECIMAL.exec(text.trim());\n if (m === null) return null;\n const whole = m[2] ?? '';\n const fraction = m[3] ?? '';\n if (whole === '' && fraction === '') return null;\n const exponent = Number(m[4] ?? '0') - fraction.length;\n if (!Number.isSafeInteger(exponent) || Math.abs(exponent) > 10_000) return null;\n let num = BigInt(whole + fraction);\n if (m[1] === '-') num = -num;\n return exponent >= 0 ? make(num * 10n ** BigInt(exponent), 1n, 1) : make(num, 10n ** BigInt(-exponent), 1);\n}\n\n/** The exact scale a finite JavaScript number was written as. @internal */\nexport function scaleOf(x: number): ExactScale {\n if (!Number.isFinite(x)) throw new RangeError(`exact scale: ${x} is not finite`);\n return decimalScale(String(x))!;\n}\n\n/** `num / den`, exactly. @internal */\nexport function ratioScale(num: number | bigint, den: number | bigint): ExactScale {\n return make(BigInt(num), BigInt(den), 1);\n}\n\n/** A factor no rational states, such as π or ln 2. @internal */\nexport function irrationalScale(x: number): ExactScale {\n if (!Number.isFinite(x)) throw new RangeError(`exact scale: ${x} is not finite`);\n return { num: 1n, den: 1n, irrational: x };\n}\n\n/** `a × b × …`. @internal */\nexport function multiplyScales(...factors: readonly ExactScale[]): ExactScale {\n let num = 1n;\n let den = 1n;\n let irrational = 1;\n for (const f of factors) {\n num *= f.num;\n den *= f.den;\n irrational *= f.irrational;\n }\n return make(num, den, irrational);\n}\n\n/** `a / b`. @internal */\nexport function divideScales(a: ExactScale, b: ExactScale): ExactScale {\n if (b.num === 0n) throw new RangeError('exact scale: division by zero');\n return make(a.num * b.den, a.den * b.num, a.irrational / b.irrational);\n}\n\n/**\n * `a ^ n`. An integer power stays exact. A fractional power has no exact\n * rational in general, so it becomes one floating factor.\n * @internal\n */\nexport function powerScale(a: ExactScale, n: number): ExactScale {\n if (Number.isInteger(n)) {\n const k = BigInt(Math.abs(n));\n const up = make(a.num ** k, a.den ** k, a.irrational ** Math.abs(n));\n return n >= 0 ? up : divideScales(UNIT_SCALE, up);\n }\n return irrationalScale(scaleToNumber(a) ** n);\n}\n\n/** `a + b`: exact when both are rational multiples of the same irrational factor. @internal */\nexport function addScales(a: ExactScale, b: ExactScale): ExactScale {\n if (a.irrational === b.irrational) return make(a.num * b.den + b.num * a.den, a.den * b.den, a.irrational);\n return irrationalScale(scaleToNumber(a) + scaleToNumber(b));\n}\n\n/** The fewest significant digits kept before the sticky digit; far beyond a double's 17. */\nconst MIN_DIGITS = 40;\n\n/** Decimal places of `1 / den` when it terminates (`den` = 2^a·5^b): max(a, b). Null otherwise. */\nfunction terminatingPlaces(den: bigint): number | null {\n let d = den;\n let twos = 0;\n let fives = 0;\n while (d % 2n === 0n) {\n d /= 2n;\n twos++;\n }\n while (d % 5n === 0n) {\n d /= 5n;\n fives++;\n }\n return d === 1n ? Math.max(twos, fives) : null;\n}\n\n/**\n * The rational `num / den` (`den > 0`), reduced, rounded once to the nearest double.\n *\n * A terminating quotient (`den` = 2^a·5^b) is written out exactly, every digit,\n * and parsed: a tie between two doubles is a dyadic rational, so it always\n * lands here and rounds half to even. Any other quotient is not a tie, and it\n * is at least `1 / (den·2^54)` of its magnitude away from every tie; truncating\n * it to `max(40, digits(den) + 20)` significant digits stays closer than that,\n * and a sticky `1` puts the string strictly inside the truncation interval, so\n * the string rounds the way the quotient does for any denominator.\n */\nfunction rationalToNumber(num: bigint, den: bigint): number {\n if (num === 0n) return 0;\n const negative = num < 0n;\n const g = bigGcd(num, den);\n const a = (negative ? -num : num) / g;\n den /= g;\n const places = terminatingPlaces(den);\n if (places !== null) {\n const value = Number(`${(a * 10n ** BigInt(places)) / den}e-${places}`);\n return negative ? -value : value;\n }\n const digits = Math.max(MIN_DIGITS, den.toString().length + 20);\n const shift = digits - (a.toString().length - den.toString().length);\n let q: bigint;\n if (shift >= 0) {\n q = (a * 10n ** BigInt(shift)) / den;\n } else {\n q = a / (den * 10n ** BigInt(-shift));\n }\n // Not terminating, so the remainder is never zero: the sticky digit is always due.\n const value = Number(`${q.toString()}1e${-(shift + 1)}`);\n return negative ? -value : value;\n}\n\n/** The scale as a double: the rational rounded once, times the irrational factor. @internal */\nexport function scaleToNumber(s: ExactScale): number {\n const rational = rationalToNumber(s.num, s.den);\n return s.irrational === 1 ? rational : rational * s.irrational;\n}\n\nconst FACTOR = /^([^*/^\\s]+)(?:\\^([+-]?\\d+))?$/;\n\n/**\n * The two sides of a unit text or a scale expression under the single-solidus\n * convention of ISO 80000-1: everything after the first `/` is the\n * denominator, so a chain is one denominator (`km/s/Mpc` is km/(s·Mpc), and\n * `W/m*K` is W/(m·K), not (W/m)·K). The denominator comes back as one\n * `*`-joined product, each `/`-part's outer parentheses dropped. `units.ts`\n * and {@link readScaleExpression} both split here, so a unit text and a scale\n * expression in `data/units.json` read a `/` the same way.\n * @internal\n */\nexport function solidusSides(text: string): { readonly numerator: string; readonly denominator: string } {\n const parts = text.split('/');\n return {\n numerator: parts[0]!,\n denominator: parts\n .slice(1)\n .map((part) => part.replace(/^\\((.*)\\)$/, '$1'))\n .join('*'),\n };\n}\n\n/**\n * The exact value of a scale expression, the form `data/units.json` stores:\n * factors joined by `*`, then optionally `/` and the denominator's factors,\n * each a decimal literal or a name with an optional integer power\n * (`4.1868*453.59237/1.8`, `pi/180`, `lbf/inch^2`). A `/` follows the unit\n * grammar ({@link solidusSides}): `a/b*c` is a/(b·c). `resolve` gives a name\n * its scale and returns undefined for a name it does not know, which throws\n * here. A decimal literal is read digit for digit, so the result is the\n * rational the text states.\n * @internal\n */\nexport function readScaleExpression(text: string, resolve: (name: string) => ExactScale | undefined): ExactScale {\n const product = (side: string): ExactScale => {\n let scale = UNIT_SCALE;\n for (const part of side.split('*')) {\n const m = FACTOR.exec(part);\n if (m === null) throw new RangeError(`exact scale: '${text}' is not a product of factors`);\n const atom = m[1]!;\n const base = decimalScale(atom) ?? resolve(atom);\n if (base === undefined) throw new RangeError(`exact scale: '${text}' names '${atom}', which is not a known scale`);\n scale = multiplyScales(scale, m[2] === undefined ? base : powerScale(base, Number(m[2])));\n }\n return scale;\n };\n const trimmed = text.trim();\n const { numerator, denominator } = solidusSides(trimmed);\n const top = product(numerator);\n return trimmed.includes('/') ? divideScales(top, product(denominator)) : top;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"gauge-field.d.ts","sourceRoot":"","sources":["../../src/dimensional/gauge-field.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAO5C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,CAAC;AAEhE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,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;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;CACzB;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,yBAAyB;IACxC,kDAAkD;IAClD,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAyB7D;AAED;;;;GAIG;AACH,MAAM,WAAW,qCAAqC;IACpD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,iDAAiD;IACjD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,yBAAyB,GAC9B,qCAAqC,CAkDvC"}
@@ -38,6 +38,7 @@
38
38
  * @see docs/architecture/archive/v0.7-be-x-reencoding-design-note.md §BE-50
39
39
  * @module dimensional/gauge-field
40
40
  */
41
+ import { BASES } from './algebra.js';
41
42
  import { validateComponentDimension } from './field-equation-helpers.js';
42
43
  // ---------------------------------------------------------------------------
43
44
  // Validators
@@ -66,8 +67,7 @@ export function validateGaugeField(node) {
66
67
  `or 'symmetric' (got ${JSON.stringify(node.arrowOfTime)}).`);
67
68
  }
68
69
  const dim = node.dim;
69
- const axes = ['L', 'M', 'T', 'I', 'Theta', 'N', 'J'];
70
- for (const ax of axes) {
70
+ for (const ax of BASES) {
71
71
  if (typeof dim[ax] !== 'number' || !Number.isFinite(dim[ax])) {
72
72
  throw new Error(`GaugeFieldNode: gauge-field dim.${ax} must be a finite number ` +
73
73
  `(got ${JSON.stringify(dim[ax])} for field '${node.name}').`);