@classytic/stage 0.3.0 → 0.4.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 (431) hide show
  1. package/dist/_virtual/_rolldown/runtime.mjs +18 -0
  2. package/dist/atomic/aufbau.d.mts +144 -0
  3. package/dist/atomic/aufbau.mjs +384 -0
  4. package/dist/atomic/elements.d.mts +67 -0
  5. package/dist/atomic/elements.mjs +785 -0
  6. package/dist/atomic/emission.d.mts +112 -0
  7. package/dist/atomic/emission.mjs +179 -0
  8. package/dist/atomic/index.d.mts +8 -0
  9. package/dist/atomic/index.mjs +9 -0
  10. package/dist/atomic/periodic.d.mts +82 -0
  11. package/dist/atomic/periodic.mjs +231 -0
  12. package/dist/atomic/properties.d.mts +100 -0
  13. package/dist/atomic/properties.mjs +574 -0
  14. package/dist/atomic/shells.d.mts +137 -0
  15. package/dist/atomic/shells.mjs +170 -0
  16. package/dist/atomic/trends.d.mts +148 -0
  17. package/dist/atomic/trends.mjs +225 -0
  18. package/dist/chem/chromatography.d.mts +66 -0
  19. package/dist/chem/chromatography.mjs +63 -0
  20. package/dist/chem/complex.d.mts +114 -0
  21. package/dist/chem/complex.mjs +234 -0
  22. package/dist/chem/cycle.d.mts +75 -0
  23. package/dist/chem/cycle.mjs +145 -0
  24. package/dist/chem/equation.d.mts +86 -0
  25. package/dist/chem/equation.mjs +168 -0
  26. package/dist/chem/formula.d.mts +90 -0
  27. package/dist/chem/formula.mjs +201 -0
  28. package/dist/chem/functional-groups.d.mts +31 -0
  29. package/dist/chem/functional-groups.mjs +187 -0
  30. package/dist/chem/hazard.d.mts +94 -0
  31. package/dist/chem/hazard.mjs +329 -0
  32. package/dist/chem/index.d.mts +34 -33
  33. package/dist/chem/index.mjs +34 -28
  34. package/dist/chem/ionic.d.mts +98 -0
  35. package/dist/chem/ionic.mjs +156 -0
  36. package/dist/chem/layout.d.mts +46 -0
  37. package/dist/chem/layout.mjs +342 -0
  38. package/dist/chem/lewis.d.mts +79 -0
  39. package/dist/chem/lewis.mjs +163 -0
  40. package/dist/chem/molecular-orbital.d.mts +114 -0
  41. package/dist/chem/molecular-orbital.mjs +201 -0
  42. package/dist/chem/molecule.d.mts +154 -0
  43. package/dist/chem/molecule.mjs +282 -0
  44. package/dist/chem/nmr.d.mts +153 -0
  45. package/dist/chem/nmr.mjs +165 -0
  46. package/dist/chem/polymer.d.mts +65 -0
  47. package/dist/chem/polymer.mjs +179 -0
  48. package/dist/chem/redox.d.mts +138 -0
  49. package/dist/chem/redox.mjs +328 -0
  50. package/dist/chem/relations.d.mts +183 -0
  51. package/dist/chem/relations.mjs +299 -0
  52. package/dist/chem/skeleton.d.mts +51 -0
  53. package/dist/chem/skeleton.mjs +186 -0
  54. package/dist/chem/solution.d.mts +116 -0
  55. package/dist/chem/solution.mjs +186 -0
  56. package/dist/chem/species.d.mts +47 -0
  57. package/dist/chem/species.mjs +128 -0
  58. package/dist/chem/stereo.d.mts +108 -0
  59. package/dist/chem/stereo.mjs +286 -0
  60. package/dist/chem/stoichiometry.d.mts +95 -0
  61. package/dist/chem/stoichiometry.mjs +145 -0
  62. package/dist/chem/synthesis.d.mts +113 -0
  63. package/dist/chem/synthesis.mjs +281 -0
  64. package/dist/chem/vsepr.d.mts +80 -0
  65. package/dist/chem/vsepr.mjs +247 -0
  66. package/dist/circuit/ac.d.mts +163 -0
  67. package/dist/circuit/ac.mjs +452 -0
  68. package/dist/circuit/dc.d.mts +92 -0
  69. package/dist/circuit/dc.mjs +333 -0
  70. package/dist/circuit/index.d.mts +5 -92
  71. package/dist/circuit/index.mjs +5 -332
  72. package/dist/circuit/network.d.mts +99 -0
  73. package/dist/circuit/network.mjs +440 -0
  74. package/dist/circuit/topology.d.mts +102 -0
  75. package/dist/circuit/topology.mjs +143 -0
  76. package/dist/colour/absorption.d.mts +79 -0
  77. package/dist/colour/absorption.mjs +137 -0
  78. package/dist/colour/index.d.mts +6 -0
  79. package/dist/colour/index.mjs +7 -0
  80. package/dist/colour/name.d.mts +14 -0
  81. package/dist/colour/name.mjs +76 -0
  82. package/dist/colour/observer.d.mts +31 -0
  83. package/dist/colour/observer.mjs +46 -0
  84. package/dist/colour/spectrum.d.mts +61 -0
  85. package/dist/colour/spectrum.mjs +108 -0
  86. package/dist/colour/srgb.d.mts +49 -0
  87. package/dist/colour/srgb.mjs +108 -0
  88. package/dist/core/constants.d.mts +138 -0
  89. package/dist/core/constants.mjs +139 -0
  90. package/dist/core/index.d.mts +3 -1
  91. package/dist/core/index.mjs +3 -1
  92. package/dist/core/vec3.d.mts +94 -0
  93. package/dist/core/vec3.mjs +123 -0
  94. package/dist/core/worked.d.mts +35 -0
  95. package/dist/core/worked.mjs +44 -0
  96. package/dist/electro/cell.d.mts +102 -0
  97. package/dist/electro/cell.mjs +170 -0
  98. package/dist/electro/conductivity.d.mts +157 -0
  99. package/dist/electro/conductivity.mjs +156 -0
  100. package/dist/electro/couples.d.mts +114 -0
  101. package/dist/electro/couples.mjs +334 -0
  102. package/dist/electro/electrolysis.d.mts +96 -0
  103. package/dist/electro/electrolysis.mjs +274 -0
  104. package/dist/electro/faraday.d.mts +150 -0
  105. package/dist/electro/faraday.mjs +118 -0
  106. package/dist/electro/index.d.mts +6 -0
  107. package/dist/electro/index.mjs +7 -0
  108. package/dist/finance/accounting/adjustments.d.mts +17 -0
  109. package/dist/finance/accounting/adjustments.mjs +202 -0
  110. package/dist/finance/accounting/analysis.d.mts +8 -0
  111. package/dist/finance/accounting/analysis.mjs +205 -0
  112. package/dist/finance/accounting/clubs.d.mts +21 -0
  113. package/dist/finance/accounting/clubs.mjs +217 -0
  114. package/dist/finance/accounting/company-statements.d.mts +7 -0
  115. package/dist/finance/accounting/company-statements.mjs +150 -0
  116. package/dist/finance/accounting/harness.d.mts +7 -0
  117. package/dist/finance/accounting/harness.mjs +45 -0
  118. package/dist/finance/accounting/index.d.mts +18 -0
  119. package/dist/finance/accounting/index.mjs +18 -0
  120. package/dist/finance/accounting/journalize.d.mts +16 -0
  121. package/dist/finance/accounting/journalize.mjs +128 -0
  122. package/dist/finance/accounting/manufacturing.d.mts +8 -0
  123. package/dist/finance/accounting/manufacturing.mjs +236 -0
  124. package/dist/finance/accounting/partnership.d.mts +7 -0
  125. package/dist/finance/accounting/partnership.mjs +152 -0
  126. package/dist/finance/accounting/period-case.d.mts +6 -0
  127. package/dist/finance/accounting/period-case.mjs +71 -0
  128. package/dist/finance/accounting/post.d.mts +9 -0
  129. package/dist/finance/accounting/post.mjs +84 -0
  130. package/dist/finance/accounting/precision.d.mts +9 -0
  131. package/dist/finance/accounting/precision.mjs +15 -0
  132. package/dist/finance/accounting/rules.d.mts +21 -0
  133. package/dist/finance/accounting/rules.mjs +37 -0
  134. package/dist/finance/accounting/solve.d.mts +28 -0
  135. package/dist/finance/accounting/solve.mjs +92 -0
  136. package/dist/finance/accounting/statements.d.mts +7 -0
  137. package/dist/finance/accounting/statements.mjs +142 -0
  138. package/dist/finance/accounting/types.d.mts +649 -0
  139. package/dist/finance/accounting/validate.d.mts +7 -0
  140. package/dist/finance/accounting/validate.mjs +67 -0
  141. package/dist/finance/accounting/verification.d.mts +24 -0
  142. package/dist/finance/accounting/verification.mjs +386 -0
  143. package/dist/finance/bizsim.d.mts +21 -39
  144. package/dist/finance/bizsim.mjs +276 -97
  145. package/dist/finance/index.d.mts +20 -43
  146. package/dist/finance/index.mjs +19 -77
  147. package/dist/finance/investment-math.d.mts +7 -0
  148. package/dist/finance/investment-math.mjs +18 -0
  149. package/dist/finance/management-accounting/budgeting.d.mts +7 -0
  150. package/dist/finance/management-accounting/budgeting.mjs +189 -0
  151. package/dist/finance/management-accounting/cash-budget.d.mts +7 -0
  152. package/dist/finance/management-accounting/cash-budget.mjs +154 -0
  153. package/dist/finance/management-accounting/costing.d.mts +8 -0
  154. package/dist/finance/management-accounting/costing.mjs +175 -0
  155. package/dist/finance/management-accounting/decisions.d.mts +8 -0
  156. package/dist/finance/management-accounting/decisions.mjs +164 -0
  157. package/dist/finance/management-accounting/index.d.mts +13 -0
  158. package/dist/finance/management-accounting/index.mjs +13 -0
  159. package/dist/finance/management-accounting/integrated-budget.d.mts +8 -0
  160. package/dist/finance/management-accounting/integrated-budget.mjs +67 -0
  161. package/dist/finance/management-accounting/inventory-costing.d.mts +7 -0
  162. package/dist/finance/management-accounting/inventory-costing.mjs +173 -0
  163. package/dist/finance/management-accounting/investment-appraisal.d.mts +7 -0
  164. package/dist/finance/management-accounting/investment-appraisal.mjs +148 -0
  165. package/dist/finance/management-accounting/management-case.d.mts +8 -0
  166. package/dist/finance/management-accounting/management-case.mjs +91 -0
  167. package/dist/finance/management-accounting/master-budget.d.mts +7 -0
  168. package/dist/finance/management-accounting/master-budget.mjs +137 -0
  169. package/dist/finance/management-accounting/production-costing.d.mts +8 -0
  170. package/dist/finance/management-accounting/production-costing.mjs +214 -0
  171. package/dist/finance/management-accounting/types.d.mts +644 -0
  172. package/dist/finance/management-accounting/variances.d.mts +7 -0
  173. package/dist/finance/management-accounting/variances.mjs +150 -0
  174. package/dist/index.d.mts +6 -6
  175. package/dist/index.mjs +1 -1
  176. package/dist/math/analysis.d.mts +61 -0
  177. package/dist/math/analysis.mjs +187 -0
  178. package/dist/math/answer-check.d.mts +50 -0
  179. package/dist/math/answer-check.mjs +106 -0
  180. package/dist/math/calculus.d.mts +4 -9
  181. package/dist/math/calculus.mjs +216 -7
  182. package/dist/math/complex.d.mts +93 -0
  183. package/dist/math/complex.mjs +239 -0
  184. package/dist/math/expr.d.mts +23 -0
  185. package/dist/math/expr.mjs +36 -0
  186. package/dist/math/index.d.mts +8 -22
  187. package/dist/math/index.mjs +8 -37
  188. package/dist/math/latex.mjs +2 -1
  189. package/dist/math/parse.mjs +1 -1
  190. package/dist/math/poly.d.mts +55 -0
  191. package/dist/math/poly.mjs +273 -0
  192. package/dist/math/rearrange.d.mts +14 -0
  193. package/dist/math/rearrange.mjs +125 -0
  194. package/dist/math/solve.d.mts +21 -0
  195. package/dist/math/solve.mjs +75 -0
  196. package/dist/networking/addressing.d.mts +26 -0
  197. package/dist/networking/addressing.mjs +33 -0
  198. package/dist/networking/cloud/access.d.mts +36 -0
  199. package/dist/networking/cloud/access.mjs +95 -0
  200. package/dist/networking/cloud/containers.d.mts +43 -0
  201. package/dist/networking/cloud/containers.mjs +54 -0
  202. package/dist/networking/cloud/edge.d.mts +17 -0
  203. package/dist/networking/cloud/edge.mjs +31 -0
  204. package/dist/networking/cloud/failure-domains.d.mts +19 -0
  205. package/dist/networking/cloud/failure-domains.mjs +22 -0
  206. package/dist/networking/cloud/geo-routing.d.mts +22 -0
  207. package/dist/networking/cloud/geo-routing.mjs +64 -0
  208. package/dist/networking/cloud/index.d.mts +18 -0
  209. package/dist/networking/cloud/index.mjs +19 -0
  210. package/dist/networking/cloud/inference-reliability.d.mts +30 -0
  211. package/dist/networking/cloud/inference-reliability.mjs +76 -0
  212. package/dist/networking/cloud/inference.d.mts +118 -0
  213. package/dist/networking/cloud/inference.mjs +179 -0
  214. package/dist/networking/cloud/infrastructure.d.mts +45 -0
  215. package/dist/networking/cloud/infrastructure.mjs +96 -0
  216. package/dist/networking/cloud/observability.d.mts +24 -0
  217. package/dist/networking/cloud/observability.mjs +34 -0
  218. package/dist/networking/cloud/orchestration.d.mts +32 -0
  219. package/dist/networking/cloud/orchestration.mjs +38 -0
  220. package/dist/networking/cloud/recovery.d.mts +21 -0
  221. package/dist/networking/cloud/recovery.mjs +27 -0
  222. package/dist/networking/cloud/releases.d.mts +42 -0
  223. package/dist/networking/cloud/releases.mjs +135 -0
  224. package/dist/networking/cloud/scaling.d.mts +25 -0
  225. package/dist/networking/cloud/scaling.mjs +65 -0
  226. package/dist/networking/cloud/secrets.d.mts +39 -0
  227. package/dist/networking/cloud/secrets.mjs +68 -0
  228. package/dist/networking/cloud/server-deployment.d.mts +29 -0
  229. package/dist/networking/cloud/server-deployment.mjs +72 -0
  230. package/dist/networking/cloud/storage.d.mts +16 -0
  231. package/dist/networking/cloud/storage.mjs +58 -0
  232. package/dist/networking/cloud/vpc.d.mts +18 -0
  233. package/dist/networking/cloud/vpc.mjs +100 -0
  234. package/dist/networking/delivery.d.mts +34 -0
  235. package/dist/networking/delivery.mjs +52 -0
  236. package/dist/networking/index.d.mts +47 -0
  237. package/dist/networking/index.mjs +47 -0
  238. package/dist/networking/ipv6.d.mts +28 -0
  239. package/dist/networking/ipv6.mjs +17 -0
  240. package/dist/networking/journeys.d.mts +83 -0
  241. package/dist/networking/journeys.mjs +161 -0
  242. package/dist/networking/models/airtime.d.mts +87 -0
  243. package/dist/networking/models/airtime.mjs +130 -0
  244. package/dist/networking/models/cellular.d.mts +157 -0
  245. package/dist/networking/models/cellular.mjs +252 -0
  246. package/dist/networking/models/encapsulation.d.mts +98 -0
  247. package/dist/networking/models/encapsulation.mjs +132 -0
  248. package/dist/networking/models/handover.d.mts +116 -0
  249. package/dist/networking/models/handover.mjs +209 -0
  250. package/dist/networking/models/handshake.d.mts +90 -0
  251. package/dist/networking/models/handshake.mjs +122 -0
  252. package/dist/networking/models/index.d.mts +14 -0
  253. package/dist/networking/models/index.mjs +15 -0
  254. package/dist/networking/models/media.d.mts +82 -0
  255. package/dist/networking/models/media.mjs +188 -0
  256. package/dist/networking/models/satellite.d.mts +86 -0
  257. package/dist/networking/models/satellite.mjs +121 -0
  258. package/dist/networking/models/spectrum.d.mts +83 -0
  259. package/dist/networking/models/spectrum.mjs +235 -0
  260. package/dist/networking/models/switch.d.mts +80 -0
  261. package/dist/networking/models/switch.mjs +155 -0
  262. package/dist/networking/models/vlan.d.mts +62 -0
  263. package/dist/networking/models/vlan.mjs +100 -0
  264. package/dist/networking/models/vpn.d.mts +66 -0
  265. package/dist/networking/models/vpn.mjs +125 -0
  266. package/dist/networking/models/wifi-privacy.d.mts +82 -0
  267. package/dist/networking/models/wifi-privacy.mjs +130 -0
  268. package/dist/networking/models/wifi.d.mts +240 -0
  269. package/dist/networking/models/wifi.mjs +562 -0
  270. package/dist/networking/nat-traversal.d.mts +24 -0
  271. package/dist/networking/nat-traversal.mjs +38 -0
  272. package/dist/networking/protocols.d.mts +17 -0
  273. package/dist/networking/protocols.mjs +57 -0
  274. package/dist/networking/queue.d.mts +12 -0
  275. package/dist/networking/queue.mjs +18 -0
  276. package/dist/networking/route-learning.d.mts +23 -0
  277. package/dist/networking/route-learning.mjs +43 -0
  278. package/dist/networking/routing.d.mts +11 -0
  279. package/dist/networking/routing.mjs +25 -0
  280. package/dist/networking/signals.d.mts +26 -0
  281. package/dist/networking/signals.mjs +35 -0
  282. package/dist/networking/subnet.d.mts +49 -0
  283. package/dist/networking/subnet.mjs +89 -0
  284. package/dist/networking/tcp-reliability.d.mts +24 -0
  285. package/dist/networking/tcp-reliability.mjs +38 -0
  286. package/dist/networking/topology/contract.d.mts +123 -0
  287. package/dist/networking/topology/index.d.mts +4 -0
  288. package/dist/networking/topology/index.mjs +4 -0
  289. package/dist/networking/topology/presets.d.mts +7 -0
  290. package/dist/networking/topology/presets.mjs +302 -0
  291. package/dist/networking/topology/simulation.d.mts +8 -0
  292. package/dist/networking/topology/simulation.mjs +179 -0
  293. package/dist/networking/wireless.d.mts +11 -0
  294. package/dist/networking/wireless.mjs +17 -0
  295. package/dist/optics/imaging.d.mts +218 -0
  296. package/dist/optics/imaging.mjs +276 -0
  297. package/dist/optics/index.d.mts +7 -0
  298. package/dist/optics/index.mjs +8 -0
  299. package/dist/optics/laws.d.mts +70 -0
  300. package/dist/optics/laws.mjs +195 -0
  301. package/dist/optics/prism.d.mts +148 -0
  302. package/dist/optics/prism.mjs +197 -0
  303. package/dist/optics/refraction.d.mts +201 -0
  304. package/dist/optics/refraction.mjs +270 -0
  305. package/dist/optics/wave-optics.d.mts +171 -0
  306. package/dist/optics/wave-optics.mjs +259 -0
  307. package/dist/physics/ac/index.d.mts +183 -0
  308. package/dist/physics/ac/index.mjs +203 -0
  309. package/dist/physics/dynamics/forces.d.mts +98 -0
  310. package/dist/physics/dynamics/forces.mjs +153 -0
  311. package/dist/physics/dynamics/friction.d.mts +76 -0
  312. package/dist/physics/dynamics/friction.mjs +119 -0
  313. package/dist/physics/dynamics/system.d.mts +68 -0
  314. package/dist/physics/dynamics/system.mjs +125 -0
  315. package/dist/physics/electrostatics/index.d.mts +169 -0
  316. package/dist/physics/electrostatics/index.mjs +249 -0
  317. package/dist/physics/energy/centre-of-mass.d.mts +115 -0
  318. package/dist/physics/energy/centre-of-mass.mjs +180 -0
  319. package/dist/physics/energy/conservation.d.mts +81 -0
  320. package/dist/physics/energy/conservation.mjs +129 -0
  321. package/dist/physics/energy/power.d.mts +90 -0
  322. package/dist/physics/energy/power.mjs +167 -0
  323. package/dist/physics/energy/spring.d.mts +73 -0
  324. package/dist/physics/energy/spring.mjs +129 -0
  325. package/dist/physics/energy/store.d.mts +63 -0
  326. package/dist/physics/energy/store.mjs +108 -0
  327. package/dist/physics/energy/theorem.d.mts +65 -0
  328. package/dist/physics/energy/theorem.mjs +113 -0
  329. package/dist/physics/energy/work.d.mts +114 -0
  330. package/dist/physics/energy/work.mjs +219 -0
  331. package/dist/physics/gravitation/body.d.mts +85 -0
  332. package/dist/physics/gravitation/body.mjs +168 -0
  333. package/dist/physics/gravitation/kepler.d.mts +127 -0
  334. package/dist/physics/gravitation/kepler.mjs +216 -0
  335. package/dist/physics/gravitation/law.d.mts +117 -0
  336. package/dist/physics/gravitation/law.mjs +175 -0
  337. package/dist/physics/gravitation/orbit.d.mts +119 -0
  338. package/dist/physics/gravitation/orbit.mjs +202 -0
  339. package/dist/physics/gravitation/potential.d.mts +114 -0
  340. package/dist/physics/gravitation/potential.mjs +202 -0
  341. package/dist/physics/gravitation/variation.d.mts +97 -0
  342. package/dist/physics/gravitation/variation.mjs +175 -0
  343. package/dist/physics/index.d.mts +35 -0
  344. package/dist/physics/index.mjs +36 -0
  345. package/dist/physics/integral-sweep.d.mts +63 -0
  346. package/dist/physics/integral-sweep.mjs +126 -0
  347. package/dist/physics/kinematics/equations.d.mts +47 -0
  348. package/dist/physics/kinematics/equations.mjs +126 -0
  349. package/dist/physics/kinematics/free-fall.d.mts +53 -0
  350. package/dist/physics/kinematics/free-fall.mjs +71 -0
  351. package/dist/physics/kinematics/given.d.mts +16 -0
  352. package/dist/physics/kinematics/given.mjs +55 -0
  353. package/dist/physics/kinematics/roots.d.mts +41 -0
  354. package/dist/physics/kinematics/roots.mjs +72 -0
  355. package/dist/physics/kinematics/solve.d.mts +52 -0
  356. package/dist/physics/kinematics/solve.mjs +172 -0
  357. package/dist/physics/magnetism/biot-savart.d.mts +161 -0
  358. package/dist/physics/magnetism/biot-savart.mjs +353 -0
  359. package/dist/physics/magnetism/flux.d.mts +94 -0
  360. package/dist/physics/magnetism/flux.mjs +313 -0
  361. package/dist/physics/magnetism/geomagnetism.d.mts +151 -0
  362. package/dist/physics/magnetism/geomagnetism.mjs +184 -0
  363. package/dist/physics/magnetism/index.d.mts +12 -0
  364. package/dist/physics/magnetism/index.mjs +74 -0
  365. package/dist/physics/magnetism/lorentz.d.mts +28 -0
  366. package/dist/physics/magnetism/lorentz.mjs +88 -0
  367. package/dist/physics/magnetism/magnetic-force.d.mts +102 -0
  368. package/dist/physics/magnetism/magnetic-force.mjs +169 -0
  369. package/dist/physics/momentum/collide.d.mts +77 -0
  370. package/dist/physics/momentum/collide.mjs +115 -0
  371. package/dist/physics/momentum/impulse.d.mts +89 -0
  372. package/dist/physics/momentum/impulse.mjs +159 -0
  373. package/dist/physics/momentum/planar.d.mts +60 -0
  374. package/dist/physics/momentum/planar.mjs +110 -0
  375. package/dist/physics/projectile.d.mts +107 -0
  376. package/dist/physics/projectile.mjs +185 -0
  377. package/dist/physics/rotation/angular.d.mts +85 -0
  378. package/dist/physics/rotation/angular.mjs +130 -0
  379. package/dist/physics/rotation/circular.d.mts +79 -0
  380. package/dist/physics/rotation/circular.mjs +131 -0
  381. package/dist/physics/rotation/inertia.d.mts +164 -0
  382. package/dist/physics/rotation/inertia.mjs +332 -0
  383. package/dist/physics/rotation/torque.d.mts +65 -0
  384. package/dist/physics/rotation/torque.mjs +134 -0
  385. package/dist/physics/vectors.d.mts +64 -0
  386. package/dist/physics/vectors.mjs +114 -0
  387. package/dist/quantity/index.d.mts +119 -0
  388. package/dist/quantity/index.mjs +417 -0
  389. package/dist/relation/derive.d.mts +74 -0
  390. package/dist/relation/derive.mjs +73 -0
  391. package/dist/relation/index.d.mts +56 -0
  392. package/dist/relation/index.mjs +234 -0
  393. package/dist/scene/evaluators.mjs +1 -1
  394. package/dist/sim/thermal.mjs +45 -20
  395. package/dist/thermo/calorimetry.d.mts +207 -0
  396. package/dist/thermo/calorimetry.mjs +345 -0
  397. package/dist/thermo/cycles.d.mts +142 -0
  398. package/dist/thermo/cycles.mjs +256 -0
  399. package/dist/thermo/entropy.d.mts +87 -0
  400. package/dist/thermo/entropy.mjs +140 -0
  401. package/dist/thermo/expansion.d.mts +130 -0
  402. package/dist/thermo/expansion.mjs +178 -0
  403. package/dist/thermo/gas.d.mts +197 -0
  404. package/dist/thermo/gas.mjs +279 -0
  405. package/dist/thermo/heat-transfer.d.mts +164 -0
  406. package/dist/thermo/heat-transfer.mjs +217 -0
  407. package/dist/thermo/index.d.mts +9 -82
  408. package/dist/thermo/index.mjs +9 -132
  409. package/dist/thermo/processes.d.mts +95 -0
  410. package/dist/thermo/processes.mjs +154 -0
  411. package/dist/thermo/temperature.d.mts +174 -0
  412. package/dist/thermo/temperature.mjs +236 -0
  413. package/dist/waves/damping.d.mts +224 -0
  414. package/dist/waves/damping.mjs +317 -0
  415. package/dist/waves/doppler.d.mts +72 -0
  416. package/dist/waves/doppler.mjs +125 -0
  417. package/dist/waves/index.d.mts +10 -0
  418. package/dist/waves/index.mjs +10 -0
  419. package/dist/waves/pendulum.d.mts +130 -0
  420. package/dist/waves/pendulum.mjs +211 -0
  421. package/dist/waves/pitch.d.mts +125 -0
  422. package/dist/waves/pitch.mjs +158 -0
  423. package/dist/waves/shm.d.mts +170 -0
  424. package/dist/waves/shm.mjs +279 -0
  425. package/dist/waves/springs.d.mts +103 -0
  426. package/dist/waves/springs.mjs +176 -0
  427. package/dist/waves/superposition.d.mts +124 -0
  428. package/dist/waves/superposition.mjs +196 -0
  429. package/dist/waves/wave.d.mts +154 -0
  430. package/dist/waves/wave.mjs +178 -0
  431. package/package.json +74 -2
