@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.
- package/dist/_virtual/_rolldown/runtime.mjs +18 -0
- package/dist/atomic/aufbau.d.mts +144 -0
- package/dist/atomic/aufbau.mjs +384 -0
- package/dist/atomic/elements.d.mts +67 -0
- package/dist/atomic/elements.mjs +785 -0
- package/dist/atomic/emission.d.mts +112 -0
- package/dist/atomic/emission.mjs +179 -0
- package/dist/atomic/index.d.mts +8 -0
- package/dist/atomic/index.mjs +9 -0
- package/dist/atomic/periodic.d.mts +82 -0
- package/dist/atomic/periodic.mjs +231 -0
- package/dist/atomic/properties.d.mts +100 -0
- package/dist/atomic/properties.mjs +574 -0
- package/dist/atomic/shells.d.mts +137 -0
- package/dist/atomic/shells.mjs +170 -0
- package/dist/atomic/trends.d.mts +148 -0
- package/dist/atomic/trends.mjs +225 -0
- package/dist/chem/chromatography.d.mts +66 -0
- package/dist/chem/chromatography.mjs +63 -0
- package/dist/chem/complex.d.mts +114 -0
- package/dist/chem/complex.mjs +234 -0
- package/dist/chem/cycle.d.mts +75 -0
- package/dist/chem/cycle.mjs +145 -0
- package/dist/chem/equation.d.mts +86 -0
- package/dist/chem/equation.mjs +168 -0
- package/dist/chem/formula.d.mts +90 -0
- package/dist/chem/formula.mjs +201 -0
- package/dist/chem/functional-groups.d.mts +31 -0
- package/dist/chem/functional-groups.mjs +187 -0
- package/dist/chem/hazard.d.mts +94 -0
- package/dist/chem/hazard.mjs +329 -0
- package/dist/chem/index.d.mts +34 -33
- package/dist/chem/index.mjs +34 -28
- package/dist/chem/ionic.d.mts +98 -0
- package/dist/chem/ionic.mjs +156 -0
- package/dist/chem/layout.d.mts +46 -0
- package/dist/chem/layout.mjs +342 -0
- package/dist/chem/lewis.d.mts +79 -0
- package/dist/chem/lewis.mjs +163 -0
- package/dist/chem/molecular-orbital.d.mts +114 -0
- package/dist/chem/molecular-orbital.mjs +201 -0
- package/dist/chem/molecule.d.mts +154 -0
- package/dist/chem/molecule.mjs +282 -0
- package/dist/chem/nmr.d.mts +153 -0
- package/dist/chem/nmr.mjs +165 -0
- package/dist/chem/polymer.d.mts +65 -0
- package/dist/chem/polymer.mjs +179 -0
- package/dist/chem/redox.d.mts +138 -0
- package/dist/chem/redox.mjs +328 -0
- package/dist/chem/relations.d.mts +183 -0
- package/dist/chem/relations.mjs +299 -0
- package/dist/chem/skeleton.d.mts +51 -0
- package/dist/chem/skeleton.mjs +186 -0
- package/dist/chem/solution.d.mts +116 -0
- package/dist/chem/solution.mjs +186 -0
- package/dist/chem/species.d.mts +47 -0
- package/dist/chem/species.mjs +128 -0
- package/dist/chem/stereo.d.mts +108 -0
- package/dist/chem/stereo.mjs +286 -0
- package/dist/chem/stoichiometry.d.mts +95 -0
- package/dist/chem/stoichiometry.mjs +145 -0
- package/dist/chem/synthesis.d.mts +113 -0
- package/dist/chem/synthesis.mjs +281 -0
- package/dist/chem/vsepr.d.mts +80 -0
- package/dist/chem/vsepr.mjs +247 -0
- package/dist/circuit/ac.d.mts +163 -0
- package/dist/circuit/ac.mjs +452 -0
- package/dist/circuit/dc.d.mts +92 -0
- package/dist/circuit/dc.mjs +333 -0
- package/dist/circuit/index.d.mts +5 -92
- package/dist/circuit/index.mjs +5 -332
- package/dist/circuit/network.d.mts +99 -0
- package/dist/circuit/network.mjs +440 -0
- package/dist/circuit/topology.d.mts +102 -0
- package/dist/circuit/topology.mjs +143 -0
- package/dist/colour/absorption.d.mts +79 -0
- package/dist/colour/absorption.mjs +137 -0
- package/dist/colour/index.d.mts +6 -0
- package/dist/colour/index.mjs +7 -0
- package/dist/colour/name.d.mts +14 -0
- package/dist/colour/name.mjs +76 -0
- package/dist/colour/observer.d.mts +31 -0
- package/dist/colour/observer.mjs +46 -0
- package/dist/colour/spectrum.d.mts +61 -0
- package/dist/colour/spectrum.mjs +108 -0
- package/dist/colour/srgb.d.mts +49 -0
- package/dist/colour/srgb.mjs +108 -0
- package/dist/core/constants.d.mts +138 -0
- package/dist/core/constants.mjs +139 -0
- package/dist/core/index.d.mts +3 -1
- package/dist/core/index.mjs +3 -1
- package/dist/core/vec3.d.mts +94 -0
- package/dist/core/vec3.mjs +123 -0
- package/dist/core/worked.d.mts +35 -0
- package/dist/core/worked.mjs +44 -0
- package/dist/electro/cell.d.mts +102 -0
- package/dist/electro/cell.mjs +170 -0
- package/dist/electro/conductivity.d.mts +157 -0
- package/dist/electro/conductivity.mjs +156 -0
- package/dist/electro/couples.d.mts +114 -0
- package/dist/electro/couples.mjs +334 -0
- package/dist/electro/electrolysis.d.mts +96 -0
- package/dist/electro/electrolysis.mjs +274 -0
- package/dist/electro/faraday.d.mts +150 -0
- package/dist/electro/faraday.mjs +118 -0
- package/dist/electro/index.d.mts +6 -0
- package/dist/electro/index.mjs +7 -0
- package/dist/finance/accounting/adjustments.d.mts +17 -0
- package/dist/finance/accounting/adjustments.mjs +202 -0
- package/dist/finance/accounting/analysis.d.mts +8 -0
- package/dist/finance/accounting/analysis.mjs +205 -0
- package/dist/finance/accounting/clubs.d.mts +21 -0
- package/dist/finance/accounting/clubs.mjs +217 -0
- package/dist/finance/accounting/company-statements.d.mts +7 -0
- package/dist/finance/accounting/company-statements.mjs +150 -0
- package/dist/finance/accounting/harness.d.mts +7 -0
- package/dist/finance/accounting/harness.mjs +45 -0
- package/dist/finance/accounting/index.d.mts +18 -0
- package/dist/finance/accounting/index.mjs +18 -0
- package/dist/finance/accounting/journalize.d.mts +16 -0
- package/dist/finance/accounting/journalize.mjs +128 -0
- package/dist/finance/accounting/manufacturing.d.mts +8 -0
- package/dist/finance/accounting/manufacturing.mjs +236 -0
- package/dist/finance/accounting/partnership.d.mts +7 -0
- package/dist/finance/accounting/partnership.mjs +152 -0
- package/dist/finance/accounting/period-case.d.mts +6 -0
- package/dist/finance/accounting/period-case.mjs +71 -0
- package/dist/finance/accounting/post.d.mts +9 -0
- package/dist/finance/accounting/post.mjs +84 -0
- package/dist/finance/accounting/precision.d.mts +9 -0
- package/dist/finance/accounting/precision.mjs +15 -0
- package/dist/finance/accounting/rules.d.mts +21 -0
- package/dist/finance/accounting/rules.mjs +37 -0
- package/dist/finance/accounting/solve.d.mts +28 -0
- package/dist/finance/accounting/solve.mjs +92 -0
- package/dist/finance/accounting/statements.d.mts +7 -0
- package/dist/finance/accounting/statements.mjs +142 -0
- package/dist/finance/accounting/types.d.mts +649 -0
- package/dist/finance/accounting/validate.d.mts +7 -0
- package/dist/finance/accounting/validate.mjs +67 -0
- package/dist/finance/accounting/verification.d.mts +24 -0
- package/dist/finance/accounting/verification.mjs +386 -0
- package/dist/finance/bizsim.d.mts +21 -39
- package/dist/finance/bizsim.mjs +276 -97
- package/dist/finance/index.d.mts +20 -43
- package/dist/finance/index.mjs +19 -77
- package/dist/finance/investment-math.d.mts +7 -0
- package/dist/finance/investment-math.mjs +18 -0
- package/dist/finance/management-accounting/budgeting.d.mts +7 -0
- package/dist/finance/management-accounting/budgeting.mjs +189 -0
- package/dist/finance/management-accounting/cash-budget.d.mts +7 -0
- package/dist/finance/management-accounting/cash-budget.mjs +154 -0
- package/dist/finance/management-accounting/costing.d.mts +8 -0
- package/dist/finance/management-accounting/costing.mjs +175 -0
- package/dist/finance/management-accounting/decisions.d.mts +8 -0
- package/dist/finance/management-accounting/decisions.mjs +164 -0
- package/dist/finance/management-accounting/index.d.mts +13 -0
- package/dist/finance/management-accounting/index.mjs +13 -0
- package/dist/finance/management-accounting/integrated-budget.d.mts +8 -0
- package/dist/finance/management-accounting/integrated-budget.mjs +67 -0
- package/dist/finance/management-accounting/inventory-costing.d.mts +7 -0
- package/dist/finance/management-accounting/inventory-costing.mjs +173 -0
- package/dist/finance/management-accounting/investment-appraisal.d.mts +7 -0
- package/dist/finance/management-accounting/investment-appraisal.mjs +148 -0
- package/dist/finance/management-accounting/management-case.d.mts +8 -0
- package/dist/finance/management-accounting/management-case.mjs +91 -0
- package/dist/finance/management-accounting/master-budget.d.mts +7 -0
- package/dist/finance/management-accounting/master-budget.mjs +137 -0
- package/dist/finance/management-accounting/production-costing.d.mts +8 -0
- package/dist/finance/management-accounting/production-costing.mjs +214 -0
- package/dist/finance/management-accounting/types.d.mts +644 -0
- package/dist/finance/management-accounting/variances.d.mts +7 -0
- package/dist/finance/management-accounting/variances.mjs +150 -0
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +1 -1
- package/dist/math/analysis.d.mts +61 -0
- package/dist/math/analysis.mjs +187 -0
- package/dist/math/answer-check.d.mts +50 -0
- package/dist/math/answer-check.mjs +106 -0
- package/dist/math/calculus.d.mts +4 -9
- package/dist/math/calculus.mjs +216 -7
- package/dist/math/complex.d.mts +93 -0
- package/dist/math/complex.mjs +239 -0
- package/dist/math/expr.d.mts +23 -0
- package/dist/math/expr.mjs +36 -0
- package/dist/math/index.d.mts +8 -22
- package/dist/math/index.mjs +8 -37
- package/dist/math/latex.mjs +2 -1
- package/dist/math/parse.mjs +1 -1
- package/dist/math/poly.d.mts +55 -0
- package/dist/math/poly.mjs +273 -0
- package/dist/math/rearrange.d.mts +14 -0
- package/dist/math/rearrange.mjs +125 -0
- package/dist/math/solve.d.mts +21 -0
- package/dist/math/solve.mjs +75 -0
- package/dist/networking/addressing.d.mts +26 -0
- package/dist/networking/addressing.mjs +33 -0
- package/dist/networking/cloud/access.d.mts +36 -0
- package/dist/networking/cloud/access.mjs +95 -0
- package/dist/networking/cloud/containers.d.mts +43 -0
- package/dist/networking/cloud/containers.mjs +54 -0
- package/dist/networking/cloud/edge.d.mts +17 -0
- package/dist/networking/cloud/edge.mjs +31 -0
- package/dist/networking/cloud/failure-domains.d.mts +19 -0
- package/dist/networking/cloud/failure-domains.mjs +22 -0
- package/dist/networking/cloud/geo-routing.d.mts +22 -0
- package/dist/networking/cloud/geo-routing.mjs +64 -0
- package/dist/networking/cloud/index.d.mts +18 -0
- package/dist/networking/cloud/index.mjs +19 -0
- package/dist/networking/cloud/inference-reliability.d.mts +30 -0
- package/dist/networking/cloud/inference-reliability.mjs +76 -0
- package/dist/networking/cloud/inference.d.mts +118 -0
- package/dist/networking/cloud/inference.mjs +179 -0
- package/dist/networking/cloud/infrastructure.d.mts +45 -0
- package/dist/networking/cloud/infrastructure.mjs +96 -0
- package/dist/networking/cloud/observability.d.mts +24 -0
- package/dist/networking/cloud/observability.mjs +34 -0
- package/dist/networking/cloud/orchestration.d.mts +32 -0
- package/dist/networking/cloud/orchestration.mjs +38 -0
- package/dist/networking/cloud/recovery.d.mts +21 -0
- package/dist/networking/cloud/recovery.mjs +27 -0
- package/dist/networking/cloud/releases.d.mts +42 -0
- package/dist/networking/cloud/releases.mjs +135 -0
- package/dist/networking/cloud/scaling.d.mts +25 -0
- package/dist/networking/cloud/scaling.mjs +65 -0
- package/dist/networking/cloud/secrets.d.mts +39 -0
- package/dist/networking/cloud/secrets.mjs +68 -0
- package/dist/networking/cloud/server-deployment.d.mts +29 -0
- package/dist/networking/cloud/server-deployment.mjs +72 -0
- package/dist/networking/cloud/storage.d.mts +16 -0
- package/dist/networking/cloud/storage.mjs +58 -0
- package/dist/networking/cloud/vpc.d.mts +18 -0
- package/dist/networking/cloud/vpc.mjs +100 -0
- package/dist/networking/delivery.d.mts +34 -0
- package/dist/networking/delivery.mjs +52 -0
- package/dist/networking/index.d.mts +47 -0
- package/dist/networking/index.mjs +47 -0
- package/dist/networking/ipv6.d.mts +28 -0
- package/dist/networking/ipv6.mjs +17 -0
- package/dist/networking/journeys.d.mts +83 -0
- package/dist/networking/journeys.mjs +161 -0
- package/dist/networking/models/airtime.d.mts +87 -0
- package/dist/networking/models/airtime.mjs +130 -0
- package/dist/networking/models/cellular.d.mts +157 -0
- package/dist/networking/models/cellular.mjs +252 -0
- package/dist/networking/models/encapsulation.d.mts +98 -0
- package/dist/networking/models/encapsulation.mjs +132 -0
- package/dist/networking/models/handover.d.mts +116 -0
- package/dist/networking/models/handover.mjs +209 -0
- package/dist/networking/models/handshake.d.mts +90 -0
- package/dist/networking/models/handshake.mjs +122 -0
- package/dist/networking/models/index.d.mts +14 -0
- package/dist/networking/models/index.mjs +15 -0
- package/dist/networking/models/media.d.mts +82 -0
- package/dist/networking/models/media.mjs +188 -0
- package/dist/networking/models/satellite.d.mts +86 -0
- package/dist/networking/models/satellite.mjs +121 -0
- package/dist/networking/models/spectrum.d.mts +83 -0
- package/dist/networking/models/spectrum.mjs +235 -0
- package/dist/networking/models/switch.d.mts +80 -0
- package/dist/networking/models/switch.mjs +155 -0
- package/dist/networking/models/vlan.d.mts +62 -0
- package/dist/networking/models/vlan.mjs +100 -0
- package/dist/networking/models/vpn.d.mts +66 -0
- package/dist/networking/models/vpn.mjs +125 -0
- package/dist/networking/models/wifi-privacy.d.mts +82 -0
- package/dist/networking/models/wifi-privacy.mjs +130 -0
- package/dist/networking/models/wifi.d.mts +240 -0
- package/dist/networking/models/wifi.mjs +562 -0
- package/dist/networking/nat-traversal.d.mts +24 -0
- package/dist/networking/nat-traversal.mjs +38 -0
- package/dist/networking/protocols.d.mts +17 -0
- package/dist/networking/protocols.mjs +57 -0
- package/dist/networking/queue.d.mts +12 -0
- package/dist/networking/queue.mjs +18 -0
- package/dist/networking/route-learning.d.mts +23 -0
- package/dist/networking/route-learning.mjs +43 -0
- package/dist/networking/routing.d.mts +11 -0
- package/dist/networking/routing.mjs +25 -0
- package/dist/networking/signals.d.mts +26 -0
- package/dist/networking/signals.mjs +35 -0
- package/dist/networking/subnet.d.mts +49 -0
- package/dist/networking/subnet.mjs +89 -0
- package/dist/networking/tcp-reliability.d.mts +24 -0
- package/dist/networking/tcp-reliability.mjs +38 -0
- package/dist/networking/topology/contract.d.mts +123 -0
- package/dist/networking/topology/index.d.mts +4 -0
- package/dist/networking/topology/index.mjs +4 -0
- package/dist/networking/topology/presets.d.mts +7 -0
- package/dist/networking/topology/presets.mjs +302 -0
- package/dist/networking/topology/simulation.d.mts +8 -0
- package/dist/networking/topology/simulation.mjs +179 -0
- package/dist/networking/wireless.d.mts +11 -0
- package/dist/networking/wireless.mjs +17 -0
- package/dist/optics/imaging.d.mts +218 -0
- package/dist/optics/imaging.mjs +276 -0
- package/dist/optics/index.d.mts +7 -0
- package/dist/optics/index.mjs +8 -0
- package/dist/optics/laws.d.mts +70 -0
- package/dist/optics/laws.mjs +195 -0
- package/dist/optics/prism.d.mts +148 -0
- package/dist/optics/prism.mjs +197 -0
- package/dist/optics/refraction.d.mts +201 -0
- package/dist/optics/refraction.mjs +270 -0
- package/dist/optics/wave-optics.d.mts +171 -0
- package/dist/optics/wave-optics.mjs +259 -0
- package/dist/physics/ac/index.d.mts +183 -0
- package/dist/physics/ac/index.mjs +203 -0
- package/dist/physics/dynamics/forces.d.mts +98 -0
- package/dist/physics/dynamics/forces.mjs +153 -0
- package/dist/physics/dynamics/friction.d.mts +76 -0
- package/dist/physics/dynamics/friction.mjs +119 -0
- package/dist/physics/dynamics/system.d.mts +68 -0
- package/dist/physics/dynamics/system.mjs +125 -0
- package/dist/physics/electrostatics/index.d.mts +169 -0
- package/dist/physics/electrostatics/index.mjs +249 -0
- package/dist/physics/energy/centre-of-mass.d.mts +115 -0
- package/dist/physics/energy/centre-of-mass.mjs +180 -0
- package/dist/physics/energy/conservation.d.mts +81 -0
- package/dist/physics/energy/conservation.mjs +129 -0
- package/dist/physics/energy/power.d.mts +90 -0
- package/dist/physics/energy/power.mjs +167 -0
- package/dist/physics/energy/spring.d.mts +73 -0
- package/dist/physics/energy/spring.mjs +129 -0
- package/dist/physics/energy/store.d.mts +63 -0
- package/dist/physics/energy/store.mjs +108 -0
- package/dist/physics/energy/theorem.d.mts +65 -0
- package/dist/physics/energy/theorem.mjs +113 -0
- package/dist/physics/energy/work.d.mts +114 -0
- package/dist/physics/energy/work.mjs +219 -0
- package/dist/physics/gravitation/body.d.mts +85 -0
- package/dist/physics/gravitation/body.mjs +168 -0
- package/dist/physics/gravitation/kepler.d.mts +127 -0
- package/dist/physics/gravitation/kepler.mjs +216 -0
- package/dist/physics/gravitation/law.d.mts +117 -0
- package/dist/physics/gravitation/law.mjs +175 -0
- package/dist/physics/gravitation/orbit.d.mts +119 -0
- package/dist/physics/gravitation/orbit.mjs +202 -0
- package/dist/physics/gravitation/potential.d.mts +114 -0
- package/dist/physics/gravitation/potential.mjs +202 -0
- package/dist/physics/gravitation/variation.d.mts +97 -0
- package/dist/physics/gravitation/variation.mjs +175 -0
- package/dist/physics/index.d.mts +35 -0
- package/dist/physics/index.mjs +36 -0
- package/dist/physics/integral-sweep.d.mts +63 -0
- package/dist/physics/integral-sweep.mjs +126 -0
- package/dist/physics/kinematics/equations.d.mts +47 -0
- package/dist/physics/kinematics/equations.mjs +126 -0
- package/dist/physics/kinematics/free-fall.d.mts +53 -0
- package/dist/physics/kinematics/free-fall.mjs +71 -0
- package/dist/physics/kinematics/given.d.mts +16 -0
- package/dist/physics/kinematics/given.mjs +55 -0
- package/dist/physics/kinematics/roots.d.mts +41 -0
- package/dist/physics/kinematics/roots.mjs +72 -0
- package/dist/physics/kinematics/solve.d.mts +52 -0
- package/dist/physics/kinematics/solve.mjs +172 -0
- package/dist/physics/magnetism/biot-savart.d.mts +161 -0
- package/dist/physics/magnetism/biot-savart.mjs +353 -0
- package/dist/physics/magnetism/flux.d.mts +94 -0
- package/dist/physics/magnetism/flux.mjs +313 -0
- package/dist/physics/magnetism/geomagnetism.d.mts +151 -0
- package/dist/physics/magnetism/geomagnetism.mjs +184 -0
- package/dist/physics/magnetism/index.d.mts +12 -0
- package/dist/physics/magnetism/index.mjs +74 -0
- package/dist/physics/magnetism/lorentz.d.mts +28 -0
- package/dist/physics/magnetism/lorentz.mjs +88 -0
- package/dist/physics/magnetism/magnetic-force.d.mts +102 -0
- package/dist/physics/magnetism/magnetic-force.mjs +169 -0
- package/dist/physics/momentum/collide.d.mts +77 -0
- package/dist/physics/momentum/collide.mjs +115 -0
- package/dist/physics/momentum/impulse.d.mts +89 -0
- package/dist/physics/momentum/impulse.mjs +159 -0
- package/dist/physics/momentum/planar.d.mts +60 -0
- package/dist/physics/momentum/planar.mjs +110 -0
- package/dist/physics/projectile.d.mts +107 -0
- package/dist/physics/projectile.mjs +185 -0
- package/dist/physics/rotation/angular.d.mts +85 -0
- package/dist/physics/rotation/angular.mjs +130 -0
- package/dist/physics/rotation/circular.d.mts +79 -0
- package/dist/physics/rotation/circular.mjs +131 -0
- package/dist/physics/rotation/inertia.d.mts +164 -0
- package/dist/physics/rotation/inertia.mjs +332 -0
- package/dist/physics/rotation/torque.d.mts +65 -0
- package/dist/physics/rotation/torque.mjs +134 -0
- package/dist/physics/vectors.d.mts +64 -0
- package/dist/physics/vectors.mjs +114 -0
- package/dist/quantity/index.d.mts +119 -0
- package/dist/quantity/index.mjs +417 -0
- package/dist/relation/derive.d.mts +74 -0
- package/dist/relation/derive.mjs +73 -0
- package/dist/relation/index.d.mts +56 -0
- package/dist/relation/index.mjs +234 -0
- package/dist/scene/evaluators.mjs +1 -1
- package/dist/sim/thermal.mjs +45 -20
- package/dist/thermo/calorimetry.d.mts +207 -0
- package/dist/thermo/calorimetry.mjs +345 -0
- package/dist/thermo/cycles.d.mts +142 -0
- package/dist/thermo/cycles.mjs +256 -0
- package/dist/thermo/entropy.d.mts +87 -0
- package/dist/thermo/entropy.mjs +140 -0
- package/dist/thermo/expansion.d.mts +130 -0
- package/dist/thermo/expansion.mjs +178 -0
- package/dist/thermo/gas.d.mts +197 -0
- package/dist/thermo/gas.mjs +279 -0
- package/dist/thermo/heat-transfer.d.mts +164 -0
- package/dist/thermo/heat-transfer.mjs +217 -0
- package/dist/thermo/index.d.mts +9 -82
- package/dist/thermo/index.mjs +9 -132
- package/dist/thermo/processes.d.mts +95 -0
- package/dist/thermo/processes.mjs +154 -0
- package/dist/thermo/temperature.d.mts +174 -0
- package/dist/thermo/temperature.mjs +236 -0
- package/dist/waves/damping.d.mts +224 -0
- package/dist/waves/damping.mjs +317 -0
- package/dist/waves/doppler.d.mts +72 -0
- package/dist/waves/doppler.mjs +125 -0
- package/dist/waves/index.d.mts +10 -0
- package/dist/waves/index.mjs +10 -0
- package/dist/waves/pendulum.d.mts +130 -0
- package/dist/waves/pendulum.mjs +211 -0
- package/dist/waves/pitch.d.mts +125 -0
- package/dist/waves/pitch.mjs +158 -0
- package/dist/waves/shm.d.mts +170 -0
- package/dist/waves/shm.mjs +279 -0
- package/dist/waves/springs.d.mts +103 -0
- package/dist/waves/springs.mjs +176 -0
- package/dist/waves/superposition.d.mts +124 -0
- package/dist/waves/superposition.mjs +196 -0
- package/dist/waves/wave.d.mts +154 -0
- package/dist/waves/wave.mjs +178 -0
- package/package.json +74 -2
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Worked } from "../../core/worked.mjs";
|
|
2
|
+
import { CentralBody } from "./body.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/physics/gravitation/variation.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* `g` at a height above the surface: `g' = g·R²/(R+h)²`.
|
|
7
|
+
*
|
|
8
|
+
* Equivalently `mu/(R+h)²`, which is the same statement with the surface value never mentioned. The
|
|
9
|
+
* error this guards against is using `h` where `R + h` belongs: at 400 km the International Space
|
|
10
|
+
* Station has `g` of about 8.7 m/s², which is 89% of the surface value, NOT zero. Astronauts float
|
|
11
|
+
* because they are falling, not because gravity has run out, and the number is how you prove it.
|
|
12
|
+
*/
|
|
13
|
+
declare const gravityAtHeight: (body: CentralBody, height: number) => number;
|
|
14
|
+
/**
|
|
15
|
+
* The same, worked, including the small-height approximation and where it stops being honest.
|
|
16
|
+
*
|
|
17
|
+
* `g' ≈ g(1 − 2h/R)` is the binomial expansion, and the FACTOR OF TWO in it is the thing to notice:
|
|
18
|
+
* it is what makes climbing cost twice what descending costs. The working reports both the exact
|
|
19
|
+
* value and the approximation so a learner can see the gap open up as `h` grows.
|
|
20
|
+
*/
|
|
21
|
+
declare function gravityAtHeightSteps(body: CentralBody, height: number, sf?: number): Worked;
|
|
22
|
+
/**
|
|
23
|
+
* The height at which `g` has fallen to a given fraction of its surface value.
|
|
24
|
+
*
|
|
25
|
+
* `h = R(1/√f − 1)`. Half of `g` is at `h = 0.414R`, roughly 2600 km up, which is a useful shock: `g`
|
|
26
|
+
* is still a quarter of its surface value out where the geostationary satellites are not, and
|
|
27
|
+
* halving it takes you a third of the way to the Moon's distance in radii but nowhere near it.
|
|
28
|
+
*/
|
|
29
|
+
declare function heightForGravityFraction(body: CentralBody, fraction: number): number;
|
|
30
|
+
/** The height at which `g` takes a given value, m. Throws if that value exceeds the surface value. */
|
|
31
|
+
declare function heightForGravity(body: CentralBody, target: number): number;
|
|
32
|
+
/**
|
|
33
|
+
* `g` at a depth below the surface: `g' = g(1 − d/R)`, for a body of uniform density.
|
|
34
|
+
*
|
|
35
|
+
* A STRAIGHT LINE, reaching exactly zero at the centre, which is the half of the picture students
|
|
36
|
+
* never draw. It follows from the shell theorem: the mass further out than you contributes nothing,
|
|
37
|
+
* so only the sphere of radius `R − d` beneath you pulls, and its mass falls as the cube while the
|
|
38
|
+
* distance falls as the square, leaving one power of the radius.
|
|
39
|
+
*
|
|
40
|
+
* "Uniform density" is a genuine idealisation and not a small one. The real Earth has a dense iron
|
|
41
|
+
* core, so `g` actually RISES slightly on the way down and peaks near the core-mantle boundary at
|
|
42
|
+
* around 10.7 m/s² before falling. Worth saying out loud in a lesson: the formula is exactly right
|
|
43
|
+
* for the model and the model is not the Earth.
|
|
44
|
+
*/
|
|
45
|
+
declare function gravityAtDepth(body: CentralBody, depth: number): number;
|
|
46
|
+
/**
|
|
47
|
+
* The height and the depth at which `g` has the same value, side by side.
|
|
48
|
+
*
|
|
49
|
+
* Built as one function because the question is always asked as a comparison, and the comparison is
|
|
50
|
+
* the entire lesson: to lose a given fraction of `g` you must climb only about half as far as you
|
|
51
|
+
* would have to dig. Returns both distances in metres plus the working that puts the factor of two
|
|
52
|
+
* where a learner can see it.
|
|
53
|
+
*/
|
|
54
|
+
declare function equalGravityDepthAndHeight(body: CentralBody, fraction: number, sf?: number): {
|
|
55
|
+
height: number;
|
|
56
|
+
depth: number;
|
|
57
|
+
worked: Worked;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Apparent `g` at a latitude on a rotating body: `g' = g − ω²R cos²λ`.
|
|
61
|
+
*
|
|
62
|
+
* The centripetal term comes from `rotation/circular.ts`, because it IS the centripetal
|
|
63
|
+
* acceleration and a learner should recognise it rather than meet it as a new formula. The radius
|
|
64
|
+
* of the circle a point actually travels is `R cos λ`, not `R`, which is where the cosine enters
|
|
65
|
+
* and where the square comes from: one factor from the smaller circle, one from `ω²r`.
|
|
66
|
+
*
|
|
67
|
+
* At the pole the correction is exactly zero, because a point on the axis goes nowhere. At the
|
|
68
|
+
* equator it is largest, at about 0.034 m/s², which is roughly 0.35% and is why `g` reads about 9.78
|
|
69
|
+
* at the equator against 9.83 at the poles. The full 0.05 difference also includes the Earth's
|
|
70
|
+
* equatorial bulge, which this does not model: a rotating planet is not a sphere, and the rotation
|
|
71
|
+
* is the reason for both effects.
|
|
72
|
+
*/
|
|
73
|
+
declare function gravityAtLatitude(body: CentralBody, latitudeDeg: number): number;
|
|
74
|
+
/**
|
|
75
|
+
* How fast a body would have to spin for things at its equator to float free: `T = 2π√(R/g)`.
|
|
76
|
+
*
|
|
77
|
+
* The rotation at which the whole of `g` is used up supplying the centripetal requirement, so a
|
|
78
|
+
* scale at the equator reads zero. For the Earth this is about 84 minutes, so the day would have to
|
|
79
|
+
* shorten by a factor of roughly 17: that number is the answer to the textbook question, and it is
|
|
80
|
+
* also the orbital period of a satellite skimming the surface, which is not a coincidence. Both ask
|
|
81
|
+
* the same thing: what speed does gravity alone hold in a circle of radius `R`?
|
|
82
|
+
*/
|
|
83
|
+
declare function spinPeriodForWeightlessness(body: CentralBody, sf?: number): Worked;
|
|
84
|
+
/**
|
|
85
|
+
* Weight, m/s² times kg, at a stated place on or above a body.
|
|
86
|
+
*
|
|
87
|
+
* A convenience with a purpose: it forces the CHOICE of which variation applies to be named, rather
|
|
88
|
+
* than a lesson silently using the surface value everywhere. Exactly one of `height`, `depth` or
|
|
89
|
+
* `latitudeDeg` may be given.
|
|
90
|
+
*/
|
|
91
|
+
declare function weightAt(body: CentralBody, mass: number, place?: {
|
|
92
|
+
height?: number;
|
|
93
|
+
depth?: number;
|
|
94
|
+
latitudeDeg?: number;
|
|
95
|
+
}): number;
|
|
96
|
+
//#endregion
|
|
97
|
+
export { equalGravityDepthAndHeight, gravityAtDepth, gravityAtHeight, gravityAtHeightSteps, gravityAtLatitude, heightForGravity, heightForGravityFraction, spinPeriodForWeightlessness, weightAt };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { calc, texSigFigs } from "../../core/worked.mjs";
|
|
2
|
+
import { toRadians } from "../vectors.mjs";
|
|
3
|
+
import { centripetalAcceleration } from "../rotation/circular.mjs";
|
|
4
|
+
import { surfaceGravity } from "./body.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/physics/gravitation/variation.ts
|
|
7
|
+
/**
|
|
8
|
+
* How `g` changes with height, with depth, and with latitude.
|
|
9
|
+
*
|
|
10
|
+
* ── The one graph this file is trying to put in a learner's head ────────────────────────────────
|
|
11
|
+
* `g` is a MAXIMUM AT THE SURFACE and falls off in both directions, but it falls off differently:
|
|
12
|
+
*
|
|
13
|
+
* going up g' = g·R²/(R+h)² ≈ g(1 − 2h/R) for small h
|
|
14
|
+
* going down g' = g(1 − d/R) exactly, for uniform density
|
|
15
|
+
*
|
|
16
|
+
* Read those two together and the whole shape follows. Near the surface, climbing loses you `g`
|
|
17
|
+
* TWICE AS FAST as descending does, because above the surface the whole planet is still pulling and
|
|
18
|
+
* only the distance grows, whereas below it the distance shrinks but the shell above you stops
|
|
19
|
+
* counting. The depth law is a straight line to zero at the centre; the height law is a curve that
|
|
20
|
+
* never reaches zero. Students who have only memorised the two formulas cannot draw that graph, and
|
|
21
|
+
* the graph is what gets asked.
|
|
22
|
+
*
|
|
23
|
+
* ── Why `g` at the centre is zero, not infinite ─────────────────────────────────────────────────
|
|
24
|
+
* The instinct is that gravity must be strongest at the centre, since that is what everything falls
|
|
25
|
+
* towards. It is zero there: you are pulled equally in every direction. That follows from the shell
|
|
26
|
+
* theorem (`potential.ts`), which says the mass in the shell ABOVE you contributes nothing at all,
|
|
27
|
+
* so only the sphere below you counts, and at the centre there is no sphere below you.
|
|
28
|
+
*
|
|
29
|
+
* ── Latitude is a different kind of thing, and the difference matters ───────────────────────────
|
|
30
|
+
* Height and depth genuinely change the gravitational FIELD. Latitude does not. The field at the
|
|
31
|
+
* equator is very nearly what it is at the pole; what changes is that at the equator part of it is
|
|
32
|
+
* spent supplying the centripetal acceleration of a body going round with the planet, so LESS IS
|
|
33
|
+
* LEFT to press on a scale. `g` measured is an APPARENT weight, not the field.
|
|
34
|
+
*
|
|
35
|
+
* That is why the centripetal term is not reimplemented here: it is `rotation/circular.ts`'s, and a
|
|
36
|
+
* learner who has met circular motion is meeting the same equation again, not a new one.
|
|
37
|
+
*
|
|
38
|
+
* Pure: no React, no pixels.
|
|
39
|
+
*/
|
|
40
|
+
const nonNegative = (value, what) => {
|
|
41
|
+
if (!Number.isFinite(value) || value < 0) throw new RangeError(`${what} must be zero or more, and finite`);
|
|
42
|
+
return value;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* `g` at a height above the surface: `g' = g·R²/(R+h)²`.
|
|
46
|
+
*
|
|
47
|
+
* Equivalently `mu/(R+h)²`, which is the same statement with the surface value never mentioned. The
|
|
48
|
+
* error this guards against is using `h` where `R + h` belongs: at 400 km the International Space
|
|
49
|
+
* Station has `g` of about 8.7 m/s², which is 89% of the surface value, NOT zero. Astronauts float
|
|
50
|
+
* because they are falling, not because gravity has run out, and the number is how you prove it.
|
|
51
|
+
*/
|
|
52
|
+
const gravityAtHeight = (body, height) => body.mu / (body.radius + nonNegative(height, "height")) ** 2;
|
|
53
|
+
/**
|
|
54
|
+
* The same, worked, including the small-height approximation and where it stops being honest.
|
|
55
|
+
*
|
|
56
|
+
* `g' ≈ g(1 − 2h/R)` is the binomial expansion, and the FACTOR OF TWO in it is the thing to notice:
|
|
57
|
+
* it is what makes climbing cost twice what descending costs. The working reports both the exact
|
|
58
|
+
* value and the approximation so a learner can see the gap open up as `h` grows.
|
|
59
|
+
*/
|
|
60
|
+
function gravityAtHeightSteps(body, height, sf = 3) {
|
|
61
|
+
const h = nonNegative(height, "height");
|
|
62
|
+
const g = surfaceGravity(body);
|
|
63
|
+
const value = gravityAtHeight(body, h);
|
|
64
|
+
const approx = g * (1 - 2 * h / body.radius);
|
|
65
|
+
return calc().step("g' = \\frac{GM}{(R+h)^2}", "the distance from the CENTRE is R + h, never just h").step("g' = g\\left(\\frac{R}{R+h}\\right)^{2}", "divide by the surface value, and the mass and the constant both vanish").step(`g' = ${texSigFigs(g, sf)} \\times \\left(\\frac{${texSigFigs(body.radius, sf)}}{${texSigFigs(body.radius + h, sf)}}\\right)^{2} = ${texSigFigs(value, sf)}\\ \\mathrm{m\\,s^{-2}}`).step(`g' \\approx g\\left(1 - \\frac{2h}{R}\\right) = ${texSigFigs(approx, sf)}\\ \\mathrm{m\\,s^{-2}}`, h / body.radius < .05 ? "the binomial approximation, good here because h is small against R. Note the 2" : "the binomial approximation, which has broken down: h is no longer small against R").done(value);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The height at which `g` has fallen to a given fraction of its surface value.
|
|
69
|
+
*
|
|
70
|
+
* `h = R(1/√f − 1)`. Half of `g` is at `h = 0.414R`, roughly 2600 km up, which is a useful shock: `g`
|
|
71
|
+
* is still a quarter of its surface value out where the geostationary satellites are not, and
|
|
72
|
+
* halving it takes you a third of the way to the Moon's distance in radii but nowhere near it.
|
|
73
|
+
*/
|
|
74
|
+
function heightForGravityFraction(body, fraction) {
|
|
75
|
+
if (!(fraction > 0 && fraction <= 1)) throw new RangeError("fraction must be in (0, 1]");
|
|
76
|
+
return body.radius * (1 / Math.sqrt(fraction) - 1);
|
|
77
|
+
}
|
|
78
|
+
/** The height at which `g` takes a given value, m. Throws if that value exceeds the surface value. */
|
|
79
|
+
function heightForGravity(body, target) {
|
|
80
|
+
const g = surfaceGravity(body);
|
|
81
|
+
if (!(target > 0 && target <= g)) throw new RangeError("g above the surface can only fall, never rise");
|
|
82
|
+
return Math.sqrt(body.mu / target) - body.radius;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* `g` at a depth below the surface: `g' = g(1 − d/R)`, for a body of uniform density.
|
|
86
|
+
*
|
|
87
|
+
* A STRAIGHT LINE, reaching exactly zero at the centre, which is the half of the picture students
|
|
88
|
+
* never draw. It follows from the shell theorem: the mass further out than you contributes nothing,
|
|
89
|
+
* so only the sphere of radius `R − d` beneath you pulls, and its mass falls as the cube while the
|
|
90
|
+
* distance falls as the square, leaving one power of the radius.
|
|
91
|
+
*
|
|
92
|
+
* "Uniform density" is a genuine idealisation and not a small one. The real Earth has a dense iron
|
|
93
|
+
* core, so `g` actually RISES slightly on the way down and peaks near the core-mantle boundary at
|
|
94
|
+
* around 10.7 m/s² before falling. Worth saying out loud in a lesson: the formula is exactly right
|
|
95
|
+
* for the model and the model is not the Earth.
|
|
96
|
+
*/
|
|
97
|
+
function gravityAtDepth(body, depth) {
|
|
98
|
+
const d = nonNegative(depth, "depth");
|
|
99
|
+
if (d > body.radius) throw new RangeError("depth cannot exceed the radius");
|
|
100
|
+
return surfaceGravity(body) * (1 - d / body.radius);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The height and the depth at which `g` has the same value, side by side.
|
|
104
|
+
*
|
|
105
|
+
* Built as one function because the question is always asked as a comparison, and the comparison is
|
|
106
|
+
* the entire lesson: to lose a given fraction of `g` you must climb only about half as far as you
|
|
107
|
+
* would have to dig. Returns both distances in metres plus the working that puts the factor of two
|
|
108
|
+
* where a learner can see it.
|
|
109
|
+
*/
|
|
110
|
+
function equalGravityDepthAndHeight(body, fraction, sf = 3) {
|
|
111
|
+
if (!(fraction > 0 && fraction < 1)) throw new RangeError("fraction must be in (0, 1)");
|
|
112
|
+
const height = heightForGravityFraction(body, fraction);
|
|
113
|
+
const depth = body.radius * (1 - fraction);
|
|
114
|
+
return {
|
|
115
|
+
height,
|
|
116
|
+
depth,
|
|
117
|
+
worked: calc().step("g\\left(\\frac{R}{R+h}\\right)^{2} = g\\left(1 - \\frac{d}{R}\\right) = f g", "set both to the same fraction f of the surface value").step(`h = R\\left(\\tfrac{1}{\\sqrt{f}} - 1\\right) = ${texSigFigs(height, sf)}\\ \\mathrm{m}`).step(`d = R(1 - f) = ${texSigFigs(depth, sf)}\\ \\mathrm{m}`).step(`\\frac{d}{h} = ${texSigFigs(depth / height, sf)}`, "for small losses this tends to 2: climbing costs g twice as fast as digging does").done(height)
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Apparent `g` at a latitude on a rotating body: `g' = g − ω²R cos²λ`.
|
|
122
|
+
*
|
|
123
|
+
* The centripetal term comes from `rotation/circular.ts`, because it IS the centripetal
|
|
124
|
+
* acceleration and a learner should recognise it rather than meet it as a new formula. The radius
|
|
125
|
+
* of the circle a point actually travels is `R cos λ`, not `R`, which is where the cosine enters
|
|
126
|
+
* and where the square comes from: one factor from the smaller circle, one from `ω²r`.
|
|
127
|
+
*
|
|
128
|
+
* At the pole the correction is exactly zero, because a point on the axis goes nowhere. At the
|
|
129
|
+
* equator it is largest, at about 0.034 m/s², which is roughly 0.35% and is why `g` reads about 9.78
|
|
130
|
+
* at the equator against 9.83 at the poles. The full 0.05 difference also includes the Earth's
|
|
131
|
+
* equatorial bulge, which this does not model: a rotating planet is not a sphere, and the rotation
|
|
132
|
+
* is the reason for both effects.
|
|
133
|
+
*/
|
|
134
|
+
function gravityAtLatitude(body, latitudeDeg) {
|
|
135
|
+
if (body.rotationPeriodS === void 0) return surfaceGravity(body);
|
|
136
|
+
const omega = 2 * Math.PI / body.rotationPeriodS;
|
|
137
|
+
const circleRadius = body.radius * Math.cos(toRadians(latitudeDeg));
|
|
138
|
+
const reduction = circleRadius === 0 ? 0 : centripetalAcceleration(omega * circleRadius, circleRadius) * Math.cos(toRadians(latitudeDeg));
|
|
139
|
+
return surfaceGravity(body) - reduction;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* How fast a body would have to spin for things at its equator to float free: `T = 2π√(R/g)`.
|
|
143
|
+
*
|
|
144
|
+
* The rotation at which the whole of `g` is used up supplying the centripetal requirement, so a
|
|
145
|
+
* scale at the equator reads zero. For the Earth this is about 84 minutes, so the day would have to
|
|
146
|
+
* shorten by a factor of roughly 17: that number is the answer to the textbook question, and it is
|
|
147
|
+
* also the orbital period of a satellite skimming the surface, which is not a coincidence. Both ask
|
|
148
|
+
* the same thing: what speed does gravity alone hold in a circle of radius `R`?
|
|
149
|
+
*/
|
|
150
|
+
function spinPeriodForWeightlessness(body, sf = 3) {
|
|
151
|
+
const g = surfaceGravity(body);
|
|
152
|
+
const value = 2 * Math.PI * Math.sqrt(body.radius / g);
|
|
153
|
+
return calc().step("mg = m\\omega^2 R", "weightless means gravity is entirely spent on going round, with nothing left for a scale").step("\\omega = \\sqrt{\\frac{g}{R}}", "the mass cancels, as it always does").step(`T = \\frac{2\\pi}{\\omega} = 2\\pi\\sqrt{\\frac{R}{g}} = 2\\pi\\sqrt{\\frac{${texSigFigs(body.radius, sf)}}{${texSigFigs(g, sf)}}}`).step(`T = ${texSigFigs(value, sf)}\\ \\mathrm{s}`, "which is also the period of a satellite skimming the surface. The same question, asked twice").done(value);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Weight, m/s² times kg, at a stated place on or above a body.
|
|
157
|
+
*
|
|
158
|
+
* A convenience with a purpose: it forces the CHOICE of which variation applies to be named, rather
|
|
159
|
+
* than a lesson silently using the surface value everywhere. Exactly one of `height`, `depth` or
|
|
160
|
+
* `latitudeDeg` may be given.
|
|
161
|
+
*/
|
|
162
|
+
function weightAt(body, mass, place = {}) {
|
|
163
|
+
if ([
|
|
164
|
+
place.height,
|
|
165
|
+
place.depth,
|
|
166
|
+
place.latitudeDeg
|
|
167
|
+
].filter((v) => v !== void 0).length > 1) throw new RangeError("give at most one of height, depth or latitude");
|
|
168
|
+
if (place.height !== void 0) return mass * gravityAtHeight(body, place.height);
|
|
169
|
+
if (place.depth !== void 0) return mass * gravityAtDepth(body, place.depth);
|
|
170
|
+
if (place.latitudeDeg !== void 0) return mass * gravityAtLatitude(body, place.latitudeDeg);
|
|
171
|
+
return mass * surfaceGravity(body);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
//#endregion
|
|
175
|
+
export { equalGravityDepthAndHeight, gravityAtDepth, gravityAtHeight, gravityAtHeightSteps, gravityAtLatitude, heightForGravity, heightForGravityFraction, spinPeriodForWeightlessness, weightAt };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ac_d_exports } from "./ac/index.mjs";
|
|
2
|
+
import { coulomb_d_exports } from "./electrostatics/index.mjs";
|
|
3
|
+
import { Components, DEG, Polar, Positive, SignConvention, compose, downPositive, resolve, resolveSteps, toDegrees, toRadians, upPositive } from "./vectors.mjs";
|
|
4
|
+
import { Sweep, SweepMethod, SweepSample, SweepSpec, positionAtFraction, sweep } from "./integral-sweep.mjs";
|
|
5
|
+
import { MOTION_EQUATIONS, MOTION_NAMES, MOTION_UNITS, MOTION_UNITS_TEX, MOTION_VARS, MotionEquation, MotionVar, equationWithout } from "./kinematics/equations.mjs";
|
|
6
|
+
import { MotionGiven, chooseEquation } from "./kinematics/given.mjs";
|
|
7
|
+
import { Root, TIME_EPSILON, classifyTime, preferredTime, speedRoots } from "./kinematics/roots.mjs";
|
|
8
|
+
import { MotionSolution, motion, motionTable, timeToReach } from "./kinematics/solve.mjs";
|
|
9
|
+
import { G_EARTH, VerticalMotion, describeSigns, dropped, vertical } from "./kinematics/free-fall.mjs";
|
|
10
|
+
import { Flight, Launch, angleWhereRangeEqualsHeight, anglesForRange, arc, flight, flightSteps, launchVelocity, minimumSpeedForRange, peakSteps, positionAt, timeAtHeight, velocityAt } from "./projectile.mjs";
|
|
11
|
+
import { Force, LiftResult, Resultant, accelerationForSupport, apparentWeight, force, forceXY, isBalanced, lami, resultant, resultantSteps, stringWithSideForce, weight } from "./dynamics/forces.mjs";
|
|
12
|
+
import { AppliedForce, FrictionResult, FrictionSetup, angleOfFriction, angleOfRepose, degreesAndMinutes, frictionOn, pullVersusPush } from "./dynamics/friction.mjs";
|
|
13
|
+
import { AtwoodResult, LinkedBody, SystemResult, atwood, linkedSystem } from "./dynamics/system.mjs";
|
|
14
|
+
import { LiftWorkResult, MECHANICAL_KINDS, QuantityKind, WorkResult, WorkSign, angleFromWork, kindOf, signOfWork, slopeEnergyAudit, workAgainstGravity, workDone, workFromComponents, workFromPolar, workUpSlope } from "./energy/work.mjs";
|
|
15
|
+
import { PotentialResult, elasticPE, gravitationalPE, gravitationalWork, kineticEnergy, kineticFromMomentum, kineticFromVelocity, momentumFromKinetic, speedFromKinetic } from "./energy/store.mjs";
|
|
16
|
+
import { SpringLaunch, SpringWork, springCompressionToStop, springLaunch, springWork, stiffnessForEnergyRatio } from "./energy/spring.mjs";
|
|
17
|
+
import { PenetrationResult, WorkEnergyResult, resistanceFromDrop, resistanceFromStrike, speedToPenetrate, stoppingDistance, workEnergy, workToStop } from "./energy/theorem.mjs";
|
|
18
|
+
import { Ladder, Rung, Station, SwingResult, dropForKinetic, energyLadder, heightWherePotentialIs, pendulumSwing, releaseAngleForSpeed, speedAfterDrop } from "./energy/conservation.mjs";
|
|
19
|
+
import { EfficiencyResult, HORSEPOWER, HORSEPOWER_METRIC, LiftingPower, chainEfficiency, efficiency, hoistPower, massRaisedInTime, power, powerFromForceSpeed, pumpPower, speedFromPower, toHorsepower, usefulOutput } from "./energy/power.mjs";
|
|
20
|
+
import { DrainResult, StackResult, centreOfMassLift, chainLift, columnDrain, meanLiftToRim, stackColumn, standBlockOnEnd, tiltRod } from "./energy/centre-of-mass.mjs";
|
|
21
|
+
import { ImpulseResult, VariableImpulse, bounceOffWall, forceForContact, impulseOf, impulseToChange, rocketAcceleration, rocketThrust } from "./momentum/impulse.mjs";
|
|
22
|
+
import { CollisionInput, CollisionOutcome, collide, restitutionFromBounce, restitutionOf, separateFrom } from "./momentum/collide.mjs";
|
|
23
|
+
import { PlanarBody, PlanarSolution, conserveMomentum, momentumAsComplex, momentumIsConserved, momentumOf, totalMomentum } from "./momentum/planar.mjs";
|
|
24
|
+
import { InertiaResult, SHAPES, ShapeGeometry, ShapeSpec, combine, distanceFromAxis, inertiaComesFrom, momentOfInertia, parallelAxis, perpendicularAxis, pointMasses, radiusOfGyration, shapeIds, sweepOf } from "./rotation/inertia.mjs";
|
|
25
|
+
import { ROTATIONAL_ANALOGUE, angularAcceleration, balancingCouple, couple, torque, torqueFromRate } from "./rotation/torque.mjs";
|
|
26
|
+
import { ROLLING_SHAPES, RollingEnergy, RollingShape, SpinChange, angularMomentum, angularMomentumOfPoint, conserveSpin, fromRPM, fromRevsPerSecond, rollingEnergy, rollingRace, rollingSpeedFromHeight } from "./rotation/angular.mjs";
|
|
27
|
+
import { bankingAngle, centripetalAcceleration, centripetalForce, centripetalFromOmega, maxSpeedBanked, maxSpeedFlat, minimumSpeedAtTop, railCant, verticalCircleTension } from "./rotation/circular.mjs";
|
|
28
|
+
import { CentralBody, EARTH, EARTH_MOON_DISTANCE, EARTH_SUN_DISTANCE, JUPITER, MARS, MOON, SUN, bodyFromDensity, bodyFromMass, bodyFromSurfaceGravity, bodyVolume, meanDensity, surfaceGravity, surfaceGravityFromDensity, surfaceGravityRatio } from "./gravitation/body.mjs";
|
|
29
|
+
import { GravitySource, NetGravity, gravitationalForce, gravitationalForceSteps, inverseSquareFactor, netGravitationalForce, nullPoint, rocheLimit, tidalAcceleration, tideRatio } from "./gravitation/law.mjs";
|
|
30
|
+
import { equalGravityDepthAndHeight, gravityAtDepth, gravityAtHeight, gravityAtHeightSteps, gravityAtLatitude, heightForGravity, heightForGravityFraction, spinPeriodForWeightlessness, weightAt } from "./gravitation/variation.mjs";
|
|
31
|
+
import { ShellRegion, escapeSpeed, escapeSpeedSteps, gravitationalFieldStrength, gravitationalPotential, gravitationalPotentialEnergy, potentialDifference, riseHeight, shellFieldAndPotential, sphereFieldAndPotential, sphereSelfEnergy } from "./gravitation/potential.mjs";
|
|
32
|
+
import { OrbitalEnergy, TrajectoryKind, geostationaryOrbit, hohmannTransfer, orbitRadiusForPeriod, orbitalEnergy, orbitalEnergySteps, orbitalPeriod, orbitalSpeed, orbitalSpeedSteps, surfaceSkimmingOrbit, trajectoryKind, visViva } from "./gravitation/orbit.mjs";
|
|
33
|
+
import { OrbitPoint, apsides, apsisSpeeds, arealVelocity, axisFromPeriod, centralMassFromOrbit, keplerRatio, orbitFromApsides, orbitPointAtMeanAnomaly, orbitPointAtTime, periodFromAxis, semiMinorAxis, solveEccentricAnomaly, specificAngularMomentum, synodicPeriod } from "./gravitation/kepler.mjs";
|
|
34
|
+
import { index_d_exports } from "./magnetism/index.mjs";
|
|
35
|
+
export { type AppliedForce, type AtwoodResult, CentralBody, type CollisionInput, type CollisionOutcome, Components, DEG, DrainResult, EARTH, EARTH_MOON_DISTANCE, EARTH_SUN_DISTANCE, EfficiencyResult, Flight, type Force, type FrictionResult, type FrictionSetup, G_EARTH, GravitySource, HORSEPOWER, HORSEPOWER_METRIC, type ImpulseResult, type InertiaResult, JUPITER, Ladder, Launch, type LiftResult, LiftWorkResult, LiftingPower, type LinkedBody, MARS, MECHANICAL_KINDS, MOON, MOTION_EQUATIONS, MOTION_NAMES, MOTION_UNITS, MOTION_UNITS_TEX, MOTION_VARS, type MotionEquation, type MotionGiven, type MotionSolution, type MotionVar, NetGravity, OrbitPoint, OrbitalEnergy, PenetrationResult, type PlanarBody, type PlanarSolution, Polar, Positive, PotentialResult, QuantityKind, ROLLING_SHAPES, ROTATIONAL_ANALOGUE, type Resultant, type RollingEnergy, type RollingShape, type Root, Rung, SHAPES, SUN, type ShapeGeometry, type ShapeSpec, ShellRegion, SignConvention, type SpinChange, SpringLaunch, SpringWork, StackResult, Station, Sweep, SweepMethod, SweepSample, SweepSpec, SwingResult, type SystemResult, TIME_EPSILON, TrajectoryKind, type VariableImpulse, type VerticalMotion, WorkEnergyResult, WorkResult, WorkSign, ac_d_exports as ac, accelerationForSupport, angleFromWork, angleOfFriction, angleOfRepose, angleWhereRangeEqualsHeight, anglesForRange, angularAcceleration, angularMomentum, angularMomentumOfPoint, apparentWeight, apsides, apsisSpeeds, arc, arealVelocity, atwood, axisFromPeriod, balancingCouple, bankingAngle, bodyFromDensity, bodyFromMass, bodyFromSurfaceGravity, bodyVolume, bounceOffWall, centralMassFromOrbit, centreOfMassLift, centripetalAcceleration, centripetalForce, centripetalFromOmega, chainEfficiency, chainLift, chooseEquation, classifyTime, collide, columnDrain, combine, compose, conserveMomentum, conserveSpin, couple, degreesAndMinutes, describeSigns, distanceFromAxis, downPositive, dropForKinetic, dropped, efficiency, elasticPE, coulomb_d_exports as electrostatics, energyLadder, equalGravityDepthAndHeight, equationWithout, escapeSpeed, escapeSpeedSteps, flight, flightSteps, force, forceForContact, forceXY, frictionOn, fromRPM, fromRevsPerSecond, geostationaryOrbit, gravitationalFieldStrength, gravitationalForce, gravitationalForceSteps, gravitationalPE, gravitationalPotential, gravitationalPotentialEnergy, gravitationalWork, gravityAtDepth, gravityAtHeight, gravityAtHeightSteps, gravityAtLatitude, heightForGravity, heightForGravityFraction, heightWherePotentialIs, hohmannTransfer, hoistPower, impulseOf, impulseToChange, inertiaComesFrom, inverseSquareFactor, isBalanced, keplerRatio, kindOf, kineticEnergy, kineticFromMomentum, kineticFromVelocity, lami, launchVelocity, linkedSystem, index_d_exports as magnetism, massRaisedInTime, maxSpeedBanked, maxSpeedFlat, meanDensity, meanLiftToRim, minimumSpeedAtTop, minimumSpeedForRange, momentOfInertia, momentumAsComplex, momentumFromKinetic, momentumIsConserved, momentumOf, motion, motionTable, netGravitationalForce, nullPoint, orbitFromApsides, orbitPointAtMeanAnomaly, orbitPointAtTime, orbitRadiusForPeriod, orbitalEnergy, orbitalEnergySteps, orbitalPeriod, orbitalSpeed, orbitalSpeedSteps, parallelAxis, peakSteps, pendulumSwing, periodFromAxis, perpendicularAxis, pointMasses, positionAt, positionAtFraction, potentialDifference, power, powerFromForceSpeed, preferredTime, pullVersusPush, pumpPower, radiusOfGyration, railCant, releaseAngleForSpeed, resistanceFromDrop, resistanceFromStrike, resolve, resolveSteps, restitutionFromBounce, restitutionOf, resultant, resultantSteps, riseHeight, rocheLimit, rocketAcceleration, rocketThrust, rollingEnergy, rollingRace, rollingSpeedFromHeight, semiMinorAxis, separateFrom, shapeIds, shellFieldAndPotential, signOfWork, slopeEnergyAudit, solveEccentricAnomaly, specificAngularMomentum, speedAfterDrop, speedFromKinetic, speedFromPower, speedRoots, speedToPenetrate, sphereFieldAndPotential, sphereSelfEnergy, spinPeriodForWeightlessness, springCompressionToStop, springLaunch, springWork, stackColumn, standBlockOnEnd, stiffnessForEnergyRatio, stoppingDistance, stringWithSideForce, surfaceGravity, surfaceGravityFromDensity, surfaceGravityRatio, surfaceSkimmingOrbit, sweep, sweepOf, synodicPeriod, tidalAcceleration, tideRatio, tiltRod, timeAtHeight, timeToReach, toDegrees, toHorsepower, toRadians, torque, torqueFromRate, totalMomentum, trajectoryKind, upPositive, usefulOutput, velocityAt, vertical, verticalCircleTension, visViva, weight, weightAt, workAgainstGravity, workDone, workEnergy, workFromComponents, workFromPolar, workToStop, workUpSlope };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { magnetism_exports } from "./magnetism/index.mjs";
|
|
2
|
+
import { DEG, SignConvention, compose, downPositive, resolve, resolveSteps, toDegrees, toRadians, upPositive } from "./vectors.mjs";
|
|
3
|
+
import { G_EARTH, describeSigns, dropped, vertical } from "./kinematics/free-fall.mjs";
|
|
4
|
+
import { accelerationForSupport, apparentWeight, force, forceXY, isBalanced, lami, resultant, resultantSteps, stringWithSideForce, weight } from "./dynamics/forces.mjs";
|
|
5
|
+
import { coulomb_exports } from "./electrostatics/index.mjs";
|
|
6
|
+
import { ac_exports } from "./ac/index.mjs";
|
|
7
|
+
import { positionAtFraction, sweep } from "./integral-sweep.mjs";
|
|
8
|
+
import { MOTION_EQUATIONS, MOTION_NAMES, MOTION_UNITS, MOTION_UNITS_TEX, MOTION_VARS, equationWithout } from "./kinematics/equations.mjs";
|
|
9
|
+
import { chooseEquation } from "./kinematics/given.mjs";
|
|
10
|
+
import { TIME_EPSILON, classifyTime, preferredTime, speedRoots } from "./kinematics/roots.mjs";
|
|
11
|
+
import { motion, motionTable, timeToReach } from "./kinematics/solve.mjs";
|
|
12
|
+
import { angleWhereRangeEqualsHeight, anglesForRange, arc, flight, flightSteps, launchVelocity, minimumSpeedForRange, peakSteps, positionAt, timeAtHeight, velocityAt } from "./projectile.mjs";
|
|
13
|
+
import { angleOfFriction, angleOfRepose, degreesAndMinutes, frictionOn, pullVersusPush } from "./dynamics/friction.mjs";
|
|
14
|
+
import { atwood, linkedSystem } from "./dynamics/system.mjs";
|
|
15
|
+
import { MECHANICAL_KINDS, angleFromWork, kindOf, signOfWork, slopeEnergyAudit, workAgainstGravity, workDone, workFromComponents, workFromPolar, workUpSlope } from "./energy/work.mjs";
|
|
16
|
+
import { elasticPE, gravitationalPE, gravitationalWork, kineticEnergy, kineticFromMomentum, kineticFromVelocity, momentumFromKinetic, speedFromKinetic } from "./energy/store.mjs";
|
|
17
|
+
import { springCompressionToStop, springLaunch, springWork, stiffnessForEnergyRatio } from "./energy/spring.mjs";
|
|
18
|
+
import { resistanceFromDrop, resistanceFromStrike, speedToPenetrate, stoppingDistance, workEnergy, workToStop } from "./energy/theorem.mjs";
|
|
19
|
+
import { dropForKinetic, energyLadder, heightWherePotentialIs, pendulumSwing, releaseAngleForSpeed, speedAfterDrop } from "./energy/conservation.mjs";
|
|
20
|
+
import { HORSEPOWER, HORSEPOWER_METRIC, chainEfficiency, efficiency, hoistPower, massRaisedInTime, power, powerFromForceSpeed, pumpPower, speedFromPower, toHorsepower, usefulOutput } from "./energy/power.mjs";
|
|
21
|
+
import { centreOfMassLift, chainLift, columnDrain, meanLiftToRim, stackColumn, standBlockOnEnd, tiltRod } from "./energy/centre-of-mass.mjs";
|
|
22
|
+
import { bounceOffWall, forceForContact, impulseOf, impulseToChange, rocketAcceleration, rocketThrust } from "./momentum/impulse.mjs";
|
|
23
|
+
import { collide, restitutionFromBounce, restitutionOf, separateFrom } from "./momentum/collide.mjs";
|
|
24
|
+
import { conserveMomentum, momentumAsComplex, momentumIsConserved, momentumOf, totalMomentum } from "./momentum/planar.mjs";
|
|
25
|
+
import { SHAPES, combine, distanceFromAxis, inertiaComesFrom, momentOfInertia, parallelAxis, perpendicularAxis, pointMasses, radiusOfGyration, shapeIds, sweepOf } from "./rotation/inertia.mjs";
|
|
26
|
+
import { ROTATIONAL_ANALOGUE, angularAcceleration, balancingCouple, couple, torque, torqueFromRate } from "./rotation/torque.mjs";
|
|
27
|
+
import { ROLLING_SHAPES, angularMomentum, angularMomentumOfPoint, conserveSpin, fromRPM, fromRevsPerSecond, rollingEnergy, rollingRace, rollingSpeedFromHeight } from "./rotation/angular.mjs";
|
|
28
|
+
import { bankingAngle, centripetalAcceleration, centripetalForce, centripetalFromOmega, maxSpeedBanked, maxSpeedFlat, minimumSpeedAtTop, railCant, verticalCircleTension } from "./rotation/circular.mjs";
|
|
29
|
+
import { EARTH, EARTH_MOON_DISTANCE, EARTH_SUN_DISTANCE, JUPITER, MARS, MOON, SUN, bodyFromDensity, bodyFromMass, bodyFromSurfaceGravity, bodyVolume, meanDensity, surfaceGravity, surfaceGravityFromDensity, surfaceGravityRatio } from "./gravitation/body.mjs";
|
|
30
|
+
import { gravitationalForce, gravitationalForceSteps, inverseSquareFactor, netGravitationalForce, nullPoint, rocheLimit, tidalAcceleration, tideRatio } from "./gravitation/law.mjs";
|
|
31
|
+
import { equalGravityDepthAndHeight, gravityAtDepth, gravityAtHeight, gravityAtHeightSteps, gravityAtLatitude, heightForGravity, heightForGravityFraction, spinPeriodForWeightlessness, weightAt } from "./gravitation/variation.mjs";
|
|
32
|
+
import { escapeSpeed, escapeSpeedSteps, gravitationalFieldStrength, gravitationalPotential, gravitationalPotentialEnergy, potentialDifference, riseHeight, shellFieldAndPotential, sphereFieldAndPotential, sphereSelfEnergy } from "./gravitation/potential.mjs";
|
|
33
|
+
import { geostationaryOrbit, hohmannTransfer, orbitRadiusForPeriod, orbitalEnergy, orbitalEnergySteps, orbitalPeriod, orbitalSpeed, orbitalSpeedSteps, surfaceSkimmingOrbit, trajectoryKind, visViva } from "./gravitation/orbit.mjs";
|
|
34
|
+
import { apsides, apsisSpeeds, arealVelocity, axisFromPeriod, centralMassFromOrbit, keplerRatio, orbitFromApsides, orbitPointAtMeanAnomaly, orbitPointAtTime, periodFromAxis, semiMinorAxis, solveEccentricAnomaly, specificAngularMomentum, synodicPeriod } from "./gravitation/kepler.mjs";
|
|
35
|
+
|
|
36
|
+
export { DEG, EARTH, EARTH_MOON_DISTANCE, EARTH_SUN_DISTANCE, G_EARTH, HORSEPOWER, HORSEPOWER_METRIC, JUPITER, MARS, MECHANICAL_KINDS, MOON, MOTION_EQUATIONS, MOTION_NAMES, MOTION_UNITS, MOTION_UNITS_TEX, MOTION_VARS, ROLLING_SHAPES, ROTATIONAL_ANALOGUE, SHAPES, SUN, SignConvention, TIME_EPSILON, ac_exports as ac, accelerationForSupport, angleFromWork, angleOfFriction, angleOfRepose, angleWhereRangeEqualsHeight, anglesForRange, angularAcceleration, angularMomentum, angularMomentumOfPoint, apparentWeight, apsides, apsisSpeeds, arc, arealVelocity, atwood, axisFromPeriod, balancingCouple, bankingAngle, bodyFromDensity, bodyFromMass, bodyFromSurfaceGravity, bodyVolume, bounceOffWall, centralMassFromOrbit, centreOfMassLift, centripetalAcceleration, centripetalForce, centripetalFromOmega, chainEfficiency, chainLift, chooseEquation, classifyTime, collide, columnDrain, combine, compose, conserveMomentum, conserveSpin, couple, degreesAndMinutes, describeSigns, distanceFromAxis, downPositive, dropForKinetic, dropped, efficiency, elasticPE, coulomb_exports as electrostatics, energyLadder, equalGravityDepthAndHeight, equationWithout, escapeSpeed, escapeSpeedSteps, flight, flightSteps, force, forceForContact, forceXY, frictionOn, fromRPM, fromRevsPerSecond, geostationaryOrbit, gravitationalFieldStrength, gravitationalForce, gravitationalForceSteps, gravitationalPE, gravitationalPotential, gravitationalPotentialEnergy, gravitationalWork, gravityAtDepth, gravityAtHeight, gravityAtHeightSteps, gravityAtLatitude, heightForGravity, heightForGravityFraction, heightWherePotentialIs, hohmannTransfer, hoistPower, impulseOf, impulseToChange, inertiaComesFrom, inverseSquareFactor, isBalanced, keplerRatio, kindOf, kineticEnergy, kineticFromMomentum, kineticFromVelocity, lami, launchVelocity, linkedSystem, magnetism_exports as magnetism, massRaisedInTime, maxSpeedBanked, maxSpeedFlat, meanDensity, meanLiftToRim, minimumSpeedAtTop, minimumSpeedForRange, momentOfInertia, momentumAsComplex, momentumFromKinetic, momentumIsConserved, momentumOf, motion, motionTable, netGravitationalForce, nullPoint, orbitFromApsides, orbitPointAtMeanAnomaly, orbitPointAtTime, orbitRadiusForPeriod, orbitalEnergy, orbitalEnergySteps, orbitalPeriod, orbitalSpeed, orbitalSpeedSteps, parallelAxis, peakSteps, pendulumSwing, periodFromAxis, perpendicularAxis, pointMasses, positionAt, positionAtFraction, potentialDifference, power, powerFromForceSpeed, preferredTime, pullVersusPush, pumpPower, radiusOfGyration, railCant, releaseAngleForSpeed, resistanceFromDrop, resistanceFromStrike, resolve, resolveSteps, restitutionFromBounce, restitutionOf, resultant, resultantSteps, riseHeight, rocheLimit, rocketAcceleration, rocketThrust, rollingEnergy, rollingRace, rollingSpeedFromHeight, semiMinorAxis, separateFrom, shapeIds, shellFieldAndPotential, signOfWork, slopeEnergyAudit, solveEccentricAnomaly, specificAngularMomentum, speedAfterDrop, speedFromKinetic, speedFromPower, speedRoots, speedToPenetrate, sphereFieldAndPotential, sphereSelfEnergy, spinPeriodForWeightlessness, springCompressionToStop, springLaunch, springWork, stackColumn, standBlockOnEnd, stiffnessForEnergyRatio, stoppingDistance, stringWithSideForce, surfaceGravity, surfaceGravityFromDensity, surfaceGravityRatio, surfaceSkimmingOrbit, sweep, sweepOf, synodicPeriod, tidalAcceleration, tideRatio, tiltRod, timeAtHeight, timeToReach, toDegrees, toHorsepower, toRadians, torque, torqueFromRate, totalMomentum, trajectoryKind, upPositive, usefulOutput, velocityAt, vertical, verticalCircleTension, visViva, weight, weightAt, workAgainstGravity, workDone, workEnergy, workFromComponents, workFromPolar, workToStop, workUpSlope };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Node } from "../math/ast.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/physics/integral-sweep.d.ts
|
|
4
|
+
interface SweepSpec {
|
|
5
|
+
/** The integrand, as an expression in `variable`. Must be an expanded polynomial. */
|
|
6
|
+
readonly element: string;
|
|
7
|
+
readonly variable: string;
|
|
8
|
+
/** Limits, as expressions in the symbols. */
|
|
9
|
+
readonly from: string;
|
|
10
|
+
readonly to: string;
|
|
11
|
+
}
|
|
12
|
+
/** One frame of the sweep. */
|
|
13
|
+
interface SweepSample {
|
|
14
|
+
/** Where the element is: the value of the integration variable. */
|
|
15
|
+
readonly at: number;
|
|
16
|
+
/** How much THIS element contributes per unit of the variable: the integrand's value. */
|
|
17
|
+
readonly density: number;
|
|
18
|
+
/** The integral so far, from the lower limit up to `at`. */
|
|
19
|
+
readonly accumulated: number;
|
|
20
|
+
/** `accumulated` as a fraction of the whole, for a progress meter. 0 to 1. */
|
|
21
|
+
readonly fraction: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* How the integral was done.
|
|
25
|
+
*
|
|
26
|
+
* Reported rather than hidden, because it changes what may honestly be shown. A `symbolic` sweep
|
|
27
|
+
* can print a closed form and an exact answer; a `numeric` one can print a number and a graph and
|
|
28
|
+
* must not claim a formula it does not have.
|
|
29
|
+
*/
|
|
30
|
+
type SweepMethod = 'symbolic' | 'numeric';
|
|
31
|
+
interface Sweep {
|
|
32
|
+
readonly samples: readonly SweepSample[];
|
|
33
|
+
/** The completed integral. The last sample's `accumulated` equals this exactly. */
|
|
34
|
+
readonly total: number;
|
|
35
|
+
readonly lower: number;
|
|
36
|
+
readonly upper: number;
|
|
37
|
+
readonly method: SweepMethod;
|
|
38
|
+
/**
|
|
39
|
+
* The symbolic antiderivative, for whatever prints the derivation. Null when the integrand was
|
|
40
|
+
* beyond the symbolic engine and the values came from quadrature instead.
|
|
41
|
+
*/
|
|
42
|
+
readonly antiderivative: Node | null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Sample the running value of an integral across its range.
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* // Why a ring beats a disc: watch where the contribution actually comes from.
|
|
49
|
+
* sweep({ element: '(2*M/R^2)*r^3', variable: 'r', from: '0', to: 'R' }, { M: 1, R: 1 });
|
|
50
|
+
* // half the total arrives in the last 16% of the radius
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare function sweep(spec: SweepSpec, values: Readonly<Record<string, number>>, samples?: number): Sweep;
|
|
54
|
+
/**
|
|
55
|
+
* Where the value actually comes from: the position by which a given fraction has accumulated.
|
|
56
|
+
*
|
|
57
|
+
* This is the number that makes the r² weighting vivid. For a uniform disc, half the moment of
|
|
58
|
+
* inertia lives beyond 84% of the radius, and a learner who has seen that will never again wonder
|
|
59
|
+
* why a flywheel puts its mass at the rim.
|
|
60
|
+
*/
|
|
61
|
+
declare function positionAtFraction(s: Sweep, fraction: number): number;
|
|
62
|
+
//#endregion
|
|
63
|
+
export { Sweep, SweepMethod, SweepSample, SweepSpec, positionAtFraction, sweep };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { evaluate } from "../math/ast.mjs";
|
|
2
|
+
import { parse } from "../math/parse.mjs";
|
|
3
|
+
import { integrate } from "../math/calculus.mjs";
|
|
4
|
+
import { quadrature } from "../math/analysis.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/physics/integral-sweep.ts
|
|
7
|
+
/**
|
|
8
|
+
* An integral you can watch happen.
|
|
9
|
+
*
|
|
10
|
+
* A definite integral is taught as a procedure and drawn, if at all, as a static picture of shaded
|
|
11
|
+
* strips. The thing that actually makes it click is motion: one element sweeping through the body
|
|
12
|
+
* while a running total fills, so you SEE that the far elements count for more and the near ones
|
|
13
|
+
* count for almost nothing. After that, `∫r² dm` is not a formula, it is a description of something
|
|
14
|
+
* you watched.
|
|
15
|
+
*
|
|
16
|
+
* This module produces the data for that, for ANY integral, not just moments of inertia:
|
|
17
|
+
*
|
|
18
|
+
* - `work = ∫F dx` for a variable force, where the strips are the force-distance graph;
|
|
19
|
+
* - `I = ∫r² dm`, where the r² weighting is the point being made;
|
|
20
|
+
* - centre of mass, `x̄ = (1/M)∫x dm`;
|
|
21
|
+
* - charge on a non-uniform rod, and the rest of the university-level list.
|
|
22
|
+
*
|
|
23
|
+
* It is deliberately NOT about rotation, and lives one level up from it, because the visual is the
|
|
24
|
+
* reusable thing. A renderer that can animate one of these can animate all of them.
|
|
25
|
+
*
|
|
26
|
+
* The integral is done SYMBOLICALLY once and then evaluated at each sample, rather than summed
|
|
27
|
+
* numerically. That matters for honesty: the running total is the real antiderivative, so the
|
|
28
|
+
* animation and the printed derivation are the same mathematics, and the final frame lands exactly
|
|
29
|
+
* on the closed-form answer instead of near it.
|
|
30
|
+
*
|
|
31
|
+
* Pure: no React, no pixels.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Sample the running value of an integral across its range.
|
|
35
|
+
*
|
|
36
|
+
* ```ts
|
|
37
|
+
* // Why a ring beats a disc: watch where the contribution actually comes from.
|
|
38
|
+
* sweep({ element: '(2*M/R^2)*r^3', variable: 'r', from: '0', to: 'R' }, { M: 1, R: 1 });
|
|
39
|
+
* // half the total arrives in the last 16% of the radius
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
function sweep(spec, values, samples = 64) {
|
|
43
|
+
if (samples < 2) throw new Error("A sweep needs at least two samples to show anything.");
|
|
44
|
+
const element = parse(spec.element);
|
|
45
|
+
const lower = evaluate(parse(spec.from), values);
|
|
46
|
+
const upper = evaluate(parse(spec.to), values);
|
|
47
|
+
const density = (point) => evaluate(element, {
|
|
48
|
+
...values,
|
|
49
|
+
[spec.variable]: point
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Symbolic when we can, quadrature when we cannot, and never a refusal.
|
|
53
|
+
*
|
|
54
|
+
* This is the whole reason the engine is usable beyond a syllabus. A rod whose density varies as
|
|
55
|
+
* `sin`, a sphere with a `1/(1+r²)` profile, or anything else a university problem invents has no
|
|
56
|
+
* closed form in our table, and returning nothing would mean the lab simply stops working on the
|
|
57
|
+
* interesting cases. Simpson's rule is accurate to near machine precision on a smooth integrand,
|
|
58
|
+
* so the picture and the number are right; only the CLOSED FORM is unavailable, and `method` says
|
|
59
|
+
* so, so nothing downstream claims otherwise.
|
|
60
|
+
*/
|
|
61
|
+
const antiderivative = integrate(element, spec.variable);
|
|
62
|
+
const method = antiderivative ? "symbolic" : "numeric";
|
|
63
|
+
const positions = Array.from({ length: samples }, (_, i) => lower + (upper - lower) * i / (samples - 1));
|
|
64
|
+
/**
|
|
65
|
+
* The running value at each sample.
|
|
66
|
+
*
|
|
67
|
+
* Symbolically this is one evaluation per sample. Numerically it is the panel between each pair
|
|
68
|
+
* of samples, ADDED to the running total, rather than a fresh integration from the lower limit
|
|
69
|
+
* every time. The first version did the latter, at Simpson's default 1000 subdivisions, so a
|
|
70
|
+
* 512-sample sweep performed half a million evaluations and took 26 ms: past a frame budget for
|
|
71
|
+
* something whose entire purpose is to be animated. Panels are short, so a handful of
|
|
72
|
+
* subdivisions each is more than enough accuracy, and the work drops by about a hundredfold.
|
|
73
|
+
*/
|
|
74
|
+
const PANEL_STEPS = 8;
|
|
75
|
+
const accumulated = new Array(samples);
|
|
76
|
+
if (antiderivative) {
|
|
77
|
+
const at = (p) => evaluate(antiderivative, {
|
|
78
|
+
...values,
|
|
79
|
+
[spec.variable]: p
|
|
80
|
+
});
|
|
81
|
+
const base = at(lower);
|
|
82
|
+
for (let i = 0; i < samples; i++) accumulated[i] = at(positions[i]) - base;
|
|
83
|
+
} else {
|
|
84
|
+
accumulated[0] = 0;
|
|
85
|
+
for (let i = 1; i < samples; i++) accumulated[i] = accumulated[i - 1] + quadrature(density, positions[i - 1], positions[i], PANEL_STEPS);
|
|
86
|
+
}
|
|
87
|
+
const total = accumulated[samples - 1];
|
|
88
|
+
return {
|
|
89
|
+
samples: positions.map((position, i) => ({
|
|
90
|
+
at: position,
|
|
91
|
+
density: density(position),
|
|
92
|
+
accumulated: accumulated[i],
|
|
93
|
+
fraction: total === 0 ? 0 : accumulated[i] / total
|
|
94
|
+
})),
|
|
95
|
+
total,
|
|
96
|
+
lower,
|
|
97
|
+
upper,
|
|
98
|
+
method,
|
|
99
|
+
antiderivative
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Where the value actually comes from: the position by which a given fraction has accumulated.
|
|
104
|
+
*
|
|
105
|
+
* This is the number that makes the r² weighting vivid. For a uniform disc, half the moment of
|
|
106
|
+
* inertia lives beyond 84% of the radius, and a learner who has seen that will never again wonder
|
|
107
|
+
* why a flywheel puts its mass at the rim.
|
|
108
|
+
*/
|
|
109
|
+
function positionAtFraction(s, fraction) {
|
|
110
|
+
if (fraction <= 0) return s.lower;
|
|
111
|
+
if (fraction >= 1) return s.upper;
|
|
112
|
+
let previous = s.samples[0];
|
|
113
|
+
for (const sample of s.samples) {
|
|
114
|
+
if (sample.fraction >= fraction) {
|
|
115
|
+
const span = sample.fraction - previous.fraction;
|
|
116
|
+
if (span <= 0) return sample.at;
|
|
117
|
+
const t = (fraction - previous.fraction) / span;
|
|
118
|
+
return previous.at + t * (sample.at - previous.at);
|
|
119
|
+
}
|
|
120
|
+
previous = sample;
|
|
121
|
+
}
|
|
122
|
+
return s.upper;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
//#endregion
|
|
126
|
+
export { positionAtFraction, sweep };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Relation } from "../../relation/index.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/physics/kinematics/equations.d.ts
|
|
4
|
+
/** The five quantities of straight-line motion at constant acceleration. */
|
|
5
|
+
type MotionVar = 'u' | 'v' | 'a' | 's' | 't';
|
|
6
|
+
declare const MOTION_VARS: readonly MotionVar[];
|
|
7
|
+
/** What each symbol means, for a lesson that lists them and for error messages that name them. */
|
|
8
|
+
declare const MOTION_NAMES: Readonly<Record<MotionVar, string>>;
|
|
9
|
+
/**
|
|
10
|
+
* The unit each quantity is held in, spelled for the UNIT PARSER.
|
|
11
|
+
*
|
|
12
|
+
* These strings are machine input, not display text. `m/s^2` is how `parseUnit` reads metres per
|
|
13
|
+
* second squared; it is not how a physics paper prints it, and putting it on screen is how a
|
|
14
|
+
* derivation ends up with a stray caret in it.
|
|
15
|
+
*/
|
|
16
|
+
declare const MOTION_UNITS: Readonly<Record<MotionVar, string>>;
|
|
17
|
+
/**
|
|
18
|
+
* The same units spelled for DISPLAY, as LaTeX.
|
|
19
|
+
*
|
|
20
|
+
* Index notation (`m s⁻²`) rather than a solidus, because that is the convention in every physics
|
|
21
|
+
* paper these students will sit, and upright roman rather than italic, because an italic `m` is a
|
|
22
|
+
* variable and an upright one is metres. The thin space between the symbols is not decoration: it
|
|
23
|
+
* is what distinguishes `m s` (metre-seconds) from `ms` (milliseconds).
|
|
24
|
+
*/
|
|
25
|
+
declare const MOTION_UNITS_TEX: Readonly<Record<MotionVar, string>>;
|
|
26
|
+
/** One SUVAT equation, and the single quantity it does not mention. */
|
|
27
|
+
interface MotionEquation {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly relation: Relation;
|
|
30
|
+
/** The variable absent from this equation. This is what makes the equation choosable. */
|
|
31
|
+
readonly omits: MotionVar;
|
|
32
|
+
/** True when the equation is quadratic in `t`, so solving it for `t` is not an isolation. */
|
|
33
|
+
readonly quadraticInTime: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The five equations.
|
|
37
|
+
*
|
|
38
|
+
* `s = vt − ½at²` is the one most textbooks omit, and then they have to fudge every question that
|
|
39
|
+
* gives the FINAL velocity and asks for the displacement. It is included for the same reason the
|
|
40
|
+
* other four are: leaving it out would mean one of the five choices has no equation behind it, and
|
|
41
|
+
* the method would stop being reliable exactly once per chapter.
|
|
42
|
+
*/
|
|
43
|
+
declare const MOTION_EQUATIONS: readonly MotionEquation[];
|
|
44
|
+
/** The equation that leaves out a given quantity. Exactly one does, which is the whole method. */
|
|
45
|
+
declare const equationWithout: (omitted: MotionVar) => MotionEquation | undefined;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { MOTION_EQUATIONS, MOTION_NAMES, MOTION_UNITS, MOTION_UNITS_TEX, MOTION_VARS, MotionEquation, MotionVar, equationWithout };
|