@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,127 @@
1
+ import { Worked } from "../../core/worked.mjs";
2
+
3
+ //#region src/physics/gravitation/kepler.d.ts
4
+ /** The nearest and furthest points of an orbit: `r_p = a(1−e)`, `r_a = a(1+e)`. */
5
+ declare function apsides(semiMajorAxis: number, eccentricity: number): {
6
+ periapsis: number;
7
+ apoapsis: number;
8
+ };
9
+ /**
10
+ * The orbit implied by its two extremes: `a = (r_p + r_a)/2`, `e = (r_a − r_p)/(r_a + r_p)`.
11
+ *
12
+ * The direction real questions run in, since what gets measured is the closest and furthest
13
+ * distance. Note `a` is the plain AVERAGE of the two, which is a genuinely useful thing to know and
14
+ * is not obvious from the picture.
15
+ */
16
+ declare function orbitFromApsides(periapsis: number, apoapsis: number): {
17
+ semiMajorAxis: number;
18
+ eccentricity: number;
19
+ };
20
+ /** Semi-minor axis, `b = a√(1−e²)`. How little an eccentric ellipse differs from a circle. */
21
+ declare const semiMinorAxis: (semiMajorAxis: number, eccentricity: number) => number;
22
+ /**
23
+ * The speeds at the two apsides, and the check that `r_p v_p = r_a v_a`.
24
+ *
25
+ * At perihelion and aphelion alone, the velocity is perpendicular to the radius, so angular momentum
26
+ * is simply `mvr` and the ratio of speeds is the inverse ratio of distances. That is why the Earth
27
+ * moves about 3.4% faster in January than in July: `r_a/r_p` is 1.034, and the reference books quote
28
+ * exactly that number.
29
+ *
30
+ * The speeds themselves come from `visViva`, not from a separate apsis formula, because there is no
31
+ * separate apsis formula: it is the general equation at two particular radii.
32
+ */
33
+ declare function apsisSpeeds(mu: number, semiMajorAxis: number, eccentricity: number, sf?: number): {
34
+ periapsisSpeed: number;
35
+ apoapsisSpeed: number;
36
+ worked: Worked;
37
+ };
38
+ /**
39
+ * Areal velocity, `dA/dt = L/2m = ½√(mu·a(1−e²))`, in m²/s.
40
+ *
41
+ * Constant around the whole orbit, which is the exact content of the second law. Exposed as a number
42
+ * so that a lab can shade two swept wedges at different parts of an orbit and show their areas
43
+ * agreeing, which is the only way the law becomes believable rather than recited.
44
+ */
45
+ declare const arealVelocity: (mu: number, semiMajorAxis: number, eccentricity: number) => number;
46
+ /** Specific angular momentum, `h = √(mu·a(1−e²))`, m²/s. Twice the areal velocity, by definition. */
47
+ declare const specificAngularMomentum: (mu: number, semiMajorAxis: number, eccentricity: number) => number;
48
+ /** Period of any orbit, circular or elliptical, from its semi-major axis: `T = 2π√(a³/mu)`. */
49
+ declare const periodFromAxis: (mu: number, semiMajorAxis: number) => number;
50
+ /** The semi-major axis of an orbit with a given period: `a = (mu·T²/4π²)^{1/3}`. */
51
+ declare const axisFromPeriod: (mu: number, period: number) => number;
52
+ /**
53
+ * The third law as a RATIO, needing no constant, no mass and no SI units: `T₂ = T₁(a₂/a₁)^{3/2}`.
54
+ *
55
+ * The form to use whenever a question gives you one orbit and asks about another, which is most of
56
+ * them. Units cancel, so days and astronomical units are as good as seconds and metres, and a
57
+ * learner who converts everything to SI first has done real work for no marks.
58
+ */
59
+ declare function keplerRatio(knownPeriod: number, knownAxis: number, targetAxis: number, sf?: number): Worked;
60
+ /**
61
+ * The mass of a central body from ANY orbit around it: `M = 4π²a³/GT²`.
62
+ *
63
+ * How everything in the sky has ever been weighed. Point a telescope at a moon, time one circuit,
64
+ * measure the distance, and the planet's mass drops out. It is worth pausing on what is NOT needed:
65
+ * you never go there, you never touch it, and the orbiting body's own mass cancels and is never
66
+ * required either.
67
+ *
68
+ * Returns the mass, with `mu` alongside, since `mu` is the honest quantity: `mu = 4π²a³/T²` is
69
+ * measured directly and accurately, and dividing by `G` to get `M` throws away six figures of it.
70
+ */
71
+ declare function centralMassFromOrbit(semiMajorAxis: number, period: number, G?: number, sf?: number): {
72
+ mass: number;
73
+ mu: number;
74
+ worked: Worked;
75
+ };
76
+ /**
77
+ * The synodic period: how often two orbiting bodies line up again. `1/T_syn = |1/T₁ − 1/T₂|`.
78
+ *
79
+ * The difference between a year and the time between two oppositions of Mars, and the reason launch
80
+ * windows to Mars come round every 26 months rather than every 12 or 23. It is a beat frequency,
81
+ * exactly like two waves of different pitch, which is a connection worth making across topics.
82
+ */
83
+ declare function synodicPeriod(period1: number, period2: number): number;
84
+ /**
85
+ * Kepler's equation, `M = E − e·sin E`, solved for the eccentric anomaly by Newton-Raphson.
86
+ *
87
+ * THE OLDEST UNSOLVED-IN-CLOSED-FORM PROBLEM in the syllabus, and worth telling students about:
88
+ * there is no way to rearrange it, and every planetarium in the world iterates. Kepler himself said
89
+ * he could see no method and invited someone else to find one; nobody has, and it was later proved
90
+ * impossible in elementary functions.
91
+ *
92
+ * Migrated from `labs/src/physics/orbital/core.ts`, which owned it privately. The starting guess is
93
+ * `π` for high eccentricity rather than `M`, because `M` converges slowly for the elongated orbits
94
+ * where the equation matters most.
95
+ */
96
+ declare function solveEccentricAnomaly(meanAnomaly: number, eccentricity: number, tolerance?: number, maxIterations?: number): number;
97
+ /** Where a body is, and how fast, at a given point in its orbit. */
98
+ interface OrbitPoint {
99
+ readonly x: number;
100
+ readonly y: number;
101
+ /** Distance from the focus, m. */
102
+ readonly radius: number;
103
+ /** Angle from periapsis as seen FROM THE FOCUS, radians. The physically meaningful angle. */
104
+ readonly trueAnomaly: number;
105
+ readonly eccentricAnomaly: number;
106
+ }
107
+ /**
108
+ * Position on an ellipse at a given mean anomaly, with the attracting body at the ORIGIN.
109
+ *
110
+ * The origin is the FOCUS, not the centre of the ellipse, which is Kepler's first law expressed as a
111
+ * coordinate choice rather than as a sentence. Drawing an orbit with the planet at the centre is the
112
+ * commonest illustration error in textbooks and it makes the second law look arbitrary.
113
+ *
114
+ * Mean anomaly advances uniformly with time (`M = 2πt/T`), which is what makes this drawable from a
115
+ * clock: a lab steps the mean anomaly linearly and the body visibly hurries through periapsis
116
+ * without anything in the animation code knowing why.
117
+ */
118
+ declare function orbitPointAtMeanAnomaly(semiMajorAxis: number, eccentricity: number, meanAnomaly: number): OrbitPoint;
119
+ /**
120
+ * The same, but from a TIME and a period rather than an anomaly, which is what an animation has.
121
+ *
122
+ * `t = 0` is periapsis. A lab driving this from its clock gets Kepler's second law for free: no part
123
+ * of the rendering has to know that the body should speed up, it simply does.
124
+ */
125
+ declare function orbitPointAtTime(semiMajorAxis: number, eccentricity: number, timeS: number, periodS: number): OrbitPoint;
126
+ //#endregion
127
+ export { OrbitPoint, apsides, apsisSpeeds, arealVelocity, axisFromPeriod, centralMassFromOrbit, keplerRatio, orbitFromApsides, orbitPointAtMeanAnomaly, orbitPointAtTime, periodFromAxis, semiMinorAxis, solveEccentricAnomaly, specificAngularMomentum, synodicPeriod };
@@ -0,0 +1,216 @@
1
+ import { GRAVITATIONAL_CONSTANT } from "../../core/constants.mjs";
2
+ import { calc, texSigFigs } from "../../core/worked.mjs";
3
+ import { visViva } from "./orbit.mjs";
4
+
5
+ //#region src/physics/gravitation/kepler.ts
6
+ /**
7
+ * Kepler's three laws, and the ellipse machinery that makes them drawable.
8
+ *
9
+ * ── The laws are older than the explanation, and that is the lesson ─────────────────────────────
10
+ * Kepler extracted these from Tycho Brahe's naked-eye positions decades before Newton, by brute
11
+ * arithmetic and twenty years of failure. They are a DESCRIPTION. Newton's law is the EXPLANATION,
12
+ * and all three then fall out of it in a few lines. Teaching them in that order is worth the effort:
13
+ * it is the clearest example in a school syllabus of a pattern being found first and understood
14
+ * afterwards, which is how science usually goes and almost never how it is taught.
15
+ *
16
+ * ── What each law actually says once you strip the astronomy off ────────────────────────────────
17
+ * I. Orbits are ellipses with the Sun at ONE FOCUS. Not at the centre. The distinction is the
18
+ * whole law: at the centre would be a trivial rescaling of a circle and would predict
19
+ * nothing, whereas a focus is off-centre and forces the planet to vary its distance.
20
+ *
21
+ * II. The line to the Sun sweeps equal AREAS in equal times, so a planet hurries at perihelion
22
+ * and dawdles at aphelion. This is CONSERVATION OF ANGULAR MOMENTUM and nothing else. That
23
+ * identity is rarely stated and it is the most valuable sentence in the topic: the areal
24
+ * velocity is `L/2m`, so the second law is not an astronomical fact at all, it holds for any
25
+ * central force whatsoever, inverse-square or not.
26
+ *
27
+ * III. `T² ∝ a³`, with the SAME constant for everything orbiting the same body. That constant is
28
+ * `4π²/GM`, which means measuring any moon's orbit WEIGHS THE PLANET. It is the only method
29
+ * we have ever had for the mass of anything in the sky, and it is three lines of algebra.
30
+ *
31
+ * ── Why the third law needs no units if it is asked as a ratio ──────────────────────────────────
32
+ * "Mars is 1.52 AU out, how long is its year?" is `1.52^{1.5} = 1.88` years and needs no constant,
33
+ * no mass, and no metres. Students who reach for `GM` on a ratio question lose time and accuracy
34
+ * both. `keplerRatio` is that shortcut as a function, so a lesson can show it beside the long way.
35
+ *
36
+ * Pure: no React, no pixels.
37
+ */
38
+ const TAU = 2 * Math.PI;
39
+ const positive = (value, what) => {
40
+ if (!Number.isFinite(value) || value <= 0) throw new RangeError(`${what} must be positive and finite`);
41
+ return value;
42
+ };
43
+ const checkEccentricity = (e) => {
44
+ if (!(e >= 0 && e < 1)) throw new RangeError("eccentricity must be in [0, 1) for a closed orbit");
45
+ return e;
46
+ };
47
+ /** The nearest and furthest points of an orbit: `r_p = a(1−e)`, `r_a = a(1+e)`. */
48
+ function apsides(semiMajorAxis, eccentricity) {
49
+ const a = positive(semiMajorAxis, "semi-major axis");
50
+ const e = checkEccentricity(eccentricity);
51
+ return {
52
+ periapsis: a * (1 - e),
53
+ apoapsis: a * (1 + e)
54
+ };
55
+ }
56
+ /**
57
+ * The orbit implied by its two extremes: `a = (r_p + r_a)/2`, `e = (r_a − r_p)/(r_a + r_p)`.
58
+ *
59
+ * The direction real questions run in, since what gets measured is the closest and furthest
60
+ * distance. Note `a` is the plain AVERAGE of the two, which is a genuinely useful thing to know and
61
+ * is not obvious from the picture.
62
+ */
63
+ function orbitFromApsides(periapsis, apoapsis) {
64
+ const rp = positive(periapsis, "periapsis");
65
+ const ra = positive(apoapsis, "apoapsis");
66
+ if (ra < rp) throw new RangeError("apoapsis cannot be nearer than periapsis");
67
+ return {
68
+ semiMajorAxis: (rp + ra) / 2,
69
+ eccentricity: (ra - rp) / (ra + rp)
70
+ };
71
+ }
72
+ /** Semi-minor axis, `b = a√(1−e²)`. How little an eccentric ellipse differs from a circle. */
73
+ const semiMinorAxis = (semiMajorAxis, eccentricity) => positive(semiMajorAxis, "semi-major axis") * Math.sqrt(1 - checkEccentricity(eccentricity) ** 2);
74
+ /**
75
+ * The speeds at the two apsides, and the check that `r_p v_p = r_a v_a`.
76
+ *
77
+ * At perihelion and aphelion alone, the velocity is perpendicular to the radius, so angular momentum
78
+ * is simply `mvr` and the ratio of speeds is the inverse ratio of distances. That is why the Earth
79
+ * moves about 3.4% faster in January than in July: `r_a/r_p` is 1.034, and the reference books quote
80
+ * exactly that number.
81
+ *
82
+ * The speeds themselves come from `visViva`, not from a separate apsis formula, because there is no
83
+ * separate apsis formula: it is the general equation at two particular radii.
84
+ */
85
+ function apsisSpeeds(mu, semiMajorAxis, eccentricity, sf = 4) {
86
+ const a = positive(semiMajorAxis, "semi-major axis");
87
+ const { periapsis, apoapsis } = apsides(a, checkEccentricity(eccentricity));
88
+ const periapsisSpeed = visViva(mu, periapsis, a);
89
+ const apoapsisSpeed = visViva(mu, apoapsis, a);
90
+ return {
91
+ periapsisSpeed,
92
+ apoapsisSpeed,
93
+ worked: calc().step("m v_p r_p = m v_a r_a", "angular momentum is conserved, and at the apsides alone the velocity is square-on to the radius").step(`\\frac{v_p}{v_a} = \\frac{r_a}{r_p} = ${texSigFigs(apoapsis / periapsis, sf)}`, "so the nearer point is the faster one, in exactly that proportion. This IS Kepler II").step(`v_p = ${texSigFigs(periapsisSpeed, sf)}\\ \\mathrm{m\\,s^{-1}},\\quad v_a = ${texSigFigs(apoapsisSpeed, sf)}\\ \\mathrm{m\\,s^{-1}}`, "from vis-viva at each radius. There is no special apsis formula to learn").done(periapsisSpeed)
94
+ };
95
+ }
96
+ /**
97
+ * Areal velocity, `dA/dt = L/2m = ½√(mu·a(1−e²))`, in m²/s.
98
+ *
99
+ * Constant around the whole orbit, which is the exact content of the second law. Exposed as a number
100
+ * so that a lab can shade two swept wedges at different parts of an orbit and show their areas
101
+ * agreeing, which is the only way the law becomes believable rather than recited.
102
+ */
103
+ const arealVelocity = (mu, semiMajorAxis, eccentricity) => .5 * Math.sqrt(positive(mu, "gravitational parameter") * positive(semiMajorAxis, "semi-major axis") * (1 - checkEccentricity(eccentricity) ** 2));
104
+ /** Specific angular momentum, `h = √(mu·a(1−e²))`, m²/s. Twice the areal velocity, by definition. */
105
+ const specificAngularMomentum = (mu, semiMajorAxis, eccentricity) => 2 * arealVelocity(mu, semiMajorAxis, eccentricity);
106
+ /** Period of any orbit, circular or elliptical, from its semi-major axis: `T = 2π√(a³/mu)`. */
107
+ const periodFromAxis = (mu, semiMajorAxis) => TAU * Math.sqrt(positive(semiMajorAxis, "semi-major axis") ** 3 / positive(mu, "gravitational parameter"));
108
+ /** The semi-major axis of an orbit with a given period: `a = (mu·T²/4π²)^{1/3}`. */
109
+ const axisFromPeriod = (mu, period) => Math.cbrt(positive(mu, "gravitational parameter") * positive(period, "period") ** 2 / (TAU * TAU));
110
+ /**
111
+ * The third law as a RATIO, needing no constant, no mass and no SI units: `T₂ = T₁(a₂/a₁)^{3/2}`.
112
+ *
113
+ * The form to use whenever a question gives you one orbit and asks about another, which is most of
114
+ * them. Units cancel, so days and astronomical units are as good as seconds and metres, and a
115
+ * learner who converts everything to SI first has done real work for no marks.
116
+ */
117
+ function keplerRatio(knownPeriod, knownAxis, targetAxis, sf = 4) {
118
+ const ratio = positive(targetAxis, "axis") / positive(knownAxis, "axis");
119
+ const value = positive(knownPeriod, "period") * ratio ** 1.5;
120
+ return calc().step("\\frac{T_1^2}{a_1^3} = \\frac{T_2^2}{a_2^3}", "the same constant for everything orbiting the same body").step("T_2 = T_1\\left(\\frac{a_2}{a_1}\\right)^{3/2}", "no G, no mass, and no need for SI: whatever units the periods are in, the answer comes back in").step(`T_2 = ${texSigFigs(knownPeriod, sf)} \\times (${texSigFigs(ratio, sf)})^{3/2}`).step(`T_2 = ${texSigFigs(value, sf)}`).done(value);
121
+ }
122
+ /**
123
+ * The mass of a central body from ANY orbit around it: `M = 4π²a³/GT²`.
124
+ *
125
+ * How everything in the sky has ever been weighed. Point a telescope at a moon, time one circuit,
126
+ * measure the distance, and the planet's mass drops out. It is worth pausing on what is NOT needed:
127
+ * you never go there, you never touch it, and the orbiting body's own mass cancels and is never
128
+ * required either.
129
+ *
130
+ * Returns the mass, with `mu` alongside, since `mu` is the honest quantity: `mu = 4π²a³/T²` is
131
+ * measured directly and accurately, and dividing by `G` to get `M` throws away six figures of it.
132
+ */
133
+ function centralMassFromOrbit(semiMajorAxis, period, G = GRAVITATIONAL_CONSTANT, sf = 4) {
134
+ const a = positive(semiMajorAxis, "semi-major axis");
135
+ const T = positive(period, "period");
136
+ const mu = 4 * Math.PI ** 2 * a ** 3 / (T * T);
137
+ const mass = mu / G;
138
+ return {
139
+ mass,
140
+ mu,
141
+ worked: calc().step("\\frac{GMm}{a^2} = \\frac{4\\pi^2 m a}{T^2}", "gravity supplying the centripetal requirement, with omega written as 2 pi over T").step("M = \\frac{4\\pi^2 a^3}{G T^2}", "the ORBITING mass cancels, so a pebble weighs the planet as well as a moon does").step(`GM = \\frac{4\\pi^2 (${texSigFigs(a, sf)})^3}{(${texSigFigs(T, sf)})^2} = ${texSigFigs(mu, sf)}\\ \\mathrm{m^3\\,s^{-2}}`, "this product is what the measurement actually gives you, and it is good to many figures").step(`M = ${texSigFigs(mass, sf)}\\ \\mathrm{kg}`, "dividing by G costs most of that precision, because G is the worst-known constant in physics").done(mass)
142
+ };
143
+ }
144
+ /**
145
+ * The synodic period: how often two orbiting bodies line up again. `1/T_syn = |1/T₁ − 1/T₂|`.
146
+ *
147
+ * The difference between a year and the time between two oppositions of Mars, and the reason launch
148
+ * windows to Mars come round every 26 months rather than every 12 or 23. It is a beat frequency,
149
+ * exactly like two waves of different pitch, which is a connection worth making across topics.
150
+ */
151
+ function synodicPeriod(period1, period2) {
152
+ const difference = Math.abs(1 / positive(period1, "period") - 1 / positive(period2, "period"));
153
+ if (difference === 0) return Infinity;
154
+ return 1 / difference;
155
+ }
156
+ /**
157
+ * Kepler's equation, `M = E − e·sin E`, solved for the eccentric anomaly by Newton-Raphson.
158
+ *
159
+ * THE OLDEST UNSOLVED-IN-CLOSED-FORM PROBLEM in the syllabus, and worth telling students about:
160
+ * there is no way to rearrange it, and every planetarium in the world iterates. Kepler himself said
161
+ * he could see no method and invited someone else to find one; nobody has, and it was later proved
162
+ * impossible in elementary functions.
163
+ *
164
+ * Migrated from `labs/src/physics/orbital/core.ts`, which owned it privately. The starting guess is
165
+ * `π` for high eccentricity rather than `M`, because `M` converges slowly for the elongated orbits
166
+ * where the equation matters most.
167
+ */
168
+ function solveEccentricAnomaly(meanAnomaly, eccentricity, tolerance = 1e-12, maxIterations = 30) {
169
+ const e = checkEccentricity(eccentricity);
170
+ const turns = Math.floor(meanAnomaly / TAU);
171
+ const normalised = meanAnomaly - turns * TAU;
172
+ let anomaly = e < .8 ? normalised : Math.PI;
173
+ for (let iteration = 0; iteration < maxIterations; iteration++) {
174
+ const delta = (anomaly - e * Math.sin(anomaly) - normalised) / (1 - e * Math.cos(anomaly));
175
+ anomaly -= delta;
176
+ if (Math.abs(delta) <= tolerance) break;
177
+ }
178
+ return anomaly + turns * TAU;
179
+ }
180
+ /**
181
+ * Position on an ellipse at a given mean anomaly, with the attracting body at the ORIGIN.
182
+ *
183
+ * The origin is the FOCUS, not the centre of the ellipse, which is Kepler's first law expressed as a
184
+ * coordinate choice rather than as a sentence. Drawing an orbit with the planet at the centre is the
185
+ * commonest illustration error in textbooks and it makes the second law look arbitrary.
186
+ *
187
+ * Mean anomaly advances uniformly with time (`M = 2πt/T`), which is what makes this drawable from a
188
+ * clock: a lab steps the mean anomaly linearly and the body visibly hurries through periapsis
189
+ * without anything in the animation code knowing why.
190
+ */
191
+ function orbitPointAtMeanAnomaly(semiMajorAxis, eccentricity, meanAnomaly) {
192
+ const a = positive(semiMajorAxis, "semi-major axis");
193
+ const e = checkEccentricity(eccentricity);
194
+ const eccentricAnomaly = solveEccentricAnomaly(meanAnomaly, e);
195
+ const x = a * (Math.cos(eccentricAnomaly) - e);
196
+ const y = a * Math.sqrt(1 - e * e) * Math.sin(eccentricAnomaly);
197
+ return {
198
+ x,
199
+ y,
200
+ radius: a * (1 - e * Math.cos(eccentricAnomaly)),
201
+ trueAnomaly: Math.atan2(y, x),
202
+ eccentricAnomaly
203
+ };
204
+ }
205
+ /**
206
+ * The same, but from a TIME and a period rather than an anomaly, which is what an animation has.
207
+ *
208
+ * `t = 0` is periapsis. A lab driving this from its clock gets Kepler's second law for free: no part
209
+ * of the rendering has to know that the body should speed up, it simply does.
210
+ */
211
+ function orbitPointAtTime(semiMajorAxis, eccentricity, timeS, periodS) {
212
+ return orbitPointAtMeanAnomaly(semiMajorAxis, eccentricity, TAU * timeS / positive(periodS, "period"));
213
+ }
214
+
215
+ //#endregion
216
+ export { apsides, apsisSpeeds, arealVelocity, axisFromPeriod, centralMassFromOrbit, keplerRatio, orbitFromApsides, orbitPointAtMeanAnomaly, orbitPointAtTime, periodFromAxis, semiMinorAxis, solveEccentricAnomaly, specificAngularMomentum, synodicPeriod };
@@ -0,0 +1,117 @@
1
+ import { Worked } from "../../core/worked.mjs";
2
+ import { Polar } from "../vectors.mjs";
3
+
4
+ //#region src/physics/gravitation/law.d.ts
5
+ /**
6
+ * The attraction between two point masses: `F = Gm₁m₂/r²`.
7
+ *
8
+ * `separation` is measured CENTRE TO CENTRE, which is the assumption doing the most quiet work in
9
+ * the chapter: a planet is not a point, and the only reason it may be treated as one is the shell
10
+ * theorem, proved in `potential.ts`. A question about a mass on the surface uses the planet's
11
+ * RADIUS, not the height above the ground, and that substitution is where answers go wrong by
12
+ * factors of millions.
13
+ */
14
+ declare function gravitationalForce(mass1: number, mass2: number, separation: number, G?: number): number;
15
+ /**
16
+ * The same, showing its working.
17
+ *
18
+ * Split from the bare value deliberately, and the split is not stylistic. A lab redrawing a force
19
+ * arrow as a learner drags a satellite calls this sixty times a second, and building a LaTeX
20
+ * derivation on every frame to throw it away is waste that shows up as dropped frames on a
21
+ * mid-range phone. Every function in this kernel that has both forms follows the same rule: the
22
+ * bare one for the pixels, the `Steps` one for the page.
23
+ */
24
+ declare function gravitationalForceSteps(mass1: number, mass2: number, separation: number, G?: number, sf?: number): Worked;
25
+ /**
26
+ * How the force changes when the separation is scaled: `F' / F = 1/k²`.
27
+ *
28
+ * A ratio, so no constant and no masses. Named because "three times as far is a NINTH of the pull"
29
+ * is the sentence the inverse square law is, and it is worth a function that can be shown rather
30
+ * than a fact to be asserted.
31
+ */
32
+ declare function inverseSquareFactor(distanceFactor: number): number;
33
+ /** A point source of gravity at a position in the plane. */
34
+ interface GravitySource {
35
+ readonly name?: string;
36
+ readonly mass: number;
37
+ readonly x: number;
38
+ readonly y: number;
39
+ }
40
+ /** The pull from each source, plus the vector sum. */
41
+ interface NetGravity {
42
+ /** One entry per source, in the order given. */
43
+ readonly contributions: readonly (Polar & {
44
+ readonly from: string;
45
+ })[];
46
+ readonly x: number;
47
+ readonly y: number;
48
+ /** The resultant, as a size and a direction above the horizontal. */
49
+ readonly resultant: Polar;
50
+ }
51
+ /**
52
+ * The net gravitational force on a mass at a point, from any number of sources.
53
+ *
54
+ * THE FUNCTION THIS FILE EXISTS FOR. Each source contributes an attraction along the line joining
55
+ * it, and the answer is the vector sum, recombined by `compose` so that the resultant's DIRECTION
56
+ * comes out alongside its size. A question that asks only for the magnitude is still a vector
57
+ * question, and answering it by adding two numbers is the error this is built to make visible: the
58
+ * Sun pulls the Moon about twice as hard as the Earth does, yet the Moon orbits the Earth, and the
59
+ * reconciliation is entirely in the directions.
60
+ */
61
+ declare function netGravitationalForce(at: {
62
+ readonly x: number;
63
+ readonly y: number;
64
+ readonly mass: number;
65
+ }, sources: readonly GravitySource[], G?: number): NetGravity;
66
+ /**
67
+ * Where the pull of two bodies cancels, measured from the FIRST: `d₁ = d / (1 + √(M₂/M₁))`.
68
+ *
69
+ * The neutral point, and a question that needs neither `G` nor either mass on its own. Both cancel
70
+ * when the forces are set equal, leaving only the square root of the mass ratio, which is why the
71
+ * Earth-Moon point sits at nine tenths rather than at the middle: the Earth is 81 times heavier and
72
+ * √81 is 9, not 81.
73
+ *
74
+ * Note the point is nearer the LIGHTER body, which students consistently get backwards on instinct.
75
+ */
76
+ declare function nullPoint(mass1: number, mass2: number, separation: number, sf?: number): Worked;
77
+ /**
78
+ * The tidal (differential) acceleration across a body of given size: `Δg ≈ 2·mu·s / d³`.
79
+ *
80
+ * The stretch a distant mass applies, which is what a tide actually is. The `1/d³` is the whole
81
+ * story and is worth deriving in front of a student: differentiate `mu/d²` and the power drops.
82
+ *
83
+ * `size` is the half-width, so pass the Earth's RADIUS for the ocean bulge on one side, and the
84
+ * factor of 2 accounts for the far side being stretched outwards just as the near side is pulled
85
+ * inwards. That symmetry is why there are two high tides a day and not one, which is the question
86
+ * every learner asks and almost no textbook answers.
87
+ */
88
+ declare function tidalAcceleration(mu: number, distance: number, size: number): number;
89
+ /**
90
+ * How much bigger a tide one body raises than another: the comparison that settles the Sun-Moon
91
+ * argument.
92
+ *
93
+ * The Sun pulls the Earth about 175 times harder than the Moon does, and yet raises a tide less
94
+ * than half the size. Nothing about that is paradoxical once the `1/d³` is believed, and until it
95
+ * is believed the two facts look contradictory. Returns the ratio of the first body's tide to the
96
+ * second's, with the working that reconciles them.
97
+ */
98
+ declare function tideRatio(a: {
99
+ readonly mu: number;
100
+ readonly distance: number;
101
+ readonly name?: string;
102
+ }, b: {
103
+ readonly mu: number;
104
+ readonly distance: number;
105
+ readonly name?: string;
106
+ }, sf?: number): Worked;
107
+ /**
108
+ * The Roche limit for a rigid satellite: `d = R(2ρ_M/ρ_m)^{1/3}`.
109
+ *
110
+ * Inside it, the tidal stretch beats the moon's own gravity and it comes apart, which is where
111
+ * planetary rings come from: Saturn's rings sit inside its Roche limit and its moons sit outside.
112
+ * The rule is not arbitrary trivia, it is the same differential gravity as the tide, taken to the
113
+ * point where the difference exceeds what holds the body together.
114
+ */
115
+ declare function rocheLimit(primaryRadius: number, primaryDensity: number, satelliteDensity: number): number;
116
+ //#endregion
117
+ export { GravitySource, NetGravity, gravitationalForce, gravitationalForceSteps, inverseSquareFactor, netGravitationalForce, nullPoint, rocheLimit, tidalAcceleration, tideRatio };
@@ -0,0 +1,175 @@
1
+ import { GRAVITATIONAL_CONSTANT } from "../../core/constants.mjs";
2
+ import { calc, texSigFigs } from "../../core/worked.mjs";
3
+ import { compose } from "../vectors.mjs";
4
+
5
+ //#region src/physics/gravitation/law.ts
6
+ /**
7
+ * Newton's law of gravitation, and the two things it implies that students never connect to it.
8
+ *
9
+ * ── The law is trivial. The SUPERPOSITION is the subject ────────────────────────────────────────
10
+ * `F = Gm₁m₂/r²` is one line and nobody fails it. What questions actually test is that gravity from
11
+ * several bodies ADDS AS VECTORS, and that is where the marks go: the Earth pulls the Moon one way
12
+ * and the Sun pulls it another, and the answer is not the sum of two numbers, it is the sum of two
13
+ * arrows. A student who adds magnitudes gets a plausible-looking wrong answer with no warning.
14
+ *
15
+ * So this file does not own any vector arithmetic. It resolves into components with `resolve` and
16
+ * recombines with `compose`, from `vectors.ts`, exactly as the projectile and ramp kernels do. The
17
+ * point of teaching vectors once is that gravitation is then not a new skill.
18
+ *
19
+ * ── The null point, and why it is a mass RATIO question ─────────────────────────────────────────
20
+ * "Where between the Earth and the Moon does the net pull vanish?" looks like it needs both masses
21
+ * and the constant. It needs neither. Setting the two forces equal cancels `G` and the test mass,
22
+ * and leaves `√(M₁/M₂)` dividing the separation. The Earth is 81 times the Moon, `√81 = 9`, so the
23
+ * point sits nine tenths of the way across. Students who do not see the cancellation grind through
24
+ * a quadratic and usually lose the root that lies outside the pair.
25
+ *
26
+ * ── Tides, which are not gravity but the DIFFERENCE in gravity ──────────────────────────────────
27
+ * The commonest misconception in the whole chapter is that the Moon "lifts" the oceans. It does not:
28
+ * the Moon's pull at the Earth is 3×10⁻⁵ m/s², a millionth of `g`, and it pulls the ocean and the
29
+ * seabed almost identically. What raises a tide is the tiny DIFFERENCE across the Earth's diameter,
30
+ * which falls off as `1/d³` rather than `1/d²`. That cube is why the Sun, despite pulling on the
31
+ * Earth 175 times harder than the Moon does, raises a tide less than half the size.
32
+ *
33
+ * Pure: no React, no pixels.
34
+ */
35
+ const positive = (value, what) => {
36
+ if (!Number.isFinite(value) || value <= 0) throw new RangeError(`${what} must be positive and finite`);
37
+ return value;
38
+ };
39
+ /**
40
+ * The attraction between two point masses: `F = Gm₁m₂/r²`.
41
+ *
42
+ * `separation` is measured CENTRE TO CENTRE, which is the assumption doing the most quiet work in
43
+ * the chapter: a planet is not a point, and the only reason it may be treated as one is the shell
44
+ * theorem, proved in `potential.ts`. A question about a mass on the surface uses the planet's
45
+ * RADIUS, not the height above the ground, and that substitution is where answers go wrong by
46
+ * factors of millions.
47
+ */
48
+ function gravitationalForce(mass1, mass2, separation, G = GRAVITATIONAL_CONSTANT) {
49
+ const r = positive(separation, "separation");
50
+ return G * positive(mass1, "mass") * positive(mass2, "mass") / (r * r);
51
+ }
52
+ /**
53
+ * The same, showing its working.
54
+ *
55
+ * Split from the bare value deliberately, and the split is not stylistic. A lab redrawing a force
56
+ * arrow as a learner drags a satellite calls this sixty times a second, and building a LaTeX
57
+ * derivation on every frame to throw it away is waste that shows up as dropped frames on a
58
+ * mid-range phone. Every function in this kernel that has both forms follows the same rule: the
59
+ * bare one for the pixels, the `Steps` one for the page.
60
+ */
61
+ function gravitationalForceSteps(mass1, mass2, separation, G = GRAVITATIONAL_CONSTANT, sf = 3) {
62
+ const r = positive(separation, "separation");
63
+ const value = gravitationalForce(mass1, mass2, r, G);
64
+ return calc().step("F = \\frac{G m_1 m_2}{r^2}", "r is measured CENTRE to centre, not surface to surface").step(`F = \\frac{${texSigFigs(G, 4)} \\times ${texSigFigs(mass1, sf)} \\times ${texSigFigs(mass2, sf)}}{(${texSigFigs(r, sf)})^2}`).step(`F = ${texSigFigs(value, sf)}\\ \\mathrm{N}`, "equal and opposite on each mass, by Newton III").done(value);
65
+ }
66
+ /**
67
+ * How the force changes when the separation is scaled: `F' / F = 1/k²`.
68
+ *
69
+ * A ratio, so no constant and no masses. Named because "three times as far is a NINTH of the pull"
70
+ * is the sentence the inverse square law is, and it is worth a function that can be shown rather
71
+ * than a fact to be asserted.
72
+ */
73
+ function inverseSquareFactor(distanceFactor) {
74
+ const k = positive(distanceFactor, "distance factor");
75
+ return 1 / (k * k);
76
+ }
77
+ /**
78
+ * The net gravitational force on a mass at a point, from any number of sources.
79
+ *
80
+ * THE FUNCTION THIS FILE EXISTS FOR. Each source contributes an attraction along the line joining
81
+ * it, and the answer is the vector sum, recombined by `compose` so that the resultant's DIRECTION
82
+ * comes out alongside its size. A question that asks only for the magnitude is still a vector
83
+ * question, and answering it by adding two numbers is the error this is built to make visible: the
84
+ * Sun pulls the Moon about twice as hard as the Earth does, yet the Moon orbits the Earth, and the
85
+ * reconciliation is entirely in the directions.
86
+ */
87
+ function netGravitationalForce(at, sources, G = GRAVITATIONAL_CONSTANT) {
88
+ const contributions = sources.map((source, index) => {
89
+ const dx = source.x - at.x;
90
+ const dy = source.y - at.y;
91
+ const r = Math.hypot(dx, dy);
92
+ if (r === 0) throw new RangeError("a test mass cannot sit exactly on a point source");
93
+ const magnitude = G * source.mass * at.mass / (r * r);
94
+ return {
95
+ from: source.name ?? `source ${index + 1}`,
96
+ magnitude,
97
+ angleDeg: compose(dx, dy).angleDeg
98
+ };
99
+ });
100
+ let x = 0;
101
+ let y = 0;
102
+ for (const source of sources) {
103
+ const dx = source.x - at.x;
104
+ const dy = source.y - at.y;
105
+ const r = Math.hypot(dx, dy);
106
+ const magnitude = G * source.mass * at.mass / (r * r);
107
+ x += magnitude * (dx / r);
108
+ y += magnitude * (dy / r);
109
+ }
110
+ return {
111
+ contributions,
112
+ x,
113
+ y,
114
+ resultant: compose(x, y)
115
+ };
116
+ }
117
+ /**
118
+ * Where the pull of two bodies cancels, measured from the FIRST: `d₁ = d / (1 + √(M₂/M₁))`.
119
+ *
120
+ * The neutral point, and a question that needs neither `G` nor either mass on its own. Both cancel
121
+ * when the forces are set equal, leaving only the square root of the mass ratio, which is why the
122
+ * Earth-Moon point sits at nine tenths rather than at the middle: the Earth is 81 times heavier and
123
+ * √81 is 9, not 81.
124
+ *
125
+ * Note the point is nearer the LIGHTER body, which students consistently get backwards on instinct.
126
+ */
127
+ function nullPoint(mass1, mass2, separation, sf = 3) {
128
+ const d = positive(separation, "separation");
129
+ const ratio = Math.sqrt(positive(mass2, "mass") / positive(mass1, "mass"));
130
+ const value = d / (1 + ratio);
131
+ return calc().step("\\frac{G M_1 m}{x^2} = \\frac{G M_2 m}{(d-x)^2}", "the two pulls are equal and opposite, so their magnitudes match").step("\\frac{M_1}{x^2} = \\frac{M_2}{(d-x)^2}", "G cancels, and so does the test mass m. The answer cannot depend on what you put there").step("\\frac{d-x}{x} = \\sqrt{\\frac{M_2}{M_1}}", "take the square root of both sides rather than expanding into a quadratic").step(`x = \\frac{d}{1 + \\sqrt{M_2/M_1}} = \\frac{${texSigFigs(d, sf)}}{1 + ${texSigFigs(ratio, sf)}}`).step(`x = ${texSigFigs(value, sf)}\\ \\mathrm{m}`, "measured from the FIRST body. The point lies nearer the lighter one").done(value);
132
+ }
133
+ /**
134
+ * The tidal (differential) acceleration across a body of given size: `Δg ≈ 2·mu·s / d³`.
135
+ *
136
+ * The stretch a distant mass applies, which is what a tide actually is. The `1/d³` is the whole
137
+ * story and is worth deriving in front of a student: differentiate `mu/d²` and the power drops.
138
+ *
139
+ * `size` is the half-width, so pass the Earth's RADIUS for the ocean bulge on one side, and the
140
+ * factor of 2 accounts for the far side being stretched outwards just as the near side is pulled
141
+ * inwards. That symmetry is why there are two high tides a day and not one, which is the question
142
+ * every learner asks and almost no textbook answers.
143
+ */
144
+ function tidalAcceleration(mu, distance, size) {
145
+ const d = positive(distance, "distance");
146
+ return 2 * positive(mu, "gravitational parameter") * positive(size, "size") / d ** 3;
147
+ }
148
+ /**
149
+ * How much bigger a tide one body raises than another: the comparison that settles the Sun-Moon
150
+ * argument.
151
+ *
152
+ * The Sun pulls the Earth about 175 times harder than the Moon does, and yet raises a tide less
153
+ * than half the size. Nothing about that is paradoxical once the `1/d³` is believed, and until it
154
+ * is believed the two facts look contradictory. Returns the ratio of the first body's tide to the
155
+ * second's, with the working that reconciles them.
156
+ */
157
+ function tideRatio(a, b, sf = 3) {
158
+ const pullRatio = a.mu / b.mu * (b.distance / a.distance) ** 2;
159
+ const value = a.mu / b.mu * (b.distance / a.distance) ** 3;
160
+ return calc().step("g = \\frac{\\mu}{d^2} \\Rightarrow \\left|\\frac{dg}{dd}\\right| = \\frac{2\\mu}{d^3}", "a tide is not the pull, it is how fast the pull CHANGES across the body. Differentiate, and the power drops").step(`\\frac{F_a}{F_b} = \\frac{\\mu_a}{\\mu_b}\\left(\\frac{d_b}{d_a}\\right)^{2} = ${texSigFigs(pullRatio, sf)}`, `the raw pull: ${a.name ?? "the first"} wins by this much`).step(`\\frac{\\Delta g_a}{\\Delta g_b} = \\frac{\\mu_a}{\\mu_b}\\left(\\frac{d_b}{d_a}\\right)^{3} = ${texSigFigs(value, sf)}`, "the tide: one more power of distance, and the order can reverse entirely").done(value);
161
+ }
162
+ /**
163
+ * The Roche limit for a rigid satellite: `d = R(2ρ_M/ρ_m)^{1/3}`.
164
+ *
165
+ * Inside it, the tidal stretch beats the moon's own gravity and it comes apart, which is where
166
+ * planetary rings come from: Saturn's rings sit inside its Roche limit and its moons sit outside.
167
+ * The rule is not arbitrary trivia, it is the same differential gravity as the tide, taken to the
168
+ * point where the difference exceeds what holds the body together.
169
+ */
170
+ function rocheLimit(primaryRadius, primaryDensity, satelliteDensity) {
171
+ return positive(primaryRadius, "radius") * (2 * (positive(primaryDensity, "density") / positive(satelliteDensity, "density"))) ** (1 / 3);
172
+ }
173
+
174
+ //#endregion
175
+ export { gravitationalForce, gravitationalForceSteps, inverseSquareFactor, netGravitationalForce, nullPoint, rocheLimit, tidalAcceleration, tideRatio };