@classytic/stage 0.2.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/LICENSE +1 -1
- package/README.md +5 -1
- package/dist/_virtual/_rolldown/runtime.mjs +18 -0
- package/dist/assets/index.mjs +0 -1
- 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/builder/Palette.mjs +50 -89
- package/dist/builder/SceneBuilder.mjs +15 -73
- 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 +4 -1
- package/dist/core/index.mjs +4 -1
- package/dist/core/math.d.mts +26 -0
- package/dist/core/math.mjs +37 -0
- 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 +75 -0
- package/dist/finance/bizsim.mjs +296 -0
- package/dist/finance/index.d.mts +95 -0
- package/dist/finance/index.mjs +145 -0
- 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 +9 -8
- package/dist/index.mjs +5 -5
- package/dist/interaction/MovableDot.mjs +19 -0
- package/dist/interaction/useDraggable.mjs +24 -4
- 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 +17 -1
- package/dist/math/calculus.mjs +365 -2
- 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 +9 -23
- package/dist/math/index.mjs +9 -38
- package/dist/math/latex.mjs +10 -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/primitives/Dot.d.mts +2 -15
- package/dist/primitives/Dot.mjs +6 -4
- package/dist/primitives/Grid.d.mts +33 -17
- package/dist/primitives/Grid.mjs +89 -17
- package/dist/primitives/Label.d.mts +1 -14
- package/dist/primitives/Label.mjs +3 -2
- package/dist/primitives/Lines.d.mts +4 -32
- package/dist/primitives/Lines.mjs +10 -8
- package/dist/primitives/Shapes.d.mts +5 -43
- package/dist/primitives/Shapes.mjs +12 -10
- package/dist/primitives/index.d.mts +2 -2
- package/dist/primitives/index.mjs +2 -2
- package/dist/primitives/props.mjs +31 -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/Scene.d.mts +6 -1
- package/dist/scene/Scene.mjs +15 -40
- 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/view/Stage.mjs +4 -11
- 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 +103 -23
- package/styles.css +125 -8
- package/dist/assets/kit/index.mjs +0 -4
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
//#region src/optics/imaging.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Image formation: lenses, mirrors, and refraction at a curved surface.
|
|
4
|
+
*
|
|
5
|
+
* ## The sign convention, decided once and stated loudly
|
|
6
|
+
*
|
|
7
|
+
* This kernel uses the CARTESIAN convention throughout:
|
|
8
|
+
*
|
|
9
|
+
* - Light travels left to right, in the +x direction.
|
|
10
|
+
* - Every distance is measured FROM the optical centre (or pole), and is
|
|
11
|
+
* positive when measured in the direction light travels.
|
|
12
|
+
* - So a real object sitting to the left has a NEGATIVE u. A real image
|
|
13
|
+
* formed to the right has a positive v.
|
|
14
|
+
* - A centre of curvature to the right gives a positive R.
|
|
15
|
+
*
|
|
16
|
+
* That is not the convention the Bengali and Indian textbooks print. They use
|
|
17
|
+
* REAL-IS-POSITIVE, where a real object has a positive u and the lens equation
|
|
18
|
+
* reads 1/v + 1/u = 1/f. Both describe the same physics and the translation is
|
|
19
|
+
* exactly u → −u, which `fromRealPositive` does.
|
|
20
|
+
*
|
|
21
|
+
* Cartesian is the one implemented because it is the only convention in which
|
|
22
|
+
* the refracting formulas hold at once, with no per-formula sign patch:
|
|
23
|
+
*
|
|
24
|
+
* thin lens 1/v − 1/u = 1/f
|
|
25
|
+
* curved surface n₂/v − n₁/u = (n₂−n₁)/R
|
|
26
|
+
* lens maker 1/f = (n_l/n_m − 1)(1/R₁ − 1/R₂)
|
|
27
|
+
*
|
|
28
|
+
* ## Mirrors, and why they need no separate equation here
|
|
29
|
+
*
|
|
30
|
+
* A mirror sends light BACK, so its image forms on the object's own side. In
|
|
31
|
+
* strict Cartesian that makes a concave mirror's focal length negative, which
|
|
32
|
+
* is correct and which nobody writes: every table, this kernel's own callers
|
|
33
|
+
* included, says a concave mirror is the converging one. So `focalLength > 0`
|
|
34
|
+
* means CONVERGING for both elements here.
|
|
35
|
+
*
|
|
36
|
+
* With that fixed, and with the object distance supplied as a positive length,
|
|
37
|
+
* the two textbook equations turn out to be the same arithmetic:
|
|
38
|
+
*
|
|
39
|
+
* lens 1/v = 1/f + 1/u, u = −d → 1/v = 1/f − 1/d
|
|
40
|
+
* mirror 1/v = 1/f − 1/d → 1/v = 1/f − 1/d
|
|
41
|
+
*
|
|
42
|
+
* So there is one equation in this file, not two. That is worth stating because
|
|
43
|
+
* the obvious implementation is a branch on element type, and a branch whose
|
|
44
|
+
* arms agree is worse than no branch: it reads as though the cases differ.
|
|
45
|
+
*
|
|
46
|
+
* The sign still has to be got right on the way IN, and getting it wrong is
|
|
47
|
+
* silent: passing a Cartesian (negative) object distance to the mirror puts the
|
|
48
|
+
* image of an object 30 cm from an f = 10 cm concave mirror at 7.5 cm instead
|
|
49
|
+
* of 15 cm, and 7.5 is a perfectly plausible-looking number. Hence the positive
|
|
50
|
+
* distance at every entry point, and `tests/optics/imaging` pinning both
|
|
51
|
+
* elements against worked answers.
|
|
52
|
+
*
|
|
53
|
+
* What the shared equation genuinely cannot say is WHERE a positive v sits: the
|
|
54
|
+
* far side for a lens, the object's own side for a mirror. Both are "the
|
|
55
|
+
* outgoing side", so `real` is right for both, and the rest is the caller's to
|
|
56
|
+
* draw.
|
|
57
|
+
*
|
|
58
|
+
* ## The convenience that is NOT a convention change
|
|
59
|
+
*
|
|
60
|
+
* Every entry point below takes `objectDistance` as a POSITIVE distance to a
|
|
61
|
+
* real object, because that is what a person measures with a ruler and what
|
|
62
|
+
* every question states. It is negated on the way in, once, in one place.
|
|
63
|
+
* `imageDistance` comes back signed in the Cartesian sense, and the result
|
|
64
|
+
* carries `real` and `upright` flags so a caller never has to remember what the
|
|
65
|
+
* sign meant.
|
|
66
|
+
*
|
|
67
|
+
* Units: whatever the caller uses, consistently. Distances in and distances
|
|
68
|
+
* out. The only exception is `lensPower`, which is dioptres and therefore
|
|
69
|
+
* demands metres, and says so.
|
|
70
|
+
*/
|
|
71
|
+
/** Translate a textbook real-is-positive object distance into the Cartesian one. */
|
|
72
|
+
declare const fromRealPositive: (u: number) => number;
|
|
73
|
+
interface Image {
|
|
74
|
+
/**
|
|
75
|
+
* Image distance from the optical centre, signed.
|
|
76
|
+
*
|
|
77
|
+
* Positive is on the outgoing side: behind a lens, in front of a mirror.
|
|
78
|
+
* `Infinity` when the object sits at the focal point and the rays leave
|
|
79
|
+
* parallel, which is a real answer and not an error.
|
|
80
|
+
*/
|
|
81
|
+
imageDistance: number;
|
|
82
|
+
/** Object distance as a positive length, as supplied. */
|
|
83
|
+
objectDistance: number;
|
|
84
|
+
/** Focal length, signed: positive converging, negative diverging. */
|
|
85
|
+
focalLength: number;
|
|
86
|
+
/** Linear magnification, signed. Negative means inverted. */
|
|
87
|
+
magnification: number;
|
|
88
|
+
/** True when light actually converges there and a screen would catch it. */
|
|
89
|
+
real: boolean;
|
|
90
|
+
/** True when the image is the same way up as the object. */
|
|
91
|
+
upright: boolean;
|
|
92
|
+
/** True when the image is bigger than the object. */
|
|
93
|
+
enlarged: boolean;
|
|
94
|
+
/** Image height, when an object height was given. */
|
|
95
|
+
imageHeight?: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Image in a thin lens: 1/v − 1/u = 1/f.
|
|
99
|
+
*
|
|
100
|
+
* `focalLength` is positive for a converging (convex) lens and negative for a
|
|
101
|
+
* diverging (concave) one. A converging lens is the only element here that can
|
|
102
|
+
* make a real image, and only when the object is beyond the focal point; inside
|
|
103
|
+
* it, the same lens is a magnifying glass and the image is virtual, upright and
|
|
104
|
+
* enlarged. Both cases fall out of the one equation rather than needing a
|
|
105
|
+
* branch, which is why there is no branch.
|
|
106
|
+
*/
|
|
107
|
+
declare function thinLens(focalLength: number, objectDistance: number, objectHeight?: number): Image;
|
|
108
|
+
/**
|
|
109
|
+
* Image in a spherical mirror: 1/v + 1/u = 1/f, with f = R/2.
|
|
110
|
+
*
|
|
111
|
+
* `focalLength` is positive for a concave (converging) mirror, negative for a
|
|
112
|
+
* convex one. A convex mirror always gives a virtual, upright, diminished image
|
|
113
|
+
* whatever the object distance, which is why it is the one on a car and at a
|
|
114
|
+
* blind corner: it cannot help but show a wide view the right way up.
|
|
115
|
+
*/
|
|
116
|
+
declare function sphericalMirror(focalLength: number, objectDistance: number, objectHeight?: number): Image;
|
|
117
|
+
/** Focal length of a mirror from its radius of curvature: f = R/2. */
|
|
118
|
+
declare const mirrorFocalLength: (radiusOfCurvature: number) => number;
|
|
119
|
+
/**
|
|
120
|
+
* Refraction at a single spherical surface:
|
|
121
|
+
*
|
|
122
|
+
* n₂/v − n₁/u = (n₂ − n₁)/R
|
|
123
|
+
*
|
|
124
|
+
* The primitive a lens is built from, and the one that answers questions about
|
|
125
|
+
* a fish in a bowl or a bubble in a glass sphere, where there is only one
|
|
126
|
+
* surface to cross. `radius` is Cartesian: positive when the centre of
|
|
127
|
+
* curvature lies on the outgoing side.
|
|
128
|
+
*
|
|
129
|
+
* A flat surface is R = Infinity, which reduces this to n₂/v = n₁/u and
|
|
130
|
+
* recovers the apparent-depth result. That limit is why `Infinity` is accepted
|
|
131
|
+
* rather than rejected as a non-finite radius.
|
|
132
|
+
*/
|
|
133
|
+
declare function sphericalSurface(fromIndex: number, toIndex: number, radius: number, objectDistance: number): {
|
|
134
|
+
imageDistance: number;
|
|
135
|
+
magnification: number;
|
|
136
|
+
real: boolean;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* The lens maker's equation, including the surrounding medium:
|
|
140
|
+
*
|
|
141
|
+
* 1/f = (n_lens/n_medium − 1) · (1/R₁ − 1/R₂)
|
|
142
|
+
*
|
|
143
|
+
* The medium is not decoration. A glass lens in water has a much longer focal
|
|
144
|
+
* length because what bends light is the RATIO of the indices, not the glass
|
|
145
|
+
* alone, and a lens made of something with the same index as its surroundings
|
|
146
|
+
* does nothing at all. Push it further and the sign flips: a converging air
|
|
147
|
+
* bubble in water is a diverging lens, which this returns without special
|
|
148
|
+
* handling because the ratio simply drops below 1.
|
|
149
|
+
*
|
|
150
|
+
* Radii are Cartesian. For a biconvex lens R₁ > 0 and R₂ < 0. A flat face is
|
|
151
|
+
* `Infinity`.
|
|
152
|
+
*/
|
|
153
|
+
declare function lensMakerFocalLength(lensIndex: number, r1: number, r2: number, mediumIndex?: number): number;
|
|
154
|
+
/**
|
|
155
|
+
* Lens power in dioptres: P = 1/f with f IN METRES.
|
|
156
|
+
*
|
|
157
|
+
* The unit is the reason opticians use it: powers of lenses in contact simply
|
|
158
|
+
* add, so a prescription is a sum rather than a reciprocal of a sum of
|
|
159
|
+
* reciprocals.
|
|
160
|
+
*/
|
|
161
|
+
declare function lensPower(focalLengthM: number): number;
|
|
162
|
+
/** Focal length in metres from a power in dioptres. */
|
|
163
|
+
declare const focalLengthFromPower: (dioptres: number) => number;
|
|
164
|
+
/**
|
|
165
|
+
* Two thin lenses in contact: 1/f = 1/f₁ + 1/f₂, or equivalently P = P₁ + P₂.
|
|
166
|
+
*
|
|
167
|
+
* The special case of the separated formula below with d = 0, written out
|
|
168
|
+
* because it is the one that appears in every prescription and every achromatic
|
|
169
|
+
* doublet.
|
|
170
|
+
*/
|
|
171
|
+
declare function lensesInContact(...focalLengths: readonly number[]): number;
|
|
172
|
+
/**
|
|
173
|
+
* Two thin lenses a distance d apart:
|
|
174
|
+
*
|
|
175
|
+
* 1/f = 1/f₁ + 1/f₂ − d/(f₁f₂)
|
|
176
|
+
*
|
|
177
|
+
* The separation term is what makes a telescope a telescope rather than a thick
|
|
178
|
+
* lens. Note it can cancel the other two exactly, at d = f₁ + f₂, which is the
|
|
179
|
+
* telescope's normal adjustment: the combination then has infinite focal length
|
|
180
|
+
* and magnifies without focusing, and this throws rather than returning a
|
|
181
|
+
* division by zero dressed as a number.
|
|
182
|
+
*/
|
|
183
|
+
declare function lensesSeparated(f1: number, f2: number, separation: number): number;
|
|
184
|
+
interface DisplacementMethod {
|
|
185
|
+
/** The focal length the measurement gives. */
|
|
186
|
+
focalLength: number;
|
|
187
|
+
/** The two object distances at which a sharp image appears. */
|
|
188
|
+
objectDistances: [number, number];
|
|
189
|
+
/** The magnification at each of those positions. */
|
|
190
|
+
magnifications: [number, number];
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Focal length by the displacement (Bessel) method:
|
|
194
|
+
*
|
|
195
|
+
* f = (L² − x²) / 4L
|
|
196
|
+
*
|
|
197
|
+
* With the object and screen a fixed distance L apart, there are TWO lens
|
|
198
|
+
* positions giving a sharp image, x apart, and measuring x is far more accurate
|
|
199
|
+
* than locating either one alone. The reason there are two is that the lens
|
|
200
|
+
* equation is symmetric in u and v: swap them and it still holds, so the
|
|
201
|
+
* conjugate positions come in pairs.
|
|
202
|
+
*
|
|
203
|
+
* Requires L > 4f, which is the same statement as x being real. A screen closer
|
|
204
|
+
* than four focal lengths catches no sharp image at all, and this reports that
|
|
205
|
+
* rather than returning a complex-looking number.
|
|
206
|
+
*/
|
|
207
|
+
declare function displacementMethod(screenDistance: number, positionGap: number): DisplacementMethod;
|
|
208
|
+
/**
|
|
209
|
+
* The minimum separation between a real object and the real image a converging
|
|
210
|
+
* lens makes of it: L = 4f.
|
|
211
|
+
*
|
|
212
|
+
* Below it there is no solution at all, which is the fact behind the
|
|
213
|
+
* displacement method's requirement and behind the familiar experience that a
|
|
214
|
+
* projector cannot be moved arbitrarily close to its screen.
|
|
215
|
+
*/
|
|
216
|
+
declare const minimumObjectImageSeparation: (focalLength: number) => number;
|
|
217
|
+
//#endregion
|
|
218
|
+
export { DisplacementMethod, Image, displacementMethod, focalLengthFromPower, fromRealPositive, lensMakerFocalLength, lensPower, lensesInContact, lensesSeparated, minimumObjectImageSeparation, mirrorFocalLength, sphericalMirror, sphericalSurface, thinLens };
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
//#region src/optics/imaging.ts
|
|
2
|
+
/**
|
|
3
|
+
* Image formation: lenses, mirrors, and refraction at a curved surface.
|
|
4
|
+
*
|
|
5
|
+
* ## The sign convention, decided once and stated loudly
|
|
6
|
+
*
|
|
7
|
+
* This kernel uses the CARTESIAN convention throughout:
|
|
8
|
+
*
|
|
9
|
+
* - Light travels left to right, in the +x direction.
|
|
10
|
+
* - Every distance is measured FROM the optical centre (or pole), and is
|
|
11
|
+
* positive when measured in the direction light travels.
|
|
12
|
+
* - So a real object sitting to the left has a NEGATIVE u. A real image
|
|
13
|
+
* formed to the right has a positive v.
|
|
14
|
+
* - A centre of curvature to the right gives a positive R.
|
|
15
|
+
*
|
|
16
|
+
* That is not the convention the Bengali and Indian textbooks print. They use
|
|
17
|
+
* REAL-IS-POSITIVE, where a real object has a positive u and the lens equation
|
|
18
|
+
* reads 1/v + 1/u = 1/f. Both describe the same physics and the translation is
|
|
19
|
+
* exactly u → −u, which `fromRealPositive` does.
|
|
20
|
+
*
|
|
21
|
+
* Cartesian is the one implemented because it is the only convention in which
|
|
22
|
+
* the refracting formulas hold at once, with no per-formula sign patch:
|
|
23
|
+
*
|
|
24
|
+
* thin lens 1/v − 1/u = 1/f
|
|
25
|
+
* curved surface n₂/v − n₁/u = (n₂−n₁)/R
|
|
26
|
+
* lens maker 1/f = (n_l/n_m − 1)(1/R₁ − 1/R₂)
|
|
27
|
+
*
|
|
28
|
+
* ## Mirrors, and why they need no separate equation here
|
|
29
|
+
*
|
|
30
|
+
* A mirror sends light BACK, so its image forms on the object's own side. In
|
|
31
|
+
* strict Cartesian that makes a concave mirror's focal length negative, which
|
|
32
|
+
* is correct and which nobody writes: every table, this kernel's own callers
|
|
33
|
+
* included, says a concave mirror is the converging one. So `focalLength > 0`
|
|
34
|
+
* means CONVERGING for both elements here.
|
|
35
|
+
*
|
|
36
|
+
* With that fixed, and with the object distance supplied as a positive length,
|
|
37
|
+
* the two textbook equations turn out to be the same arithmetic:
|
|
38
|
+
*
|
|
39
|
+
* lens 1/v = 1/f + 1/u, u = −d → 1/v = 1/f − 1/d
|
|
40
|
+
* mirror 1/v = 1/f − 1/d → 1/v = 1/f − 1/d
|
|
41
|
+
*
|
|
42
|
+
* So there is one equation in this file, not two. That is worth stating because
|
|
43
|
+
* the obvious implementation is a branch on element type, and a branch whose
|
|
44
|
+
* arms agree is worse than no branch: it reads as though the cases differ.
|
|
45
|
+
*
|
|
46
|
+
* The sign still has to be got right on the way IN, and getting it wrong is
|
|
47
|
+
* silent: passing a Cartesian (negative) object distance to the mirror puts the
|
|
48
|
+
* image of an object 30 cm from an f = 10 cm concave mirror at 7.5 cm instead
|
|
49
|
+
* of 15 cm, and 7.5 is a perfectly plausible-looking number. Hence the positive
|
|
50
|
+
* distance at every entry point, and `tests/optics/imaging` pinning both
|
|
51
|
+
* elements against worked answers.
|
|
52
|
+
*
|
|
53
|
+
* What the shared equation genuinely cannot say is WHERE a positive v sits: the
|
|
54
|
+
* far side for a lens, the object's own side for a mirror. Both are "the
|
|
55
|
+
* outgoing side", so `real` is right for both, and the rest is the caller's to
|
|
56
|
+
* draw.
|
|
57
|
+
*
|
|
58
|
+
* ## The convenience that is NOT a convention change
|
|
59
|
+
*
|
|
60
|
+
* Every entry point below takes `objectDistance` as a POSITIVE distance to a
|
|
61
|
+
* real object, because that is what a person measures with a ruler and what
|
|
62
|
+
* every question states. It is negated on the way in, once, in one place.
|
|
63
|
+
* `imageDistance` comes back signed in the Cartesian sense, and the result
|
|
64
|
+
* carries `real` and `upright` flags so a caller never has to remember what the
|
|
65
|
+
* sign meant.
|
|
66
|
+
*
|
|
67
|
+
* Units: whatever the caller uses, consistently. Distances in and distances
|
|
68
|
+
* out. The only exception is `lensPower`, which is dioptres and therefore
|
|
69
|
+
* demands metres, and says so.
|
|
70
|
+
*/
|
|
71
|
+
const finite = (value, what) => {
|
|
72
|
+
if (!Number.isFinite(value)) throw new RangeError(`${what} must be a finite number.`);
|
|
73
|
+
return value;
|
|
74
|
+
};
|
|
75
|
+
const positive = (value, what) => {
|
|
76
|
+
if (!Number.isFinite(value) || value <= 0) throw new RangeError(`${what} must be positive.`);
|
|
77
|
+
return value;
|
|
78
|
+
};
|
|
79
|
+
/** Translate a textbook real-is-positive object distance into the Cartesian one. */
|
|
80
|
+
const fromRealPositive = (u) => -finite(u, "An object distance");
|
|
81
|
+
/**
|
|
82
|
+
* The one place the imaging equation is solved, shared by both elements.
|
|
83
|
+
*
|
|
84
|
+
* See the comment inside: once the object distance is supplied as a positive
|
|
85
|
+
* length, the lens and mirror equations are the SAME arithmetic, and the two
|
|
86
|
+
* wrappers differ only in what they document and in where a caller draws the
|
|
87
|
+
* result.
|
|
88
|
+
*/
|
|
89
|
+
function formImage(focalLength, objectDistance, objectHeight) {
|
|
90
|
+
const f = finite(focalLength, "A focal length");
|
|
91
|
+
const distance = positive(objectDistance, "An object distance");
|
|
92
|
+
if (f === 0) throw new RangeError("A focal length of zero is not an optical element.");
|
|
93
|
+
const invV = 1 / f - 1 / distance;
|
|
94
|
+
const v = invV === 0 ? Number.POSITIVE_INFINITY : 1 / invV;
|
|
95
|
+
const magnification = -v / distance;
|
|
96
|
+
const real = v > 0;
|
|
97
|
+
return {
|
|
98
|
+
imageDistance: v,
|
|
99
|
+
objectDistance: distance,
|
|
100
|
+
focalLength: f,
|
|
101
|
+
magnification,
|
|
102
|
+
real: Number.isFinite(v) ? real : false,
|
|
103
|
+
upright: magnification > 0,
|
|
104
|
+
enlarged: Math.abs(magnification) > 1,
|
|
105
|
+
...objectHeight === void 0 ? {} : { imageHeight: magnification * objectHeight }
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Image in a thin lens: 1/v − 1/u = 1/f.
|
|
110
|
+
*
|
|
111
|
+
* `focalLength` is positive for a converging (convex) lens and negative for a
|
|
112
|
+
* diverging (concave) one. A converging lens is the only element here that can
|
|
113
|
+
* make a real image, and only when the object is beyond the focal point; inside
|
|
114
|
+
* it, the same lens is a magnifying glass and the image is virtual, upright and
|
|
115
|
+
* enlarged. Both cases fall out of the one equation rather than needing a
|
|
116
|
+
* branch, which is why there is no branch.
|
|
117
|
+
*/
|
|
118
|
+
function thinLens(focalLength, objectDistance, objectHeight) {
|
|
119
|
+
return formImage(focalLength, objectDistance, objectHeight);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Image in a spherical mirror: 1/v + 1/u = 1/f, with f = R/2.
|
|
123
|
+
*
|
|
124
|
+
* `focalLength` is positive for a concave (converging) mirror, negative for a
|
|
125
|
+
* convex one. A convex mirror always gives a virtual, upright, diminished image
|
|
126
|
+
* whatever the object distance, which is why it is the one on a car and at a
|
|
127
|
+
* blind corner: it cannot help but show a wide view the right way up.
|
|
128
|
+
*/
|
|
129
|
+
function sphericalMirror(focalLength, objectDistance, objectHeight) {
|
|
130
|
+
return formImage(focalLength, objectDistance, objectHeight);
|
|
131
|
+
}
|
|
132
|
+
/** Focal length of a mirror from its radius of curvature: f = R/2. */
|
|
133
|
+
const mirrorFocalLength = (radiusOfCurvature) => finite(radiusOfCurvature, "A radius of curvature") / 2;
|
|
134
|
+
/**
|
|
135
|
+
* Refraction at a single spherical surface:
|
|
136
|
+
*
|
|
137
|
+
* n₂/v − n₁/u = (n₂ − n₁)/R
|
|
138
|
+
*
|
|
139
|
+
* The primitive a lens is built from, and the one that answers questions about
|
|
140
|
+
* a fish in a bowl or a bubble in a glass sphere, where there is only one
|
|
141
|
+
* surface to cross. `radius` is Cartesian: positive when the centre of
|
|
142
|
+
* curvature lies on the outgoing side.
|
|
143
|
+
*
|
|
144
|
+
* A flat surface is R = Infinity, which reduces this to n₂/v = n₁/u and
|
|
145
|
+
* recovers the apparent-depth result. That limit is why `Infinity` is accepted
|
|
146
|
+
* rather than rejected as a non-finite radius.
|
|
147
|
+
*/
|
|
148
|
+
function sphericalSurface(fromIndex, toIndex, radius, objectDistance) {
|
|
149
|
+
const n1 = positive(fromIndex, "The first refractive index");
|
|
150
|
+
const n2 = positive(toIndex, "The second refractive index");
|
|
151
|
+
const u = -positive(objectDistance, "An object distance");
|
|
152
|
+
if (Number.isNaN(radius)) throw new RangeError("A radius of curvature must be a number or Infinity.");
|
|
153
|
+
const invV = ((radius === Infinity || radius === -Infinity ? 0 : (n2 - n1) / radius) + n1 / u) / n2;
|
|
154
|
+
const v = invV === 0 ? Number.POSITIVE_INFINITY : 1 / invV;
|
|
155
|
+
return {
|
|
156
|
+
imageDistance: v,
|
|
157
|
+
magnification: n1 * v / (n2 * u),
|
|
158
|
+
real: v > 0
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The lens maker's equation, including the surrounding medium:
|
|
163
|
+
*
|
|
164
|
+
* 1/f = (n_lens/n_medium − 1) · (1/R₁ − 1/R₂)
|
|
165
|
+
*
|
|
166
|
+
* The medium is not decoration. A glass lens in water has a much longer focal
|
|
167
|
+
* length because what bends light is the RATIO of the indices, not the glass
|
|
168
|
+
* alone, and a lens made of something with the same index as its surroundings
|
|
169
|
+
* does nothing at all. Push it further and the sign flips: a converging air
|
|
170
|
+
* bubble in water is a diverging lens, which this returns without special
|
|
171
|
+
* handling because the ratio simply drops below 1.
|
|
172
|
+
*
|
|
173
|
+
* Radii are Cartesian. For a biconvex lens R₁ > 0 and R₂ < 0. A flat face is
|
|
174
|
+
* `Infinity`.
|
|
175
|
+
*/
|
|
176
|
+
function lensMakerFocalLength(lensIndex, r1, r2, mediumIndex = 1) {
|
|
177
|
+
const nl = positive(lensIndex, "The lens refractive index");
|
|
178
|
+
const nm = positive(mediumIndex, "The medium refractive index");
|
|
179
|
+
const curvature = (r) => r === Infinity || r === -Infinity ? 0 : 1 / finite(r, "A radius of curvature");
|
|
180
|
+
const power = (nl / nm - 1) * (curvature(r1) - curvature(r2));
|
|
181
|
+
if (power === 0) throw new RangeError("This lens has no focusing power: either its faces have matching curvature, or it has the same refractive index as the medium around it.");
|
|
182
|
+
return 1 / power;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Lens power in dioptres: P = 1/f with f IN METRES.
|
|
186
|
+
*
|
|
187
|
+
* The unit is the reason opticians use it: powers of lenses in contact simply
|
|
188
|
+
* add, so a prescription is a sum rather than a reciprocal of a sum of
|
|
189
|
+
* reciprocals.
|
|
190
|
+
*/
|
|
191
|
+
function lensPower(focalLengthM) {
|
|
192
|
+
const f = finite(focalLengthM, "A focal length");
|
|
193
|
+
if (f === 0) throw new RangeError("A focal length of zero has infinite power.");
|
|
194
|
+
return 1 / f;
|
|
195
|
+
}
|
|
196
|
+
/** Focal length in metres from a power in dioptres. */
|
|
197
|
+
const focalLengthFromPower = (dioptres) => {
|
|
198
|
+
if (finite(dioptres, "A power") === 0) throw new RangeError("A lens of zero power has no focal length.");
|
|
199
|
+
return 1 / dioptres;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Two thin lenses in contact: 1/f = 1/f₁ + 1/f₂, or equivalently P = P₁ + P₂.
|
|
203
|
+
*
|
|
204
|
+
* The special case of the separated formula below with d = 0, written out
|
|
205
|
+
* because it is the one that appears in every prescription and every achromatic
|
|
206
|
+
* doublet.
|
|
207
|
+
*/
|
|
208
|
+
function lensesInContact(...focalLengths) {
|
|
209
|
+
if (focalLengths.length === 0) throw new RangeError("No lenses to combine.");
|
|
210
|
+
const power = focalLengths.reduce((sum, f) => {
|
|
211
|
+
if (finite(f, "A focal length") === 0) throw new RangeError("A focal length of zero is not a lens.");
|
|
212
|
+
return sum + 1 / f;
|
|
213
|
+
}, 0);
|
|
214
|
+
if (power === 0) throw new RangeError("These lenses cancel exactly, so the combination has no focal length.");
|
|
215
|
+
return 1 / power;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Two thin lenses a distance d apart:
|
|
219
|
+
*
|
|
220
|
+
* 1/f = 1/f₁ + 1/f₂ − d/(f₁f₂)
|
|
221
|
+
*
|
|
222
|
+
* The separation term is what makes a telescope a telescope rather than a thick
|
|
223
|
+
* lens. Note it can cancel the other two exactly, at d = f₁ + f₂, which is the
|
|
224
|
+
* telescope's normal adjustment: the combination then has infinite focal length
|
|
225
|
+
* and magnifies without focusing, and this throws rather than returning a
|
|
226
|
+
* division by zero dressed as a number.
|
|
227
|
+
*/
|
|
228
|
+
function lensesSeparated(f1, f2, separation) {
|
|
229
|
+
const a = finite(f1, "The first focal length");
|
|
230
|
+
const b = finite(f2, "The second focal length");
|
|
231
|
+
const d = finite(separation, "The separation");
|
|
232
|
+
if (a === 0 || b === 0) throw new RangeError("A focal length of zero is not a lens.");
|
|
233
|
+
const power = 1 / a + 1 / b - d / (a * b);
|
|
234
|
+
if (power === 0) throw new RangeError("These lenses are separated by exactly f1 + f2, so the pair has no net power: parallel light in, parallel light out. That is a telescope, not a lens.");
|
|
235
|
+
return 1 / power;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Focal length by the displacement (Bessel) method:
|
|
239
|
+
*
|
|
240
|
+
* f = (L² − x²) / 4L
|
|
241
|
+
*
|
|
242
|
+
* With the object and screen a fixed distance L apart, there are TWO lens
|
|
243
|
+
* positions giving a sharp image, x apart, and measuring x is far more accurate
|
|
244
|
+
* than locating either one alone. The reason there are two is that the lens
|
|
245
|
+
* equation is symmetric in u and v: swap them and it still holds, so the
|
|
246
|
+
* conjugate positions come in pairs.
|
|
247
|
+
*
|
|
248
|
+
* Requires L > 4f, which is the same statement as x being real. A screen closer
|
|
249
|
+
* than four focal lengths catches no sharp image at all, and this reports that
|
|
250
|
+
* rather than returning a complex-looking number.
|
|
251
|
+
*/
|
|
252
|
+
function displacementMethod(screenDistance, positionGap) {
|
|
253
|
+
const L = positive(screenDistance, "The object-to-screen distance");
|
|
254
|
+
const x = finite(positionGap, "The gap between lens positions");
|
|
255
|
+
if (Math.abs(x) >= L) throw new RangeError("The two lens positions cannot be further apart than the object and screen are.");
|
|
256
|
+
const focalLength = (L * L - x * x) / (4 * L);
|
|
257
|
+
const u1 = (L - Math.abs(x)) / 2;
|
|
258
|
+
const u2 = (L + Math.abs(x)) / 2;
|
|
259
|
+
return {
|
|
260
|
+
focalLength,
|
|
261
|
+
objectDistances: [u1, u2],
|
|
262
|
+
magnifications: [(L - u1) / u1, (L - u2) / u2]
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* The minimum separation between a real object and the real image a converging
|
|
267
|
+
* lens makes of it: L = 4f.
|
|
268
|
+
*
|
|
269
|
+
* Below it there is no solution at all, which is the fact behind the
|
|
270
|
+
* displacement method's requirement and behind the familiar experience that a
|
|
271
|
+
* projector cannot be moved arbitrarily close to its screen.
|
|
272
|
+
*/
|
|
273
|
+
const minimumObjectImageSeparation = (focalLength) => 4 * positive(focalLength, "A focal length");
|
|
274
|
+
|
|
275
|
+
//#endregion
|
|
276
|
+
export { displacementMethod, focalLengthFromPower, fromRealPositive, lensMakerFocalLength, lensPower, lensesInContact, lensesSeparated, minimumObjectImageSeparation, mirrorFocalLength, sphericalMirror, sphericalSurface, thinLens };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ApparentDepth, DepthLayer, MEDIA, Refraction, SlabPassage, apparentDepth, brewsterAngleDeg, criticalAngleDeg, indexFromDepths, indexFromRodAngles, refract, refractAngleDeg, relativeIndex, speedInMedium, throughSlab, wavelengthInMedium } from "./refraction.mjs";
|
|
2
|
+
import { DisplacementMethod, Image, displacementMethod, focalLengthFromPower, fromRealPositive, lensMakerFocalLength, lensPower, lensesInContact, lensesSeparated, minimumObjectImageSeparation, mirrorFocalLength, sphericalMirror, sphericalSurface, thinLens } from "./imaging.mjs";
|
|
3
|
+
import { Dispersion, PrismPath, achromaticApexDeg, dispersion, indexFromMinimumDeviation, maximumApexAngleDeg, minimumDeviationDeg, minimumDeviationIncidenceDeg, prismAngleFromMinimumDeviation, prismPath, thinPrismDeviationDeg } from "./prism.mjs";
|
|
4
|
+
import { pathFromPhase, phaseFromPath } from "../waves/wave.mjs";
|
|
5
|
+
import { brightFringePosition, centralMaximumHalfWidthDeg, centralMaximumWidth, darkFringePosition, doubleSlitPattern, fringeAngleDeg, fringeSpacing, gratingAngleDeg, gratingSpacing, malusIntensity, maximumGratingOrder, pointSourceIntensity, rayleighResolutionRad, singleSlitEnvelope, singleSlitMinimumDeg, twoSlitIntensity, unpolarisedThroughPolariser, wavelengthFromFringes, wavelengthFromGrating } from "./wave-optics.mjs";
|
|
6
|
+
import { DEG, OPTICS_LAWS, apparentDepthLaw, brewstersLaw, criticalAngleLaw, fringeSpacingLaw, gratingLaw, indexFromSpeed, lensPowerLaw, magnificationLaw, malusLaw, mirrorEquation, photonEnergyLaw, snellsLaw, thinLensEquation, thinPrismLaw, waveEquation } from "./laws.mjs";
|
|
7
|
+
export { ApparentDepth, DEG, DepthLayer, Dispersion, DisplacementMethod, Image, MEDIA, OPTICS_LAWS, PrismPath, Refraction, SlabPassage, achromaticApexDeg, apparentDepth, apparentDepthLaw, brewsterAngleDeg, brewstersLaw, brightFringePosition, centralMaximumHalfWidthDeg, centralMaximumWidth, criticalAngleDeg, criticalAngleLaw, darkFringePosition, dispersion, displacementMethod, doubleSlitPattern, focalLengthFromPower, fringeAngleDeg, fringeSpacing, fringeSpacingLaw, fromRealPositive, gratingAngleDeg, gratingLaw, gratingSpacing, indexFromDepths, indexFromMinimumDeviation, indexFromRodAngles, indexFromSpeed, lensMakerFocalLength, lensPower, lensPowerLaw, lensesInContact, lensesSeparated, magnificationLaw, malusIntensity, malusLaw, maximumApexAngleDeg, maximumGratingOrder, minimumDeviationDeg, minimumDeviationIncidenceDeg, minimumObjectImageSeparation, mirrorEquation, mirrorFocalLength, pathFromPhase as pathDifference, phaseFromPath as phaseDifference, photonEnergyLaw, pointSourceIntensity, prismAngleFromMinimumDeviation, prismPath, rayleighResolutionRad, refract, refractAngleDeg, relativeIndex, singleSlitEnvelope, singleSlitMinimumDeg, snellsLaw, speedInMedium, sphericalMirror, sphericalSurface, thinLens, thinLensEquation, thinPrismDeviationDeg, thinPrismLaw, throughSlab, twoSlitIntensity, unpolarisedThroughPolariser, waveEquation, wavelengthFromFringes, wavelengthFromGrating, wavelengthInMedium };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MEDIA, apparentDepth, brewsterAngleDeg, criticalAngleDeg, indexFromDepths, indexFromRodAngles, refract, refractAngleDeg, relativeIndex, speedInMedium, throughSlab, wavelengthInMedium } from "./refraction.mjs";
|
|
2
|
+
import { displacementMethod, focalLengthFromPower, fromRealPositive, lensMakerFocalLength, lensPower, lensesInContact, lensesSeparated, minimumObjectImageSeparation, mirrorFocalLength, sphericalMirror, sphericalSurface, thinLens } from "./imaging.mjs";
|
|
3
|
+
import { achromaticApexDeg, dispersion, indexFromMinimumDeviation, maximumApexAngleDeg, minimumDeviationDeg, minimumDeviationIncidenceDeg, prismAngleFromMinimumDeviation, prismPath, thinPrismDeviationDeg } from "./prism.mjs";
|
|
4
|
+
import { pathFromPhase, phaseFromPath } from "../waves/wave.mjs";
|
|
5
|
+
import { brightFringePosition, centralMaximumHalfWidthDeg, centralMaximumWidth, darkFringePosition, doubleSlitPattern, fringeAngleDeg, fringeSpacing, gratingAngleDeg, gratingSpacing, malusIntensity, maximumGratingOrder, pointSourceIntensity, rayleighResolutionRad, singleSlitEnvelope, singleSlitMinimumDeg, twoSlitIntensity, unpolarisedThroughPolariser, wavelengthFromFringes, wavelengthFromGrating } from "./wave-optics.mjs";
|
|
6
|
+
import { DEG, OPTICS_LAWS, apparentDepthLaw, brewstersLaw, criticalAngleLaw, fringeSpacingLaw, gratingLaw, indexFromSpeed, lensPowerLaw, magnificationLaw, malusLaw, mirrorEquation, photonEnergyLaw, snellsLaw, thinLensEquation, thinPrismLaw, waveEquation } from "./laws.mjs";
|
|
7
|
+
|
|
8
|
+
export { DEG, MEDIA, OPTICS_LAWS, achromaticApexDeg, apparentDepth, apparentDepthLaw, brewsterAngleDeg, brewstersLaw, brightFringePosition, centralMaximumHalfWidthDeg, centralMaximumWidth, criticalAngleDeg, criticalAngleLaw, darkFringePosition, dispersion, displacementMethod, doubleSlitPattern, focalLengthFromPower, fringeAngleDeg, fringeSpacing, fringeSpacingLaw, fromRealPositive, gratingAngleDeg, gratingLaw, gratingSpacing, indexFromDepths, indexFromMinimumDeviation, indexFromRodAngles, indexFromSpeed, lensMakerFocalLength, lensPower, lensPowerLaw, lensesInContact, lensesSeparated, magnificationLaw, malusIntensity, malusLaw, maximumApexAngleDeg, maximumGratingOrder, minimumDeviationDeg, minimumDeviationIncidenceDeg, minimumObjectImageSeparation, mirrorEquation, mirrorFocalLength, pathFromPhase as pathDifference, phaseFromPath as phaseDifference, photonEnergyLaw, pointSourceIntensity, prismAngleFromMinimumDeviation, prismPath, rayleighResolutionRad, refract, refractAngleDeg, relativeIndex, singleSlitEnvelope, singleSlitMinimumDeg, snellsLaw, speedInMedium, sphericalMirror, sphericalSurface, thinLens, thinLensEquation, thinPrismDeviationDeg, thinPrismLaw, throughSlab, twoSlitIntensity, unpolarisedThroughPolariser, waveEquation, wavelengthFromFringes, wavelengthFromGrating, wavelengthInMedium };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Relation } from "../relation/index.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/optics/laws.d.ts
|
|
4
|
+
/** Multiply a value in degrees by this to get radians, for use in a `solve`. */
|
|
5
|
+
declare const DEG: number;
|
|
6
|
+
/**
|
|
7
|
+
* `n1 * sin(i) = n2 * sin(r)`, Snell's law.
|
|
8
|
+
*
|
|
9
|
+
* Solvable for either index and, since trigonometry inverts, for either angle.
|
|
10
|
+
*
|
|
11
|
+
* Asking for `r` past the critical angle THROWS, because no such angle exists:
|
|
12
|
+
* the engine evaluates its own rearrangement, sees NaN and refuses rather than
|
|
13
|
+
* handing back a number-shaped nothing. That is the right failure for a
|
|
14
|
+
* declared equation, but it is not an explanation, so a lab that needs to SHOW
|
|
15
|
+
* total internal reflection calls `refraction.ts` `refract()`, which names the
|
|
16
|
+
* case and reports the critical angle alongside.
|
|
17
|
+
*/
|
|
18
|
+
declare const snellsLaw: () => Relation;
|
|
19
|
+
/** `sin(c) = n2 / n1`, the critical angle for light leaving the denser medium. */
|
|
20
|
+
declare const criticalAngleLaw: () => Relation;
|
|
21
|
+
/** `n = c / v`, refractive index as the factor by which a medium slows light. */
|
|
22
|
+
declare const indexFromSpeed: () => Relation;
|
|
23
|
+
/** `n = d / a`, refractive index by the apparent-depth method. */
|
|
24
|
+
declare const apparentDepthLaw: () => Relation;
|
|
25
|
+
/** `n = tan(p)`, Brewster's law for the polarising angle. */
|
|
26
|
+
declare const brewstersLaw: () => Relation;
|
|
27
|
+
/**
|
|
28
|
+
* `1 / v - 1 / u = 1 / f`, the thin lens equation in the Cartesian convention.
|
|
29
|
+
*
|
|
30
|
+
* Each variable appears once, so it solves for any of the three. Note that `u`
|
|
31
|
+
* must be given as the NEGATIVE number the convention requires, which is the
|
|
32
|
+
* price of a declaration that is literally the textbook equation;
|
|
33
|
+
* `imaging.ts` `thinLens()` is the one that takes a positive distance and
|
|
34
|
+
* handles the sign.
|
|
35
|
+
*/
|
|
36
|
+
declare const thinLensEquation: () => Relation;
|
|
37
|
+
/** `1 / v + 1 / u = 1 / f`, the mirror equation with distances as positive lengths. */
|
|
38
|
+
declare const mirrorEquation: () => Relation;
|
|
39
|
+
/** `m = h2 / h1`, linear magnification as a height ratio. */
|
|
40
|
+
declare const magnificationLaw: () => Relation;
|
|
41
|
+
/** `P = 1 / f`, lens power in dioptres from a focal length in metres. */
|
|
42
|
+
declare const lensPowerLaw: () => Relation;
|
|
43
|
+
/** `d = (n - 1) * A`, a thin prism's deviation. */
|
|
44
|
+
declare const thinPrismLaw: () => Relation;
|
|
45
|
+
/** `w = lam * D / a`, the fringe spacing in Young's double-slit experiment. */
|
|
46
|
+
declare const fringeSpacingLaw: () => Relation;
|
|
47
|
+
/**
|
|
48
|
+
* `d * sin(t) = k * lam`, the diffraction grating equation.
|
|
49
|
+
*
|
|
50
|
+
* The order is `k` rather than the conventional `n`, because `n` is a
|
|
51
|
+
* refractive index everywhere else in this file and one symbol meaning two
|
|
52
|
+
* things across one module is how a wrong substitution gets written.
|
|
53
|
+
*/
|
|
54
|
+
declare const gratingLaw: () => Relation;
|
|
55
|
+
/** `I = I0 * cos(t)^2`, Malus's law for light through an analyser. */
|
|
56
|
+
declare const malusLaw: () => Relation;
|
|
57
|
+
/** `v = f * lam`, the wave equation, which underlies all of the above. */
|
|
58
|
+
declare const waveEquation: () => Relation;
|
|
59
|
+
/** `E = h * c / lam`, the energy of a photon of a given wavelength. */
|
|
60
|
+
declare const photonEnergyLaw: () => Relation;
|
|
61
|
+
/**
|
|
62
|
+
* Every declared optical law, for a gate that wants to walk them.
|
|
63
|
+
*
|
|
64
|
+
* Built on demand like the rest: touching this array declares all of them,
|
|
65
|
+
* which is exactly what a test that checks they all parse and balance wants,
|
|
66
|
+
* and exactly what a lesson importing one of them does not.
|
|
67
|
+
*/
|
|
68
|
+
declare const OPTICS_LAWS: () => Relation[];
|
|
69
|
+
//#endregion
|
|
70
|
+
export { DEG, OPTICS_LAWS, apparentDepthLaw, brewstersLaw, criticalAngleLaw, fringeSpacingLaw, gratingLaw, indexFromSpeed, lensPowerLaw, magnificationLaw, malusLaw, mirrorEquation, photonEnergyLaw, snellsLaw, thinLensEquation, thinPrismLaw, waveEquation };
|