@@ -0,0 +1,119 @@
1
+ import { Worked } from "../../core/worked.mjs";
2
+ import { CentralBody } from "./body.mjs";
3
+
4
+ //#region src/physics/gravitation/orbit.d.ts
5
+ /** Speed of a circular orbit of a given radius: `v = √(mu/r)`. Radius from the CENTRE, not the surface. */
6
+ declare const orbitalSpeed: (mu: number, radius: number) => number;
7
+ /** Period of a circular orbit: `T = 2π√(r³/mu)`. */
8
+ declare const orbitalPeriod: (mu: number, radius: number) => number;
9
+ /** The radius whose circular orbit has a given period: `r = (mu·T²/4π²)^{1/3}`. */
10
+ declare const orbitRadiusForPeriod: (mu: number, period: number) => number;
11
+ /**
12
+ * The orbital speed derivation, with the centripetal step shown rather than assumed.
13
+ *
14
+ * Calls `centripetalAcceleration` to compute the requirement that gravity is being asked to meet, so
15
+ * the returned working can state both sides as numbers and show them matching. That is not
16
+ * decoration: "gravity supplies the centripetal force" is a sentence students repeat without ever
17
+ * having seen the two quantities agree.
18
+ */
19
+ declare function orbitalSpeedSteps(body: CentralBody, radius: number, sf?: number): Worked;
20
+ /**
21
+ * The geostationary orbit of a rotating body: the one radius whose period matches the body's day.
22
+ *
23
+ * Three conditions define it and questions penalise forgetting the last two: the period must match
24
+ * the SIDEREAL day, the orbit must be EQUATORIAL, and it must go the same way round as the rotation.
25
+ * A 24-hour orbit tilted 30° is geoSYNCHRONOUS, not geostationary, and traces a figure of eight in
26
+ * the sky rather than hanging still.
27
+ *
28
+ * Uses the sidereal period from the body, which for Earth is 86164 s rather than 86400. Using the
29
+ * solar day instead puts the orbit about 80 km too high, and four minutes a day is not a rounding
30
+ * error when a dish is pointed at it.
31
+ */
32
+ declare function geostationaryOrbit(body: CentralBody, sf?: number): {
33
+ radius: number;
34
+ height: number;
35
+ speed: number;
36
+ worked: Worked;
37
+ };
38
+ interface OrbitalEnergy {
39
+ readonly kinetic: number;
40
+ readonly potential: number;
41
+ readonly total: number;
42
+ /** Energy needed to escape from this orbit, which is exactly `−total`. */
43
+ readonly bindingEnergy: number;
44
+ }
45
+ /**
46
+ * The three energy stores of a circular orbit, in joules.
47
+ *
48
+ * The relations `E = −E_k` and `E_p = 2E` fall straight out and are the most useful shortcut in the
49
+ * topic: given any one of the three you have the other two without touching a formula. The binding
50
+ * energy is returned alongside because "how much more energy to escape from here?" is the standard
51
+ * follow-up, and the answer is just the total with its sign flipped.
52
+ */
53
+ declare function orbitalEnergy(mu: number, mass: number, radius: number): OrbitalEnergy;
54
+ /**
55
+ * The same, worked, ending on the paradox.
56
+ *
57
+ * The last two steps are the point of the function. A satellite moved to a higher orbit has MORE
58
+ * total energy and LESS kinetic energy, so it is moving more slowly despite the engine having fired.
59
+ * Stating that as a consequence of `E = −E_k` turns it from a piece of space-flight trivia into an
60
+ * unavoidable arithmetic fact, which is the difference between a student remembering it and not.
61
+ */
62
+ declare function orbitalEnergySteps(mu: number, mass: number, radius: number, sf?: number): Worked;
63
+ /**
64
+ * The vis-viva equation: `v² = mu(2/r − 1/a)`.
65
+ *
66
+ * THE MOST POWERFUL SINGLE EQUATION IN ORBITAL MECHANICS, and it contains almost everything above as
67
+ * special cases. Put `a = r` and it gives the circular speed. Let `a → ∞` and it gives escape speed.
68
+ * Anything elliptical is the general case. A learner who meets it after the special cases sees six
69
+ * formulas collapse into one, which is the moment the topic stops being a list.
70
+ *
71
+ * `a` is the semi-major axis, and for a hyperbolic path it is negative, which the formula handles
72
+ * without a special case.
73
+ */
74
+ declare function visViva(mu: number, radius: number, semiMajorAxis: number): number;
75
+ /** The shape a launch at a given speed produces. */
76
+ type TrajectoryKind = 'sub-orbital' | 'circular' | 'elliptical' | 'parabolic' | 'hyperbolic';
77
+ /**
78
+ * What happens to something launched HORIZONTALLY at a given speed from a given radius.
79
+ *
80
+ * The ladder every textbook prints as five separate cases, computed from one comparison. Below the
81
+ * circular speed the ellipse it enters has its far side inside the planet, so it comes down;
82
+ * exactly at it, a circle; between that and escape, an ellipse rising on the far side; exactly at
83
+ * escape, a parabola; above, a hyperbola that never returns.
84
+ *
85
+ * The tolerance matters: floating point will never hand you exactly the circular speed, so "circular"
86
+ * has to mean "within a whisker", and a lab that tests for equality will report an ellipse forever.
87
+ */
88
+ declare function trajectoryKind(mu: number, radius: number, speed: number, tolerance?: number): TrajectoryKind;
89
+ /**
90
+ * A Hohmann transfer between two circular orbits: the cheapest two-burn route, and the reason
91
+ * launch windows exist.
92
+ *
93
+ * Two burns, at opposite ends of an ellipse that just touches both circles. Returns each burn's
94
+ * `Δv` and the transfer time, which is half the ellipse's period. Beyond most school syllabuses and
95
+ * included because it is the first question a curious student asks after "what is an orbit", and
96
+ * because it is where the raise-your-orbit-and-slow-down paradox becomes operational: both burns
97
+ * are prograde, both add energy, and you arrive moving more slowly than you set off.
98
+ */
99
+ declare function hohmannTransfer(mu: number, fromRadius: number, toRadius: number): {
100
+ burn1: number;
101
+ burn2: number;
102
+ totalDeltaV: number;
103
+ transferTimeS: number;
104
+ semiMajorAxis: number;
105
+ };
106
+ /**
107
+ * The speed of a satellite skimming the surface, and the period it would have.
108
+ *
109
+ * `v = √(gR)`, about 7.9 km/s for the Earth, and 84 minutes to go round. Worth its own function
110
+ * because it is the natural unit of the whole topic: every real orbit is slower than this and every
111
+ * escape is `√2` faster, so a learner with this one number in their head can sanity-check anything.
112
+ * It is also the same 84 minutes as `spinPeriodForWeightlessness`, for the same reason.
113
+ */
114
+ declare function surfaceSkimmingOrbit(body: CentralBody): {
115
+ speed: number;
116
+ periodS: number;
117
+ };
118
+ //#endregion
119
+ export { OrbitalEnergy, TrajectoryKind, geostationaryOrbit, hohmannTransfer, orbitRadiusForPeriod, orbitalEnergy, orbitalEnergySteps, orbitalPeriod, orbitalSpeed, orbitalSpeedSteps, surfaceSkimmingOrbit, trajectoryKind, visViva };
@@ -0,0 +1,202 @@
1
+ import { calc, texSigFigs } from "../../core/worked.mjs";
2
+ import { centripetalAcceleration } from "../rotation/circular.mjs";
3
+ import { surfaceGravity } from "./body.mjs";
4
+ import { escapeSpeed, gravitationalPotentialEnergy } from "./potential.mjs";
5
+
6
+ //#region src/physics/gravitation/orbit.ts
7
+ /**
8
+ * Circular orbits, orbital energy, and the transfer between two orbits.
9
+ *
10
+ * ── An orbit is not a new topic ─────────────────────────────────────────────────────────────────
11
+ * The entire derivation is one substitution: gravity SUPPLIES the centripetal requirement.
12
+ *
13
+ * GMm/r² = mv²/r → v = √(GM/r)
14
+ *
15
+ * That is it. The centripetal side is `rotation/circular.ts`'s and is imported rather than rewritten,
16
+ * because the point of having taught circular motion is that this is then not a new skill, it is the
17
+ * old skill with a particular force named. A learner who cannot see the substitution is memorising
18
+ * `√(GM/r)` as a twenty-first formula.
19
+ *
20
+ * Note what cancels: the satellite's mass, on both sides. An orbit does not care what is in it,
21
+ * which is why a space station and a bolt that fell off it stay side by side.
22
+ *
23
+ * ── The fact that makes orbits strange, and it is worth the shock ───────────────────────────────
24
+ * Higher orbits are SLOWER. `v = √(GM/r)` falls as `r` grows, so the Moon dawdles at 1 km/s while
25
+ * the Space Station races at 7.7 km/s. Every instinct says the opposite, because on Earth going
26
+ * further up costs effort and arriving faster feels like the reward.
27
+ *
28
+ * It gets worse, and this is the genuine paradox of the chapter. Firing your engine FORWARDS raises
29
+ * your orbit and leaves you moving SLOWER than before. Firing backwards drops you and you speed up.
30
+ * A spacecraft chasing another in the same orbit must therefore slow down to catch up. The energy
31
+ * accounting below is what resolves it: thrusting adds total energy, the potential store takes more
32
+ * than all of it, and the kinetic store pays the difference.
33
+ *
34
+ * ── The energy relations, which are three facts in one line ─────────────────────────────────────
35
+ * E_k = +GMm/2r E_p = −GMm/r E = E_k + E_p = −GMm/2r
36
+ *
37
+ * So `E = −E_k` and `E_p = 2E`. The total is NEGATIVE, and that negativity is the definition of
38
+ * being bound: an orbit is a debt you cannot pay off. Zero total energy is exactly escape, which is
39
+ * why escape speed is `√2` times orbital speed and not something that needs separate memorising.
40
+ *
41
+ * Pure: no React, no pixels.
42
+ */
43
+ const positive = (value, what) => {
44
+ if (!Number.isFinite(value) || value <= 0) throw new RangeError(`${what} must be positive and finite`);
45
+ return value;
46
+ };
47
+ /** Speed of a circular orbit of a given radius: `v = √(mu/r)`. Radius from the CENTRE, not the surface. */
48
+ const orbitalSpeed = (mu, radius) => Math.sqrt(positive(mu, "gravitational parameter") / positive(radius, "radius"));
49
+ /** Period of a circular orbit: `T = 2π√(r³/mu)`. */
50
+ const orbitalPeriod = (mu, radius) => 2 * Math.PI * Math.sqrt(positive(radius, "radius") ** 3 / positive(mu, "gravitational parameter"));
51
+ /** The radius whose circular orbit has a given period: `r = (mu·T²/4π²)^{1/3}`. */
52
+ const orbitRadiusForPeriod = (mu, period) => Math.cbrt(positive(mu, "gravitational parameter") * positive(period, "period") ** 2 / (4 * Math.PI ** 2));
53
+ /**
54
+ * The orbital speed derivation, with the centripetal step shown rather than assumed.
55
+ *
56
+ * Calls `centripetalAcceleration` to compute the requirement that gravity is being asked to meet, so
57
+ * the returned working can state both sides as numbers and show them matching. That is not
58
+ * decoration: "gravity supplies the centripetal force" is a sentence students repeat without ever
59
+ * having seen the two quantities agree.
60
+ */
61
+ function orbitalSpeedSteps(body, radius, sf = 3) {
62
+ const r = positive(radius, "radius");
63
+ const value = orbitalSpeed(body.mu, r);
64
+ const required = centripetalAcceleration(value, r);
65
+ return calc().step("\\frac{GMm}{r^2} = \\frac{mv^2}{r}", "gravity is not an extra force here, it IS the centripetal force. Nothing else is acting").step("v = \\sqrt{\\frac{GM}{r}}", "the satellite mass m cancels: an orbit does not care what is in it").step(`v = \\sqrt{\\frac{${texSigFigs(body.mu, sf)}}{${texSigFigs(r, sf)}}} = ${texSigFigs(value, sf)}\\ \\mathrm{m\\,s^{-1}}`).step(`a_c = \\frac{v^2}{r} = ${texSigFigs(required, sf)}\\ \\mathrm{m\\,s^{-2}}`, "and the field strength at that radius is the same number, which is what \"supplies\" means").step("v \\propto \\frac{1}{\\sqrt{r}}", "so HIGHER orbits are SLOWER. The Moon crawls at 1 km/s while the Space Station does 7.7").done(value);
66
+ }
67
+ /**
68
+ * The geostationary orbit of a rotating body: the one radius whose period matches the body's day.
69
+ *
70
+ * Three conditions define it and questions penalise forgetting the last two: the period must match
71
+ * the SIDEREAL day, the orbit must be EQUATORIAL, and it must go the same way round as the rotation.
72
+ * A 24-hour orbit tilted 30° is geoSYNCHRONOUS, not geostationary, and traces a figure of eight in
73
+ * the sky rather than hanging still.
74
+ *
75
+ * Uses the sidereal period from the body, which for Earth is 86164 s rather than 86400. Using the
76
+ * solar day instead puts the orbit about 80 km too high, and four minutes a day is not a rounding
77
+ * error when a dish is pointed at it.
78
+ */
79
+ function geostationaryOrbit(body, sf = 4) {
80
+ if (body.rotationPeriodS === void 0) throw new RangeError(`${body.name} has no rotation period, so no synchronous orbit is defined`);
81
+ const T = body.rotationPeriodS;
82
+ const radius = orbitRadiusForPeriod(body.mu, T);
83
+ const worked = calc().step("\\frac{GMm}{r^2} = m\\omega^2 r,\\quad \\omega = \\frac{2\\pi}{T}", "the orbit must keep step with the ground below it").step("r^3 = \\frac{GMT^2}{4\\pi^2}", "which is Kepler III with the period chosen rather than measured").step(`r = \\sqrt[3]{\\frac{${texSigFigs(body.mu, sf)} \\times (${texSigFigs(T, sf)})^2}{4\\pi^2}} = ${texSigFigs(radius, sf)}\\ \\mathrm{m}`, `T is the SIDEREAL day, ${texSigFigs(T, 6)} s, not 86400`).step(`h = r - R = ${texSigFigs(radius - body.radius, sf)}\\ \\mathrm{m}`, "the question almost always wants the HEIGHT, and the equation gives the radius").done(radius);
84
+ return {
85
+ radius,
86
+ height: radius - body.radius,
87
+ speed: orbitalSpeed(body.mu, radius),
88
+ worked
89
+ };
90
+ }
91
+ /**
92
+ * The three energy stores of a circular orbit, in joules.
93
+ *
94
+ * The relations `E = −E_k` and `E_p = 2E` fall straight out and are the most useful shortcut in the
95
+ * topic: given any one of the three you have the other two without touching a formula. The binding
96
+ * energy is returned alongside because "how much more energy to escape from here?" is the standard
97
+ * follow-up, and the answer is just the total with its sign flipped.
98
+ */
99
+ function orbitalEnergy(mu, mass, radius) {
100
+ const r = positive(radius, "radius");
101
+ const m = positive(mass, "mass");
102
+ const kinetic = mu * m / (2 * r);
103
+ const potential = gravitationalPotentialEnergy(mu, m, r);
104
+ const total = kinetic + potential;
105
+ return {
106
+ kinetic,
107
+ potential,
108
+ total,
109
+ bindingEnergy: -total
110
+ };
111
+ }
112
+ /**
113
+ * The same, worked, ending on the paradox.
114
+ *
115
+ * The last two steps are the point of the function. A satellite moved to a higher orbit has MORE
116
+ * total energy and LESS kinetic energy, so it is moving more slowly despite the engine having fired.
117
+ * Stating that as a consequence of `E = −E_k` turns it from a piece of space-flight trivia into an
118
+ * unavoidable arithmetic fact, which is the difference between a student remembering it and not.
119
+ */
120
+ function orbitalEnergySteps(mu, mass, radius, sf = 3) {
121
+ const e = orbitalEnergy(mu, mass, radius);
122
+ return calc().step("E_k = \\tfrac{1}{2}mv^2 = \\tfrac{1}{2}m\\cdot\\frac{GM}{r} = \\frac{GMm}{2r}", "using the orbital speed").step("E_p = -\\frac{GMm}{r}", "measured from infinity, so negative").step(`E = E_k + E_p = -\\frac{GMm}{2r} = ${texSigFigs(e.total, sf)}\\ \\mathrm{J}`, "NEGATIVE, and that is what \"bound\" means: you cannot leave without being given energy").step("E = -E_k, \\qquad E_p = 2E", "so any one of the three gives you the other two. Worth more than it looks in an exam").step(`\\text{to escape: } ${texSigFigs(e.bindingEnergy, sf)}\\ \\mathrm{J}`, "exactly the total energy with its sign flipped, since escape means reaching zero").step("r \\uparrow \\Rightarrow E \\uparrow \\text{ but } E_k \\downarrow", "raising an orbit costs energy and leaves the satellite moving SLOWER. To catch something ahead of you, slow down").done(e.total);
123
+ }
124
+ /**
125
+ * The vis-viva equation: `v² = mu(2/r − 1/a)`.
126
+ *
127
+ * THE MOST POWERFUL SINGLE EQUATION IN ORBITAL MECHANICS, and it contains almost everything above as
128
+ * special cases. Put `a = r` and it gives the circular speed. Let `a → ∞` and it gives escape speed.
129
+ * Anything elliptical is the general case. A learner who meets it after the special cases sees six
130
+ * formulas collapse into one, which is the moment the topic stops being a list.
131
+ *
132
+ * `a` is the semi-major axis, and for a hyperbolic path it is negative, which the formula handles
133
+ * without a special case.
134
+ */
135
+ function visViva(mu, radius, semiMajorAxis) {
136
+ const r = positive(radius, "radius");
137
+ const speedSquared = positive(mu, "gravitational parameter") * (2 / r - 1 / semiMajorAxis);
138
+ if (speedSquared < 0) throw new RangeError("that radius lies outside the orbit described");
139
+ return Math.sqrt(speedSquared);
140
+ }
141
+ /**
142
+ * What happens to something launched HORIZONTALLY at a given speed from a given radius.
143
+ *
144
+ * The ladder every textbook prints as five separate cases, computed from one comparison. Below the
145
+ * circular speed the ellipse it enters has its far side inside the planet, so it comes down;
146
+ * exactly at it, a circle; between that and escape, an ellipse rising on the far side; exactly at
147
+ * escape, a parabola; above, a hyperbola that never returns.
148
+ *
149
+ * The tolerance matters: floating point will never hand you exactly the circular speed, so "circular"
150
+ * has to mean "within a whisker", and a lab that tests for equality will report an ellipse forever.
151
+ */
152
+ function trajectoryKind(mu, radius, speed, tolerance = 1e-9) {
153
+ const r = positive(radius, "radius");
154
+ const circular = orbitalSpeed(mu, r);
155
+ const escape = escapeSpeed(mu, r);
156
+ if (Math.abs(speed - circular) <= tolerance * circular) return "circular";
157
+ if (Math.abs(speed - escape) <= tolerance * escape) return "parabolic";
158
+ if (speed > escape) return "hyperbolic";
159
+ if (speed < circular) return 2 * (1 / (2 / r - speed * speed / mu)) - r < r ? "sub-orbital" : "elliptical";
160
+ return "elliptical";
161
+ }
162
+ /**
163
+ * A Hohmann transfer between two circular orbits: the cheapest two-burn route, and the reason
164
+ * launch windows exist.
165
+ *
166
+ * Two burns, at opposite ends of an ellipse that just touches both circles. Returns each burn's
167
+ * `Δv` and the transfer time, which is half the ellipse's period. Beyond most school syllabuses and
168
+ * included because it is the first question a curious student asks after "what is an orbit", and
169
+ * because it is where the raise-your-orbit-and-slow-down paradox becomes operational: both burns
170
+ * are prograde, both add energy, and you arrive moving more slowly than you set off.
171
+ */
172
+ function hohmannTransfer(mu, fromRadius, toRadius) {
173
+ const r1 = positive(fromRadius, "radius");
174
+ const r2 = positive(toRadius, "radius");
175
+ const a = (r1 + r2) / 2;
176
+ const burn1 = Math.abs(visViva(mu, r1, a) - orbitalSpeed(mu, r1));
177
+ const burn2 = Math.abs(orbitalSpeed(mu, r2) - visViva(mu, r2, a));
178
+ return {
179
+ burn1,
180
+ burn2,
181
+ totalDeltaV: burn1 + burn2,
182
+ transferTimeS: Math.PI * Math.sqrt(a ** 3 / mu),
183
+ semiMajorAxis: a
184
+ };
185
+ }
186
+ /**
187
+ * The speed of a satellite skimming the surface, and the period it would have.
188
+ *
189
+ * `v = √(gR)`, about 7.9 km/s for the Earth, and 84 minutes to go round. Worth its own function
190
+ * because it is the natural unit of the whole topic: every real orbit is slower than this and every
191
+ * escape is `√2` faster, so a learner with this one number in their head can sanity-check anything.
192
+ * It is also the same 84 minutes as `spinPeriodForWeightlessness`, for the same reason.
193
+ */
194
+ function surfaceSkimmingOrbit(body) {
195
+ return {
196
+ speed: Math.sqrt(surfaceGravity(body) * body.radius),
197
+ periodS: orbitalPeriod(body.mu, body.radius)
198
+ };
199
+ }
200
+
201
+ //#endregion
202
+ export { geostationaryOrbit, hohmannTransfer, orbitRadiusForPeriod, orbitalEnergy, orbitalEnergySteps, orbitalPeriod, orbitalSpeed, orbitalSpeedSteps, surfaceSkimmingOrbit, trajectoryKind, visViva };
@@ -0,0 +1,114 @@
1
+ import { Worked } from "../../core/worked.mjs";
2
+ import { CentralBody } from "./body.mjs";
3
+
4
+ //#region src/physics/gravitation/potential.d.ts
5
+ /**
6
+ * Gravitational field strength at a distance from a point or spherical mass: `E = mu/r²`.
7
+ *
8
+ * Numerically identical to the free-fall acceleration there, and that identity is worth naming
9
+ * rather than leaving implicit: N/kg and m/s² are the same unit, and the two names exist because the
10
+ * quantity answers two different questions. Returned as a positive magnitude; the direction is
11
+ * always towards the mass, which is the one thing gravity never varies.
12
+ */
13
+ declare const gravitationalFieldStrength: (mu: number, distance: number) => number;
14
+ /**
15
+ * Gravitational potential at a distance: `V = −mu/r`, in J/kg.
16
+ *
17
+ * NEGATIVE, and increasing towards zero as you move away. Per kilogram, so it is a property of the
18
+ * PLACE and not of whatever you put there, which is what makes it worth defining at all.
19
+ */
20
+ declare const gravitationalPotential: (mu: number, distance: number) => number;
21
+ /**
22
+ * The potential energy of a mass at a distance: `U = −mu·m/r`, in joules.
23
+ *
24
+ * Distinct from `gravitationalPE` in `energy/store.ts`, and the pair is worth holding side by side:
25
+ * that one is `mgh` measured from a level you chose and can be positive or negative, this one is
26
+ * measured from infinity and is always negative. They are the same quantity under different
27
+ * conventions, and `gravitationalWork` in that file shows one collapsing into the other.
28
+ */
29
+ declare const gravitationalPotentialEnergy: (mu: number, mass: number, distance: number) => number;
30
+ /**
31
+ * The potential difference between two radii, and the work per kilogram it represents.
32
+ *
33
+ * `ΔV = V_b − V_a = mu(1/r_a − 1/r_b)`. Positive when moving outwards, because you are paying off
34
+ * debt. The sign discipline here is the whole of the topic's marking: a question asking for "the
35
+ * work done in moving a mass from A to B" wants `m·ΔV`, and the commonest error is taking the
36
+ * difference the wrong way round and reporting a rescue mission as an energy source.
37
+ */
38
+ declare function potentialDifference(mu: number, fromRadius: number, toRadius: number, sf?: number): Worked;
39
+ /** Where a point sits relative to a body, which is what decides which formula applies. */
40
+ type ShellRegion = 'inside' | 'surface' | 'outside';
41
+ /**
42
+ * Field and potential of a thin HOLLOW SHELL, in every region.
43
+ *
44
+ * The full statement of the theorem as a single function, because the discontinuity is the lesson:
45
+ * the field jumps from zero to its full surface value as you cross the wall, while the potential
46
+ * passes through smoothly. A graph of the two, drawn together, is the single most useful picture in
47
+ * the topic and a lab can draw it straight from this.
48
+ */
49
+ declare function shellFieldAndPotential(shellMass: number, shellRadius: number, distance: number, G?: number): {
50
+ field: number;
51
+ potential: number;
52
+ region: ShellRegion;
53
+ };
54
+ /**
55
+ * Field and potential of a SOLID sphere of uniform density, in every region.
56
+ *
57
+ * Outside, it is a point mass. Inside, only the sphere beneath you counts, which gives a field
58
+ * rising LINEARLY from zero at the centre, and a potential following
59
+ *
60
+ * V = −GM(3R² − r²) / 2R³
61
+ *
62
+ * which at the centre is `−3GM/2R`, one and a half times the surface value. That factor of 3/2 is a
63
+ * favourite exam number and it comes from integrating the shells, not from anywhere mysterious.
64
+ */
65
+ declare function sphereFieldAndPotential(mass: number, radius: number, distance: number, G?: number): {
66
+ field: number;
67
+ potential: number;
68
+ region: ShellRegion;
69
+ };
70
+ /**
71
+ * The gravitational self-energy of a uniform sphere: `U = −3GM²/5R`.
72
+ *
73
+ * The energy released in assembling the body shell by shell from infinite dispersion, and equally
74
+ * the energy needed to disperse it again. Beyond most syllabuses, but it is where a star's heat
75
+ * comes from before fusion starts, so it is the bridge from this chapter to astrophysics, and the
76
+ * 3/5 is the same integral as the 3/2 above.
77
+ */
78
+ declare const sphereSelfEnergy: (mass: number, radius: number, G?: number) => number;
79
+ /**
80
+ * Escape speed from a distance: `v = √(2·mu/r)`.
81
+ *
82
+ * DOES NOT DEPEND ON THE ESCAPING MASS, which is the fact worth stopping on: a pebble and a
83
+ * battleship need the same 11.2 km/s. The mass cancels because both the energy you must supply and
84
+ * the energy you have scale with it, and that cancellation is the same one that makes everything
85
+ * fall at the same rate.
86
+ *
87
+ * Nor does it depend on DIRECTION, as long as you miss the ground: escape is an energy condition,
88
+ * not a trajectory. Sideways at 11.2 km/s escapes exactly as well as straight up, which is the
89
+ * detail that makes it clear this is a potential-energy argument and not a ballistics one.
90
+ */
91
+ declare const escapeSpeed: (mu: number, distance: number) => number;
92
+ /**
93
+ * Escape speed from a body's surface, worked, in all three of the forms a syllabus prints.
94
+ *
95
+ * `√(2GM/R)`, `√(2gR)` and `R√(8πGρ/3)` are the same number reached from whichever pair of
96
+ * quantities a question supplies, and a student who knows only the first stalls when handed a
97
+ * density. The working shows them as one expression rewritten, not as three formulas to memorise.
98
+ *
99
+ * The final step gives the ratio to circular orbital speed, which is exactly `√2` at every radius
100
+ * around every body: escaping costs twice the KINETIC ENERGY of circling, never twice the speed.
101
+ */
102
+ declare function escapeSpeedSteps(body: CentralBody, sf?: number): Worked;
103
+ /**
104
+ * How high a body thrown up at a given speed reaches, when `g` cannot be treated as constant.
105
+ *
106
+ * `h = R / (v_e²/v² − 1)`, from energy conservation with the true `1/r` potential. The reason it
107
+ * exists is that `v²/2g` is wrong for anything fast: at 5 km/s the constant-`g` answer is about
108
+ * 1274 km and the true answer is about 1600 km, a 25% error, and the gap widens without limit as
109
+ * the speed approaches escape. Throws if the speed reaches escape speed, because then there is no
110
+ * highest point.
111
+ */
112
+ declare function riseHeight(body: CentralBody, launchSpeed: number, sf?: number): Worked;
113
+ //#endregion
114
+ export { ShellRegion, escapeSpeed, escapeSpeedSteps, gravitationalFieldStrength, gravitationalPotential, gravitationalPotentialEnergy, potentialDifference, riseHeight, shellFieldAndPotential, sphereFieldAndPotential, sphereSelfEnergy };
@@ -0,0 +1,202 @@
1
+ import { GRAVITATIONAL_CONSTANT } from "../../core/constants.mjs";
2
+ import { calc, texSigFigs } from "../../core/worked.mjs";
3
+ import { surfaceGravity } from "./body.mjs";
4
+
5
+ //#region src/physics/gravitation/potential.ts
6
+ /**
7
+ * Field, potential, the shell theorem, and escape speed.
8
+ *
9
+ * ── The hardest idea in the chapter, and it is a sign ───────────────────────────────────────────
10
+ * Gravitational potential is NEGATIVE EVERYWHERE, and students treat that as a quirk of notation to
11
+ * be memorised. It is not notation, it is the physics, and it says something a learner can feel:
12
+ * the zero of potential is at INFINITY, because that is the only place in the universe that is
13
+ * special. Every other point is somewhere you had to fall into, so getting back out costs energy,
14
+ * so you are in debt. `V = −GM/r` is a statement about a debt, and it gets deeper as you approach.
15
+ *
16
+ * This is also the answer to the question that stalls everyone: why does `mgh` have no minus sign
17
+ * and this does? Because `mgh` measures from a level YOU chose, near which the debt is roughly
18
+ * constant, and only the CHANGE was ever physical. `energy/store.ts` makes that point on the near
19
+ * side; this file makes it on the far side. They are one idea, and `gravitationalWork` there is the
20
+ * bridge: `W = GMm(1/r_a − 1/r_b)` collapses to `mgh` when the two radii barely differ.
21
+ *
22
+ * ── Why field and potential are not the same thing, said once ───────────────────────────────────
23
+ * Field is a VECTOR and goes as `1/r²`; potential is a SCALAR and goes as `1/r`. They are related by
24
+ * `E = −dV/dr`, which is the only relation in the chapter worth being able to state in words: the
25
+ * field is the STEEPNESS of the potential. A flat potential means no force, which is exactly what
26
+ * happens inside a hollow shell, and that is not a coincidence, it is the same fact twice.
27
+ *
28
+ * When several bodies act, the potentials ADD AS NUMBERS and the fields add as ARROWS. That makes
29
+ * potential the easier of the two to compute and is the reason energy methods beat force methods on
30
+ * any question with more than one source.
31
+ *
32
+ * ── The shell theorem, which everything else has been quietly assuming ──────────────────────────
33
+ * Every formula in this kernel treats a planet as a point at its centre. That is licensed by
34
+ * Newton's shell theorem, and the theorem has TWO halves, of which the second is the surprising one:
35
+ *
36
+ * 1. Outside a uniform shell, it pulls exactly as if all its mass were at the centre.
37
+ * 2. Inside it, the field is EXACTLY ZERO everywhere, not merely small and not merely at the centre.
38
+ *
39
+ * The second half is why `g` falls linearly to zero as you descend (`variation.ts`): the shell above
40
+ * you stops counting entirely. The intuition is that a nearby patch of shell pulls harder but
41
+ * subtends a smaller solid angle, and the `1/r²` in the force cancels the `r²` in the area exactly.
42
+ * Inverse-square is the only power for which that happens, which is why this is a test of the law
43
+ * and not just a consequence of it.
44
+ *
45
+ * Note the potential inside the shell is NOT zero: it is constant, at its surface value. Zero field
46
+ * means flat potential, not absent potential. Students confuse these two constantly, and the
47
+ * confusion is exactly the `E = −dV/dr` relation not being believed.
48
+ *
49
+ * Pure: no React, no pixels.
50
+ */
51
+ const positive = (value, what) => {
52
+ if (!Number.isFinite(value) || value <= 0) throw new RangeError(`${what} must be positive and finite`);
53
+ return value;
54
+ };
55
+ /**
56
+ * Gravitational field strength at a distance from a point or spherical mass: `E = mu/r²`.
57
+ *
58
+ * Numerically identical to the free-fall acceleration there, and that identity is worth naming
59
+ * rather than leaving implicit: N/kg and m/s² are the same unit, and the two names exist because the
60
+ * quantity answers two different questions. Returned as a positive magnitude; the direction is
61
+ * always towards the mass, which is the one thing gravity never varies.
62
+ */
63
+ const gravitationalFieldStrength = (mu, distance) => positive(mu, "gravitational parameter") / positive(distance, "distance") ** 2;
64
+ /**
65
+ * Gravitational potential at a distance: `V = −mu/r`, in J/kg.
66
+ *
67
+ * NEGATIVE, and increasing towards zero as you move away. Per kilogram, so it is a property of the
68
+ * PLACE and not of whatever you put there, which is what makes it worth defining at all.
69
+ */
70
+ const gravitationalPotential = (mu, distance) => -positive(mu, "gravitational parameter") / positive(distance, "distance");
71
+ /**
72
+ * The potential energy of a mass at a distance: `U = −mu·m/r`, in joules.
73
+ *
74
+ * Distinct from `gravitationalPE` in `energy/store.ts`, and the pair is worth holding side by side:
75
+ * that one is `mgh` measured from a level you chose and can be positive or negative, this one is
76
+ * measured from infinity and is always negative. They are the same quantity under different
77
+ * conventions, and `gravitationalWork` in that file shows one collapsing into the other.
78
+ */
79
+ const gravitationalPotentialEnergy = (mu, mass, distance) => -positive(mu, "gravitational parameter") * positive(mass, "mass") / positive(distance, "distance");
80
+ /**
81
+ * The potential difference between two radii, and the work per kilogram it represents.
82
+ *
83
+ * `ΔV = V_b − V_a = mu(1/r_a − 1/r_b)`. Positive when moving outwards, because you are paying off
84
+ * debt. The sign discipline here is the whole of the topic's marking: a question asking for "the
85
+ * work done in moving a mass from A to B" wants `m·ΔV`, and the commonest error is taking the
86
+ * difference the wrong way round and reporting a rescue mission as an energy source.
87
+ */
88
+ function potentialDifference(mu, fromRadius, toRadius, sf = 3) {
89
+ const a = positive(fromRadius, "radius");
90
+ const b = positive(toRadius, "radius");
91
+ const value = gravitationalPotential(mu, b) - gravitationalPotential(mu, a);
92
+ return calc().step("V = -\\frac{GM}{r}", "measured from infinity, where V is zero. So V is negative everywhere else").step("\\Delta V = V_b - V_a = GM\\left(\\frac{1}{r_a} - \\frac{1}{r_b}\\right)").step(`\\Delta V = ${texSigFigs(mu, sf)}\\left(\\frac{1}{${texSigFigs(a, sf)}} - \\frac{1}{${texSigFigs(b, sf)}}\\right)`).step(`\\Delta V = ${texSigFigs(value, sf)}\\ \\mathrm{J\\,kg^{-1}}`, value > 0 ? "positive: moving outwards, so an outside agent must do work" : "negative: moving inwards, so gravity does the work and energy is released").done(value);
93
+ }
94
+ const regionOf = (distance, radius) => distance < radius ? "inside" : distance > radius ? "outside" : "surface";
95
+ /**
96
+ * Field and potential of a thin HOLLOW SHELL, in every region.
97
+ *
98
+ * The full statement of the theorem as a single function, because the discontinuity is the lesson:
99
+ * the field jumps from zero to its full surface value as you cross the wall, while the potential
100
+ * passes through smoothly. A graph of the two, drawn together, is the single most useful picture in
101
+ * the topic and a lab can draw it straight from this.
102
+ */
103
+ function shellFieldAndPotential(shellMass, shellRadius, distance, G = GRAVITATIONAL_CONSTANT) {
104
+ const R = positive(shellRadius, "shell radius");
105
+ const r = positive(distance, "distance");
106
+ const mu = G * positive(shellMass, "mass");
107
+ const region = regionOf(r, R);
108
+ if (region === "inside") return {
109
+ field: 0,
110
+ potential: -mu / R,
111
+ region
112
+ };
113
+ return {
114
+ field: mu / (r * r),
115
+ potential: -mu / r,
116
+ region
117
+ };
118
+ }
119
+ /**
120
+ * Field and potential of a SOLID sphere of uniform density, in every region.
121
+ *
122
+ * Outside, it is a point mass. Inside, only the sphere beneath you counts, which gives a field
123
+ * rising LINEARLY from zero at the centre, and a potential following
124
+ *
125
+ * V = −GM(3R² − r²) / 2R³
126
+ *
127
+ * which at the centre is `−3GM/2R`, one and a half times the surface value. That factor of 3/2 is a
128
+ * favourite exam number and it comes from integrating the shells, not from anywhere mysterious.
129
+ */
130
+ function sphereFieldAndPotential(mass, radius, distance, G = GRAVITATIONAL_CONSTANT) {
131
+ const R = positive(radius, "radius");
132
+ const r = positive(distance, "distance");
133
+ const mu = G * positive(mass, "mass");
134
+ const region = regionOf(r, R);
135
+ if (region === "inside") return {
136
+ field: mu * r / R ** 3,
137
+ potential: -mu * (3 * R * R - r * r) / (2 * R ** 3),
138
+ region
139
+ };
140
+ return {
141
+ field: mu / (r * r),
142
+ potential: -mu / r,
143
+ region
144
+ };
145
+ }
146
+ /**
147
+ * The gravitational self-energy of a uniform sphere: `U = −3GM²/5R`.
148
+ *
149
+ * The energy released in assembling the body shell by shell from infinite dispersion, and equally
150
+ * the energy needed to disperse it again. Beyond most syllabuses, but it is where a star's heat
151
+ * comes from before fusion starts, so it is the bridge from this chapter to astrophysics, and the
152
+ * 3/5 is the same integral as the 3/2 above.
153
+ */
154
+ const sphereSelfEnergy = (mass, radius, G = GRAVITATIONAL_CONSTANT) => -3 * G * positive(mass, "mass") ** 2 / (5 * positive(radius, "radius"));
155
+ /**
156
+ * Escape speed from a distance: `v = √(2·mu/r)`.
157
+ *
158
+ * DOES NOT DEPEND ON THE ESCAPING MASS, which is the fact worth stopping on: a pebble and a
159
+ * battleship need the same 11.2 km/s. The mass cancels because both the energy you must supply and
160
+ * the energy you have scale with it, and that cancellation is the same one that makes everything
161
+ * fall at the same rate.
162
+ *
163
+ * Nor does it depend on DIRECTION, as long as you miss the ground: escape is an energy condition,
164
+ * not a trajectory. Sideways at 11.2 km/s escapes exactly as well as straight up, which is the
165
+ * detail that makes it clear this is a potential-energy argument and not a ballistics one.
166
+ */
167
+ const escapeSpeed = (mu, distance) => Math.sqrt(2 * positive(mu, "gravitational parameter") / positive(distance, "distance"));
168
+ /**
169
+ * Escape speed from a body's surface, worked, in all three of the forms a syllabus prints.
170
+ *
171
+ * `√(2GM/R)`, `√(2gR)` and `R√(8πGρ/3)` are the same number reached from whichever pair of
172
+ * quantities a question supplies, and a student who knows only the first stalls when handed a
173
+ * density. The working shows them as one expression rewritten, not as three formulas to memorise.
174
+ *
175
+ * The final step gives the ratio to circular orbital speed, which is exactly `√2` at every radius
176
+ * around every body: escaping costs twice the KINETIC ENERGY of circling, never twice the speed.
177
+ */
178
+ function escapeSpeedSteps(body, sf = 3) {
179
+ const g = surfaceGravity(body);
180
+ const value = escapeSpeed(body.mu, body.radius);
181
+ return calc().step("\\tfrac{1}{2}mv^2 = \\frac{GMm}{R}", "give it exactly enough kinetic energy to pay off the whole potential debt, arriving at infinity with nothing left").step("v_e = \\sqrt{\\frac{2GM}{R}}", "the escaping mass m cancels. A pebble and a rocket need the same speed").step(`v_e = \\sqrt{2gR} = \\sqrt{2 \\times ${texSigFigs(g, sf)} \\times ${texSigFigs(body.radius, sf)}}`, "since g = GM/R², the same expression written from the surface gravity instead").step("v_e = R\\sqrt{\\tfrac{8}{3}\\pi G \\rho}", "and again from the density, for questions that give you what a planet is made of").step(`v_e = ${texSigFigs(value, sf)}\\ \\mathrm{m\\,s^{-1}}`).step("\\frac{v_e}{v_{orbit}} = \\sqrt{2}", "true at every radius around every body. Escape needs twice the kinetic energy of a circular orbit, not twice the speed").done(value);
182
+ }
183
+ /**
184
+ * How high a body thrown up at a given speed reaches, when `g` cannot be treated as constant.
185
+ *
186
+ * `h = R / (v_e²/v² − 1)`, from energy conservation with the true `1/r` potential. The reason it
187
+ * exists is that `v²/2g` is wrong for anything fast: at 5 km/s the constant-`g` answer is about
188
+ * 1274 km and the true answer is about 1600 km, a 25% error, and the gap widens without limit as
189
+ * the speed approaches escape. Throws if the speed reaches escape speed, because then there is no
190
+ * highest point.
191
+ */
192
+ function riseHeight(body, launchSpeed, sf = 3) {
193
+ const v = positive(launchSpeed, "speed");
194
+ const ve = escapeSpeed(body.mu, body.radius);
195
+ if (v >= ve) throw new RangeError("at or above escape speed the body never turns round");
196
+ const value = body.radius / (ve * ve / (v * v) - 1);
197
+ const naive = v * v / (2 * surfaceGravity(body));
198
+ return calc().step("\\tfrac{1}{2}mv^2 - \\frac{GMm}{R} = -\\frac{GMm}{R+h}", "all the kinetic energy has become potential at the top, where it is momentarily still").step("\\frac{v^2}{2} = GM\\left(\\frac{1}{R} - \\frac{1}{R+h}\\right)").step(`h = \\frac{R}{\\frac{v_e^2}{v^2} - 1} = \\frac{${texSigFigs(body.radius, sf)}}{${texSigFigs(ve * ve / (v * v), sf)} - 1}`).step(`h = ${texSigFigs(value, sf)}\\ \\mathrm{m}`).step(`\\text{constant-}g\\text{: } \\frac{v^2}{2g} = ${texSigFigs(naive, sf)}\\ \\mathrm{m}`, `treating g as constant is out by ${texSigFigs(100 * (value - naive) / value, 2)}% here, because g weakens on the way up`).done(value);
199
+ }
200
+
201
+ //#endregion
202
+ export { escapeSpeed, escapeSpeedSteps, gravitationalFieldStrength, gravitationalPotential, gravitationalPotentialEnergy, potentialDifference, riseHeight, shellFieldAndPotential, sphereFieldAndPotential, sphereSelfEnergy };