@classytic/labs 0.1.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 +21 -0
- package/README.md +105 -0
- package/dist/biology/enzyme-rate/index.d.mts +1 -0
- package/dist/biology/enzyme-rate/preset.d.mts +25 -0
- package/dist/biology/enzyme-rate/preset.mjs +256 -0
- package/dist/biology/genetic-cross/core.d.mts +64 -0
- package/dist/biology/genetic-cross/core.mjs +147 -0
- package/dist/biology/genetic-cross/grid.mjs +239 -0
- package/dist/biology/genetic-cross/index.d.mts +3 -0
- package/dist/biology/genetic-cross/preset.d.mts +26 -0
- package/dist/biology/genetic-cross/preset.mjs +184 -0
- package/dist/biology/genetic-cross/sex-linked.d.mts +27 -0
- package/dist/biology/genetic-cross/sex-linked.mjs +226 -0
- package/dist/biology/index.d.mts +11 -0
- package/dist/biology/index.mjs +12 -0
- package/dist/biology/photosynthesis-factors/index.d.mts +1 -0
- package/dist/biology/photosynthesis-factors/preset.d.mts +25 -0
- package/dist/biology/photosynthesis-factors/preset.mjs +270 -0
- package/dist/biology/punnett-cross/index.d.mts +1 -0
- package/dist/biology/punnett-cross/preset.d.mts +27 -0
- package/dist/biology/punnett-cross/preset.mjs +21 -0
- package/dist/biology/respiration/index.d.mts +1 -0
- package/dist/biology/respiration/preset.d.mts +17 -0
- package/dist/biology/respiration/preset.mjs +179 -0
- package/dist/biology/sequence/central-dogma.d.mts +17 -0
- package/dist/biology/sequence/central-dogma.mjs +339 -0
- package/dist/biology/sequence/core.d.mts +38 -0
- package/dist/biology/sequence/core.mjs +178 -0
- package/dist/biology/sequence/index.d.mts +3 -0
- package/dist/biology/sequence/preset.d.mts +20 -0
- package/dist/biology/sequence/preset.mjs +235 -0
- package/dist/blocks/accounting.d.mts +142 -0
- package/dist/blocks/accounting.mjs +446 -0
- package/dist/blocks/authoring.d.mts +12 -0
- package/dist/blocks/authoring.mjs +705 -0
- package/dist/blocks/biology.d.mts +197 -0
- package/dist/blocks/biology.mjs +513 -0
- package/dist/blocks/chem.d.mts +128 -0
- package/dist/blocks/chem.mjs +486 -0
- package/dist/blocks/circuits.d.mts +86 -0
- package/dist/blocks/circuits.mjs +348 -0
- package/dist/blocks/discrete.d.mts +62 -0
- package/dist/blocks/discrete.mjs +314 -0
- package/dist/blocks/economics.d.mts +56 -0
- package/dist/blocks/economics.mjs +203 -0
- package/dist/blocks/geography.d.mts +58 -0
- package/dist/blocks/geography.mjs +115 -0
- package/dist/blocks/geometry.d.mts +28 -0
- package/dist/blocks/geometry.mjs +160 -0
- package/dist/blocks/ict.d.mts +65 -0
- package/dist/blocks/ict.mjs +197 -0
- package/dist/blocks/index.d.mts +4555 -0
- package/dist/blocks/index.mjs +120 -0
- package/dist/blocks/lab-block.d.mts +16 -0
- package/dist/blocks/lab-block.mjs +74 -0
- package/dist/blocks/lab-config.d.mts +23 -0
- package/dist/blocks/lab-config.mjs +200 -0
- package/dist/blocks/lab-gallery.d.mts +30 -0
- package/dist/blocks/lab-gallery.mjs +208 -0
- package/dist/blocks/language.d.mts +349 -0
- package/dist/blocks/language.mjs +750 -0
- package/dist/blocks/lesson.d.mts +43 -0
- package/dist/blocks/lesson.mjs +140 -0
- package/dist/blocks/math.d.mts +411 -0
- package/dist/blocks/math.mjs +1536 -0
- package/dist/blocks/ml.d.mts +84 -0
- package/dist/blocks/ml.mjs +146 -0
- package/dist/blocks/physics.d.mts +259 -0
- package/dist/blocks/physics.mjs +868 -0
- package/dist/blocks/statistics.d.mts +29 -0
- package/dist/blocks/statistics.mjs +123 -0
- package/dist/catalog/index.d.mts +3 -0
- package/dist/catalog/index.mjs +8 -0
- package/dist/catalog/registry.d.mts +46 -0
- package/dist/catalog/registry.mjs +56 -0
- package/dist/catalog/templates.d.mts +11 -0
- package/dist/catalog/templates.mjs +141 -0
- package/dist/chem/battery.d.mts +16 -0
- package/dist/chem/battery.mjs +311 -0
- package/dist/chem/bohr-atom.d.mts +16 -0
- package/dist/chem/bohr-atom.mjs +212 -0
- package/dist/chem/diffusion/asset.mjs +76 -0
- package/dist/chem/diffusion/index.d.mts +1 -0
- package/dist/chem/diffusion/preset.d.mts +15 -0
- package/dist/chem/diffusion/preset.mjs +188 -0
- package/dist/chem/electrochem/index.d.mts +1 -0
- package/dist/chem/electrochem/preset.d.mts +23 -0
- package/dist/chem/electrochem/preset.mjs +402 -0
- package/dist/chem/equilibrium/index.d.mts +1 -0
- package/dist/chem/equilibrium/preset.d.mts +36 -0
- package/dist/chem/equilibrium/preset.mjs +416 -0
- package/dist/chem/gas-box/index.d.mts +1 -0
- package/dist/chem/gas-box/preset.d.mts +27 -0
- package/dist/chem/gas-box/preset.mjs +395 -0
- package/dist/chem/index.d.mts +16 -0
- package/dist/chem/index.mjs +17 -0
- package/dist/chem/kinetics/index.d.mts +1 -0
- package/dist/chem/kinetics/preset.d.mts +31 -0
- package/dist/chem/kinetics/preset.mjs +478 -0
- package/dist/chem/periodic-trends/index.d.mts +1 -0
- package/dist/chem/periodic-trends/preset.d.mts +21 -0
- package/dist/chem/periodic-trends/preset.mjs +831 -0
- package/dist/chem/reaction-lab.d.mts +18 -0
- package/dist/chem/reaction-lab.mjs +165 -0
- package/dist/chem/reaction-profile.d.mts +21 -0
- package/dist/chem/reaction-profile.mjs +287 -0
- package/dist/chem/solution/dilution.d.mts +27 -0
- package/dist/chem/solution/dilution.mjs +199 -0
- package/dist/chem/solution/field.d.mts +30 -0
- package/dist/chem/solution/field.mjs +145 -0
- package/dist/chem/solution/index.d.mts +3 -0
- package/dist/chem/solution/solution-box.d.mts +28 -0
- package/dist/chem/solution/solution-box.mjs +140 -0
- package/dist/chem/stoichiometry/index.d.mts +1 -0
- package/dist/chem/stoichiometry/preset.d.mts +29 -0
- package/dist/chem/stoichiometry/preset.mjs +392 -0
- package/dist/chem/titration/index.d.mts +1 -0
- package/dist/chem/titration/preset.d.mts +29 -0
- package/dist/chem/titration/preset.mjs +436 -0
- package/dist/circuits/ac-dc/asset.mjs +295 -0
- package/dist/circuits/ac-dc/index.d.mts +1 -0
- package/dist/circuits/ac-dc/preset.d.mts +16 -0
- package/dist/circuits/ac-dc/preset.mjs +134 -0
- package/dist/circuits/capacitor-leak/index.d.mts +1 -0
- package/dist/circuits/capacitor-leak/preset.d.mts +32 -0
- package/dist/circuits/capacitor-leak/preset.mjs +271 -0
- package/dist/circuits/circuit/asset.d.mts +6 -0
- package/dist/circuits/circuit/asset.mjs +367 -0
- package/dist/circuits/circuit/index.d.mts +2 -0
- package/dist/circuits/circuit/preset.d.mts +46 -0
- package/dist/circuits/circuit/preset.mjs +235 -0
- package/dist/circuits/circuit-builder.d.mts +30 -0
- package/dist/circuits/circuit-builder.mjs +412 -0
- package/dist/circuits/circuit-lab.d.mts +20 -0
- package/dist/circuits/circuit-lab.mjs +400 -0
- package/dist/circuits/index.d.mts +7 -0
- package/dist/circuits/index.mjs +8 -0
- package/dist/commerce/accounting/core.d.mts +48 -0
- package/dist/commerce/accounting/core.mjs +57 -0
- package/dist/commerce/accounting/equation-balance.d.mts +35 -0
- package/dist/commerce/accounting/equation-balance.mjs +292 -0
- package/dist/commerce/accounting/index.d.mts +4 -0
- package/dist/commerce/accounting/journal-poster.d.mts +29 -0
- package/dist/commerce/accounting/journal-poster.mjs +472 -0
- package/dist/commerce/accounting/statement-sorter.d.mts +25 -0
- package/dist/commerce/accounting/statement-sorter.mjs +304 -0
- package/dist/commerce/economics/core.d.mts +33 -0
- package/dist/commerce/economics/core.mjs +26 -0
- package/dist/commerce/economics/demand-shift-vs-move.d.mts +35 -0
- package/dist/commerce/economics/demand-shift-vs-move.mjs +324 -0
- package/dist/commerce/economics/elasticity-revenue.d.mts +31 -0
- package/dist/commerce/economics/elasticity-revenue.mjs +253 -0
- package/dist/commerce/economics/index.d.mts +4 -0
- package/dist/commerce/economics/market-equilibrium.d.mts +33 -0
- package/dist/commerce/economics/market-equilibrium.mjs +340 -0
- package/dist/commerce/index.d.mts +9 -0
- package/dist/commerce/index.mjs +10 -0
- package/dist/core/easing.d.mts +28 -0
- package/dist/core/easing.mjs +66 -0
- package/dist/core/index.d.mts +10 -0
- package/dist/core/index.mjs +11 -0
- package/dist/core/numeric.d.mts +37 -0
- package/dist/core/numeric.mjs +75 -0
- package/dist/core/reactive.d.mts +24 -0
- package/dist/core/reactive.mjs +51 -0
- package/dist/core/rng.d.mts +21 -0
- package/dist/core/rng.mjs +39 -0
- package/dist/core/tex.d.mts +14 -0
- package/dist/core/tex.mjs +44 -0
- package/dist/core/timeline.d.mts +34 -0
- package/dist/core/timeline.mjs +77 -0
- package/dist/core/util.d.mts +19 -0
- package/dist/core/util.mjs +31 -0
- package/dist/discrete/arrangements/preset.d.mts +28 -0
- package/dist/discrete/arrangements/preset.mjs +304 -0
- package/dist/discrete/bayes/preset.d.mts +33 -0
- package/dist/discrete/bayes/preset.mjs +476 -0
- package/dist/discrete/binomial/preset.d.mts +25 -0
- package/dist/discrete/binomial/preset.mjs +333 -0
- package/dist/discrete/core/combinatorics.d.mts +23 -0
- package/dist/discrete/core/combinatorics.mjs +57 -0
- package/dist/discrete/core/inclusionExclusion.d.mts +19 -0
- package/dist/discrete/core/inclusionExclusion.mjs +30 -0
- package/dist/discrete/core/pigeonhole.d.mts +15 -0
- package/dist/discrete/core/pigeonhole.mjs +24 -0
- package/dist/discrete/core/probability.d.mts +29 -0
- package/dist/discrete/core/probability.mjs +43 -0
- package/dist/discrete/core/sets.d.mts +21 -0
- package/dist/discrete/core/sets.mjs +45 -0
- package/dist/discrete/counting-slots/preset.d.mts +30 -0
- package/dist/discrete/counting-slots/preset.mjs +553 -0
- package/dist/discrete/counting-tree/index.d.mts +1 -0
- package/dist/discrete/counting-tree/preset.d.mts +44 -0
- package/dist/discrete/counting-tree/preset.mjs +364 -0
- package/dist/discrete/expected-value/preset.d.mts +28 -0
- package/dist/discrete/expected-value/preset.mjs +352 -0
- package/dist/discrete/hypergeometric/preset.d.mts +25 -0
- package/dist/discrete/hypergeometric/preset.mjs +330 -0
- package/dist/discrete/index.d.mts +26 -0
- package/dist/discrete/index.mjs +27 -0
- package/dist/discrete/karnaugh/index.d.mts +1 -0
- package/dist/discrete/karnaugh/preset.d.mts +30 -0
- package/dist/discrete/karnaugh/preset.mjs +452 -0
- package/dist/discrete/lln/asset.mjs +206 -0
- package/dist/discrete/lln/index.d.mts +1 -0
- package/dist/discrete/lln/preset.d.mts +17 -0
- package/dist/discrete/lln/preset.mjs +152 -0
- package/dist/discrete/logic-circuit/index.d.mts +1 -0
- package/dist/discrete/logic-circuit/preset.d.mts +47 -0
- package/dist/discrete/logic-circuit/preset.mjs +307 -0
- package/dist/discrete/monte-carlo/index.d.mts +1 -0
- package/dist/discrete/monte-carlo/preset.d.mts +64 -0
- package/dist/discrete/monte-carlo/preset.mjs +446 -0
- package/dist/discrete/monty-hall/index.d.mts +1 -0
- package/dist/discrete/monty-hall/preset.d.mts +23 -0
- package/dist/discrete/monty-hall/preset.mjs +491 -0
- package/dist/discrete/outcome-builder/preset.d.mts +24 -0
- package/dist/discrete/outcome-builder/preset.mjs +283 -0
- package/dist/discrete/pascal/preset.d.mts +24 -0
- package/dist/discrete/pascal/preset.mjs +372 -0
- package/dist/discrete/sample-space/index.d.mts +1 -0
- package/dist/discrete/sample-space/preset.d.mts +42 -0
- package/dist/discrete/sample-space/preset.mjs +395 -0
- package/dist/discrete/selection/preset.d.mts +33 -0
- package/dist/discrete/selection/preset.mjs +406 -0
- package/dist/discrete/truth-table/index.d.mts +1 -0
- package/dist/discrete/truth-table/preset.d.mts +30 -0
- package/dist/discrete/truth-table/preset.mjs +456 -0
- package/dist/discrete/venn/index.d.mts +1 -0
- package/dist/discrete/venn/preset.d.mts +32 -0
- package/dist/discrete/venn/preset.mjs +461 -0
- package/dist/geography/cycle-lab/index.d.mts +1 -0
- package/dist/geography/cycle-lab/preset.d.mts +25 -0
- package/dist/geography/cycle-lab/preset.mjs +254 -0
- package/dist/geography/cycles.d.mts +21 -0
- package/dist/geography/cycles.mjs +205 -0
- package/dist/geography/index.d.mts +4 -0
- package/dist/geography/index.mjs +5 -0
- package/dist/geometry/board/index.d.mts +1 -0
- package/dist/geometry/board/preset.d.mts +71 -0
- package/dist/geometry/board/preset.mjs +148 -0
- package/dist/geometry/builder.d.mts +18 -0
- package/dist/geometry/builder.mjs +332 -0
- package/dist/geometry/index.d.mts +4 -0
- package/dist/geometry/index.mjs +5 -0
- package/dist/geometry/intersecting-circles.d.mts +17 -0
- package/dist/geometry/intersecting-circles.mjs +104 -0
- package/dist/ict/index.d.mts +5 -0
- package/dist/ict/index.mjs +6 -0
- package/dist/ict/number-systems/base-odometer.d.mts +34 -0
- package/dist/ict/number-systems/base-odometer.mjs +160 -0
- package/dist/ict/number-systems/bit-grouper.d.mts +32 -0
- package/dist/ict/number-systems/bit-grouper.mjs +190 -0
- package/dist/ict/number-systems/index.d.mts +4 -0
- package/dist/ict/number-systems/place-value-dial.d.mts +29 -0
- package/dist/ict/number-systems/place-value-dial.mjs +153 -0
- package/dist/ict/number-systems/wheel.d.mts +73 -0
- package/dist/ict/number-systems/wheel.mjs +279 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +11 -0
- package/dist/kit/anim.mjs +52 -0
- package/dist/kit/annotate.mjs +116 -0
- package/dist/kit/answer-check.d.mts +38 -0
- package/dist/kit/answer-check.mjs +65 -0
- package/dist/kit/asset-util.mjs +15 -0
- package/dist/kit/controls.mjs +77 -0
- package/dist/kit/cycle.d.mts +44 -0
- package/dist/kit/cycle.mjs +188 -0
- package/dist/kit/diagram.mjs +176 -0
- package/dist/kit/electronics.mjs +357 -0
- package/dist/kit/expr-analysis.d.mts +37 -0
- package/dist/kit/expr-analysis.mjs +111 -0
- package/dist/kit/frame.d.mts +70 -0
- package/dist/kit/frame.mjs +205 -0
- package/dist/kit/freq-tree.mjs +99 -0
- package/dist/kit/gameshow.mjs +315 -0
- package/dist/kit/index.d.mts +5 -0
- package/dist/kit/index.mjs +6 -0
- package/dist/kit/logic-gates.d.mts +6 -0
- package/dist/kit/logic-gates.mjs +210 -0
- package/dist/kit/molecules.mjs +178 -0
- package/dist/kit/pedagogy.d.mts +126 -0
- package/dist/kit/pedagogy.mjs +331 -0
- package/dist/kit/play.d.mts +21 -0
- package/dist/kit/play.mjs +52 -0
- package/dist/kit/probability.mjs +141 -0
- package/dist/kit/proportion.mjs +112 -0
- package/dist/kit/reaction.mjs +102 -0
- package/dist/kit/rich.d.mts +10 -0
- package/dist/kit/rich.mjs +21 -0
- package/dist/kit/scale.mjs +230 -0
- package/dist/kit/space.mjs +326 -0
- package/dist/kit/steps.d.mts +24 -0
- package/dist/kit/steps.mjs +57 -0
- package/dist/kit/thermal.mjs +289 -0
- package/dist/language/agreement/index.d.mts +1 -0
- package/dist/language/agreement/preset.d.mts +27 -0
- package/dist/language/agreement/preset.mjs +113 -0
- package/dist/language/article-lens/index.d.mts +1 -0
- package/dist/language/article-lens/preset.d.mts +31 -0
- package/dist/language/article-lens/preset.mjs +125 -0
- package/dist/language/deck.d.mts +45 -0
- package/dist/language/deck.mjs +61 -0
- package/dist/language/icon.d.mts +40 -0
- package/dist/language/icon.mjs +73 -0
- package/dist/language/index.d.mts +10 -0
- package/dist/language/index.mjs +11 -0
- package/dist/language/preposition-scene/index.d.mts +1 -0
- package/dist/language/preposition-scene/preset.d.mts +34 -0
- package/dist/language/preposition-scene/preset.mjs +234 -0
- package/dist/language/sentence-builder/index.d.mts +1 -0
- package/dist/language/sentence-builder/preset.d.mts +32 -0
- package/dist/language/sentence-builder/preset.mjs +122 -0
- package/dist/language/transform/index.d.mts +1 -0
- package/dist/language/transform/preset.d.mts +31 -0
- package/dist/language/transform/preset.mjs +137 -0
- package/dist/language/ui.d.mts +53 -0
- package/dist/language/ui.mjs +88 -0
- package/dist/language/word-match/index.d.mts +1 -0
- package/dist/language/word-match/preset.d.mts +22 -0
- package/dist/language/word-match/preset.mjs +148 -0
- package/dist/math/area-model/asset.d.mts +6 -0
- package/dist/math/area-model/asset.mjs +270 -0
- package/dist/math/area-model/index.d.mts +2 -0
- package/dist/math/area-model/preset.d.mts +29 -0
- package/dist/math/area-model/preset.mjs +243 -0
- package/dist/math/balance-algebra/asset.d.mts +6 -0
- package/dist/math/balance-algebra/asset.mjs +150 -0
- package/dist/math/balance-algebra/index.d.mts +2 -0
- package/dist/math/balance-algebra/preset.d.mts +30 -0
- package/dist/math/balance-algebra/preset.mjs +228 -0
- package/dist/math/derivation.d.mts +22 -0
- package/dist/math/derivation.mjs +113 -0
- package/dist/math/derivative-explorer/index.d.mts +1 -0
- package/dist/math/derivative-explorer/preset.d.mts +19 -0
- package/dist/math/derivative-explorer/preset.mjs +227 -0
- package/dist/math/function-machine/index.d.mts +1 -0
- package/dist/math/function-machine/preset.d.mts +21 -0
- package/dist/math/function-machine/preset.mjs +177 -0
- package/dist/math/gradient-descent.d.mts +23 -0
- package/dist/math/gradient-descent.mjs +473 -0
- package/dist/math/grapher/index.d.mts +1 -0
- package/dist/math/grapher/preset.d.mts +40 -0
- package/dist/math/grapher/preset.mjs +313 -0
- package/dist/math/harmonic-form/index.d.mts +1 -0
- package/dist/math/harmonic-form/preset.d.mts +21 -0
- package/dist/math/harmonic-form/preset.mjs +387 -0
- package/dist/math/index.d.mts +25 -0
- package/dist/math/index.mjs +26 -0
- package/dist/math/integral-explorer/index.d.mts +1 -0
- package/dist/math/integral-explorer/preset.d.mts +23 -0
- package/dist/math/integral-explorer/preset.mjs +217 -0
- package/dist/math/interactive/index.d.mts +1 -0
- package/dist/math/interactive/preset.d.mts +72 -0
- package/dist/math/interactive/preset.mjs +202 -0
- package/dist/math/limit-explorer/index.d.mts +1 -0
- package/dist/math/limit-explorer/preset.d.mts +19 -0
- package/dist/math/limit-explorer/preset.mjs +216 -0
- package/dist/math/linear-system/index.d.mts +1 -0
- package/dist/math/linear-system/preset.d.mts +28 -0
- package/dist/math/linear-system/preset.mjs +164 -0
- package/dist/math/mystery-bucket/asset.d.mts +6 -0
- package/dist/math/mystery-bucket/asset.mjs +145 -0
- package/dist/math/mystery-bucket/index.d.mts +2 -0
- package/dist/math/mystery-bucket/preset.d.mts +36 -0
- package/dist/math/mystery-bucket/preset.mjs +116 -0
- package/dist/math/number-line/index.d.mts +1 -0
- package/dist/math/number-line/preset.d.mts +24 -0
- package/dist/math/number-line/preset.mjs +142 -0
- package/dist/math/parabola/index.d.mts +1 -0
- package/dist/math/parabola/preset.d.mts +13 -0
- package/dist/math/parabola/preset.mjs +79 -0
- package/dist/math/pattern/asset.d.mts +6 -0
- package/dist/math/pattern/asset.mjs +102 -0
- package/dist/math/pattern/index.d.mts +2 -0
- package/dist/math/pattern/preset.d.mts +32 -0
- package/dist/math/pattern/preset.mjs +294 -0
- package/dist/math/triangle-trig/index.d.mts +1 -0
- package/dist/math/triangle-trig/preset.d.mts +47 -0
- package/dist/math/triangle-trig/preset.mjs +245 -0
- package/dist/math/trig-explorer.d.mts +18 -0
- package/dist/math/trig-explorer.mjs +209 -0
- package/dist/ml/boundary/index.d.mts +1 -0
- package/dist/ml/boundary/preset.d.mts +24 -0
- package/dist/ml/boundary/preset.mjs +385 -0
- package/dist/ml/classifier/index.d.mts +1 -0
- package/dist/ml/classifier/preset.d.mts +25 -0
- package/dist/ml/classifier/preset.mjs +315 -0
- package/dist/ml/index.d.mts +6 -0
- package/dist/ml/index.mjs +7 -0
- package/dist/ml/kmeans/index.d.mts +1 -0
- package/dist/ml/kmeans/preset.d.mts +33 -0
- package/dist/ml/kmeans/preset.mjs +236 -0
- package/dist/ml/knn/index.d.mts +1 -0
- package/dist/ml/knn/preset.d.mts +28 -0
- package/dist/ml/knn/preset.mjs +279 -0
- package/dist/ml/regression/index.d.mts +1 -0
- package/dist/ml/regression/preset.d.mts +32 -0
- package/dist/ml/regression/preset.mjs +394 -0
- package/dist/physics/atwood/index.d.mts +1 -0
- package/dist/physics/atwood/preset.d.mts +23 -0
- package/dist/physics/atwood/preset.mjs +312 -0
- package/dist/physics/bullet-walls/index.d.mts +1 -0
- package/dist/physics/bullet-walls/preset.d.mts +28 -0
- package/dist/physics/bullet-walls/preset.mjs +373 -0
- package/dist/physics/carnot/index.d.mts +1 -0
- package/dist/physics/carnot/preset.d.mts +27 -0
- package/dist/physics/carnot/preset.mjs +427 -0
- package/dist/physics/circular-motion/index.d.mts +1 -0
- package/dist/physics/circular-motion/preset.d.mts +25 -0
- package/dist/physics/circular-motion/preset.mjs +293 -0
- package/dist/physics/collision-track/index.d.mts +1 -0
- package/dist/physics/collision-track/preset.d.mts +27 -0
- package/dist/physics/collision-track/preset.mjs +352 -0
- package/dist/physics/efficiency/index.d.mts +1 -0
- package/dist/physics/efficiency/preset.d.mts +33 -0
- package/dist/physics/efficiency/preset.mjs +343 -0
- package/dist/physics/electric-field/index.d.mts +1 -0
- package/dist/physics/electric-field/preset.d.mts +15 -0
- package/dist/physics/electric-field/preset.mjs +306 -0
- package/dist/physics/energy-skate/index.d.mts +1 -0
- package/dist/physics/energy-skate/preset.d.mts +25 -0
- package/dist/physics/energy-skate/preset.mjs +254 -0
- package/dist/physics/entropy/index.d.mts +1 -0
- package/dist/physics/entropy/preset.d.mts +18 -0
- package/dist/physics/entropy/preset.mjs +416 -0
- package/dist/physics/expansion/index.d.mts +1 -0
- package/dist/physics/expansion/preset.d.mts +26 -0
- package/dist/physics/expansion/preset.mjs +609 -0
- package/dist/physics/exponential/asset.mjs +221 -0
- package/dist/physics/exponential/index.d.mts +1 -0
- package/dist/physics/exponential/preset.d.mts +17 -0
- package/dist/physics/exponential/preset.mjs +182 -0
- package/dist/physics/gas-process/index.d.mts +1 -0
- package/dist/physics/gas-process/preset.d.mts +30 -0
- package/dist/physics/gas-process/preset.mjs +384 -0
- package/dist/physics/gravitation/index.d.mts +1 -0
- package/dist/physics/gravitation/preset.d.mts +24 -0
- package/dist/physics/gravitation/preset.mjs +345 -0
- package/dist/physics/gravity-drop.d.mts +9 -0
- package/dist/physics/gravity-drop.mjs +187 -0
- package/dist/physics/heat-transfer/index.d.mts +1 -0
- package/dist/physics/heat-transfer/preset.d.mts +27 -0
- package/dist/physics/heat-transfer/preset.mjs +626 -0
- package/dist/physics/impulse/index.d.mts +1 -0
- package/dist/physics/impulse/preset.d.mts +29 -0
- package/dist/physics/impulse/preset.mjs +453 -0
- package/dist/physics/index.d.mts +43 -0
- package/dist/physics/index.mjs +44 -0
- package/dist/physics/kepler/index.d.mts +1 -0
- package/dist/physics/kepler/preset.d.mts +27 -0
- package/dist/physics/kepler/preset.mjs +257 -0
- package/dist/physics/lever/asset.d.mts +6 -0
- package/dist/physics/lever/asset.mjs +220 -0
- package/dist/physics/lever/index.d.mts +2 -0
- package/dist/physics/lever/preset.d.mts +31 -0
- package/dist/physics/lever/preset.mjs +261 -0
- package/dist/physics/lorentz/index.d.mts +1 -0
- package/dist/physics/lorentz/preset.d.mts +29 -0
- package/dist/physics/lorentz/preset.mjs +367 -0
- package/dist/physics/magnetism/index.d.mts +1 -0
- package/dist/physics/magnetism/preset.d.mts +15 -0
- package/dist/physics/magnetism/preset.mjs +334 -0
- package/dist/physics/optics/asset.d.mts +6 -0
- package/dist/physics/optics/asset.mjs +234 -0
- package/dist/physics/optics/index.d.mts +2 -0
- package/dist/physics/optics/preset.d.mts +14 -0
- package/dist/physics/optics/preset.mjs +202 -0
- package/dist/physics/orbit-lab.d.mts +6 -0
- package/dist/physics/orbit-lab.mjs +222 -0
- package/dist/physics/projectile-lab.d.mts +10 -0
- package/dist/physics/projectile-lab.mjs +354 -0
- package/dist/physics/rain-relative/index.d.mts +1 -0
- package/dist/physics/rain-relative/preset.d.mts +19 -0
- package/dist/physics/rain-relative/preset.mjs +358 -0
- package/dist/physics/ramp-forces/index.d.mts +1 -0
- package/dist/physics/ramp-forces/preset.d.mts +36 -0
- package/dist/physics/ramp-forces/preset.mjs +550 -0
- package/dist/physics/river-boat.d.mts +22 -0
- package/dist/physics/river-boat.mjs +498 -0
- package/dist/physics/shm/index.d.mts +1 -0
- package/dist/physics/shm/preset.d.mts +33 -0
- package/dist/physics/shm/preset.mjs +554 -0
- package/dist/physics/stopping-distance/index.d.mts +1 -0
- package/dist/physics/stopping-distance/preset.d.mts +29 -0
- package/dist/physics/stopping-distance/preset.mjs +662 -0
- package/dist/physics/temperature-scales/index.d.mts +1 -0
- package/dist/physics/temperature-scales/preset.d.mts +15 -0
- package/dist/physics/temperature-scales/preset.mjs +353 -0
- package/dist/physics/terminal-velocity/index.d.mts +1 -0
- package/dist/physics/terminal-velocity/preset.d.mts +26 -0
- package/dist/physics/terminal-velocity/preset.mjs +404 -0
- package/dist/physics/thermal/index.d.mts +1 -0
- package/dist/physics/thermal/preset.d.mts +44 -0
- package/dist/physics/thermal/preset.mjs +373 -0
- package/dist/physics/vector-board/index.d.mts +1 -0
- package/dist/physics/vector-board/preset.d.mts +65 -0
- package/dist/physics/vector-board/preset.mjs +273 -0
- package/dist/physics/vector-board/view.d.mts +49 -0
- package/dist/physics/vector-board/view.mjs +58 -0
- package/dist/physics/vector-scene.d.mts +41 -0
- package/dist/physics/vector-scene.mjs +211 -0
- package/dist/physics/vector-types/index.d.mts +1 -0
- package/dist/physics/vector-types/preset.d.mts +27 -0
- package/dist/physics/vector-types/preset.mjs +192 -0
- package/dist/physics/water-density/index.d.mts +1 -0
- package/dist/physics/water-density/preset.d.mts +18 -0
- package/dist/physics/water-density/preset.mjs +439 -0
- package/dist/physics/waves/core.mjs +33 -0
- package/dist/physics/waves/doppler.d.mts +23 -0
- package/dist/physics/waves/doppler.mjs +260 -0
- package/dist/physics/waves/index.d.mts +4 -0
- package/dist/physics/waves/preset.d.mts +30 -0
- package/dist/physics/waves/preset.mjs +488 -0
- package/dist/physics/waves/ripple.d.mts +26 -0
- package/dist/physics/waves/ripple.mjs +234 -0
- package/dist/physics/waves/string.d.mts +29 -0
- package/dist/physics/waves/string.mjs +289 -0
- package/dist/physics/work-energy/index.d.mts +1 -0
- package/dist/physics/work-energy/preset.d.mts +17 -0
- package/dist/physics/work-energy/preset.mjs +341 -0
- package/dist/schemas/index.d.mts +235 -0
- package/dist/schemas/index.mjs +145 -0
- package/dist/statistics/center-spread/preset.d.mts +34 -0
- package/dist/statistics/center-spread/preset.mjs +323 -0
- package/dist/statistics/core/descriptive.d.mts +35 -0
- package/dist/statistics/core/descriptive.mjs +64 -0
- package/dist/statistics/core/normal.d.mts +21 -0
- package/dist/statistics/core/normal.mjs +37 -0
- package/dist/statistics/core/sequences.d.mts +27 -0
- package/dist/statistics/core/sequences.mjs +35 -0
- package/dist/statistics/galton/preset.d.mts +27 -0
- package/dist/statistics/galton/preset.mjs +331 -0
- package/dist/statistics/histogram/preset.d.mts +27 -0
- package/dist/statistics/histogram/preset.mjs +385 -0
- package/dist/statistics/index.d.mts +11 -0
- package/dist/statistics/index.mjs +12 -0
- package/dist/statistics/normal/preset.d.mts +30 -0
- package/dist/statistics/normal/preset.mjs +400 -0
- package/dist/statistics/sampling/preset.d.mts +32 -0
- package/dist/statistics/sampling/preset.mjs +406 -0
- package/dist/statistics/sequence/preset.d.mts +28 -0
- package/dist/statistics/sequence/preset.mjs +302 -0
- package/dist/statistics/z-table/preset.d.mts +28 -0
- package/dist/statistics/z-table/preset.mjs +348 -0
- package/package.json +266 -0
- package/styles.css +267 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BALANCE_ALGEBRA_ASSET } from "./asset.mjs";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { SceneDoc } from "@classytic/stage";
|
|
4
|
+
|
|
5
|
+
//#region src/math/balance-algebra/preset.d.ts
|
|
6
|
+
interface BalanceEquation {
|
|
7
|
+
coef: number;
|
|
8
|
+
addend: number;
|
|
9
|
+
rhs: number;
|
|
10
|
+
answer: number;
|
|
11
|
+
}
|
|
12
|
+
declare function balanceAlgebraDoc(eq: BalanceEquation): SceneDoc;
|
|
13
|
+
interface BalanceAlgebraProps {
|
|
14
|
+
coef?: number;
|
|
15
|
+
addend?: number;
|
|
16
|
+
rhs?: number;
|
|
17
|
+
answer?: number;
|
|
18
|
+
controlId?: string;
|
|
19
|
+
height?: number;
|
|
20
|
+
}
|
|
21
|
+
declare function BalanceAlgebraLab({
|
|
22
|
+
coef,
|
|
23
|
+
addend,
|
|
24
|
+
rhs,
|
|
25
|
+
answer,
|
|
26
|
+
controlId,
|
|
27
|
+
height
|
|
28
|
+
}: BalanceAlgebraProps): ReactNode;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { BalanceAlgebraLab, BalanceAlgebraProps, BalanceEquation, balanceAlgebraDoc };
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { LabStyles, Slider, StatusPill } from "../../kit/controls.mjs";
|
|
4
|
+
import { ControlBar, Field, LabFrame, LiveRegion } from "../../kit/frame.mjs";
|
|
5
|
+
import { useCheckpoint } from "../../kit/pedagogy.mjs";
|
|
6
|
+
import { BALANCE_ALGEBRA_ASSET } from "./asset.mjs";
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Scene, controlsFromScene, registerAsset, resolve, useControlSurface, useEditor } from "@classytic/stage";
|
|
10
|
+
|
|
11
|
+
//#region src/math/balance-algebra/preset.tsx
|
|
12
|
+
/**
|
|
13
|
+
* Balance-scale algebra flagship — a SceneDoc FACTORY (a general tool for any
|
|
14
|
+
* a·x + b = c), built on @classytic/stage. All "logic" is typed numeric
|
|
15
|
+
* derivations that actually evaluate: L = a·x+b (linop), diff = L−R, tilt =
|
|
16
|
+
* clamp(3·diff), balanced = (diff == 0). Solving the equation == balancing.
|
|
17
|
+
*/
|
|
18
|
+
registerAsset("balance-algebra", BALANCE_ALGEBRA_ASSET);
|
|
19
|
+
function balanceAlgebraDoc(eq) {
|
|
20
|
+
const maxX = Math.max(8, eq.answer + 2);
|
|
21
|
+
return {
|
|
22
|
+
schemaVersion: 2,
|
|
23
|
+
type: "stage-scene",
|
|
24
|
+
view: {
|
|
25
|
+
xMin: -5,
|
|
26
|
+
xMax: 5,
|
|
27
|
+
yMin: -1.55,
|
|
28
|
+
yMax: 1.6
|
|
29
|
+
},
|
|
30
|
+
elements: [
|
|
31
|
+
{
|
|
32
|
+
id: "x",
|
|
33
|
+
kind: "scalar",
|
|
34
|
+
label: "x",
|
|
35
|
+
a11y: { label: "unknown x" },
|
|
36
|
+
free: {
|
|
37
|
+
value: Math.min(maxX, Math.max(0, Math.round(eq.answer / 2) || 1)),
|
|
38
|
+
min: 0,
|
|
39
|
+
max: maxX,
|
|
40
|
+
step: 1
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "L",
|
|
45
|
+
kind: "scalar",
|
|
46
|
+
def: {
|
|
47
|
+
op: "linop",
|
|
48
|
+
terms: [{
|
|
49
|
+
coef: eq.coef,
|
|
50
|
+
in: { ref: "x" }
|
|
51
|
+
}],
|
|
52
|
+
const: eq.addend
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "R",
|
|
57
|
+
kind: "scalar",
|
|
58
|
+
def: {
|
|
59
|
+
op: "linop",
|
|
60
|
+
terms: [],
|
|
61
|
+
const: eq.rhs
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "diff",
|
|
66
|
+
kind: "scalar",
|
|
67
|
+
def: {
|
|
68
|
+
op: "linop",
|
|
69
|
+
terms: [{
|
|
70
|
+
coef: 1,
|
|
71
|
+
in: { ref: "L" }
|
|
72
|
+
}, {
|
|
73
|
+
coef: -1,
|
|
74
|
+
in: { ref: "R" }
|
|
75
|
+
}]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: "tiltRaw",
|
|
80
|
+
kind: "scalar",
|
|
81
|
+
def: {
|
|
82
|
+
op: "linop",
|
|
83
|
+
terms: [{
|
|
84
|
+
coef: 3,
|
|
85
|
+
in: { ref: "diff" }
|
|
86
|
+
}]
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "tilt",
|
|
91
|
+
kind: "scalar",
|
|
92
|
+
def: {
|
|
93
|
+
op: "clamp",
|
|
94
|
+
in: { ref: "tiltRaw" },
|
|
95
|
+
min: -14,
|
|
96
|
+
max: 14
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "balanced",
|
|
101
|
+
kind: "boolean",
|
|
102
|
+
def: {
|
|
103
|
+
op: "compare",
|
|
104
|
+
a: { ref: "diff" },
|
|
105
|
+
b: 0,
|
|
106
|
+
cmp: "eq",
|
|
107
|
+
eps: .001
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "scale",
|
|
112
|
+
kind: "asset",
|
|
113
|
+
def: {
|
|
114
|
+
op: "asset",
|
|
115
|
+
asset: "balance-algebra",
|
|
116
|
+
params: {
|
|
117
|
+
pivot: {
|
|
118
|
+
x: 0,
|
|
119
|
+
y: .4
|
|
120
|
+
},
|
|
121
|
+
arm: 3.3,
|
|
122
|
+
coef: eq.coef,
|
|
123
|
+
addend: eq.addend,
|
|
124
|
+
rhs: eq.rhs
|
|
125
|
+
},
|
|
126
|
+
bind: {
|
|
127
|
+
x: { ref: "x" },
|
|
128
|
+
tilt: { ref: "tilt" },
|
|
129
|
+
balanced: { ref: "balanced" }
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
bindings: [],
|
|
135
|
+
meta: { pedagogy: {
|
|
136
|
+
objectives: ["Solve a linear equation a·x + b = c by keeping a balance level"],
|
|
137
|
+
misconceptions: [{
|
|
138
|
+
trigger: "sets x so one side is heavier",
|
|
139
|
+
note: "doing a thing to one side only — both sides must stay equal"
|
|
140
|
+
}],
|
|
141
|
+
hints: ["What single value of x makes both pans weigh the same?", `Try x = ${eq.answer}.`],
|
|
142
|
+
difficulty: 2,
|
|
143
|
+
successCriteria: "The beam is level (left load = right load)."
|
|
144
|
+
} }
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function BalanceAlgebraLab({ coef = 2, addend = 1, rhs = 7, answer = 3, controlId, height = 280 }) {
|
|
148
|
+
const { editor, doc } = useEditor(useMemo(() => balanceAlgebraDoc({
|
|
149
|
+
coef,
|
|
150
|
+
addend,
|
|
151
|
+
rhs,
|
|
152
|
+
answer
|
|
153
|
+
}), [
|
|
154
|
+
coef,
|
|
155
|
+
addend,
|
|
156
|
+
rhs,
|
|
157
|
+
answer
|
|
158
|
+
]));
|
|
159
|
+
const resolved = resolve(doc);
|
|
160
|
+
const x = Number(resolved.values.get("x") ?? 0);
|
|
161
|
+
const L = Number(resolved.values.get("L") ?? 0);
|
|
162
|
+
const R = Number(resolved.values.get("R") ?? 0);
|
|
163
|
+
const balanced = resolved.values.get("balanced") === true;
|
|
164
|
+
const maxX = Math.max(8, answer + 2);
|
|
165
|
+
useControlSurface(controlId, useMemo(() => controlsFromScene(editor, [{
|
|
166
|
+
id: "x",
|
|
167
|
+
name: "x",
|
|
168
|
+
min: 0,
|
|
169
|
+
max: maxX,
|
|
170
|
+
step: 1
|
|
171
|
+
}]), [editor, maxX]));
|
|
172
|
+
useCheckpoint({
|
|
173
|
+
solved: balanced,
|
|
174
|
+
activity: `solve-${coef}x+${addend}=${rhs}`,
|
|
175
|
+
response: String(x)
|
|
176
|
+
});
|
|
177
|
+
const setX = (v) => {
|
|
178
|
+
editor.dispatch({
|
|
179
|
+
op: "mutate",
|
|
180
|
+
id: "x",
|
|
181
|
+
patch: { free: { value: v } }
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
const eqLabel = `${coef === 1 ? "" : coef}x${addend ? ` + ${addend}` : ""} = ${rhs}`;
|
|
185
|
+
const figure = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(LabStyles, {}), /* @__PURE__ */ jsx(Scene, {
|
|
186
|
+
doc,
|
|
187
|
+
interactive: false,
|
|
188
|
+
showGrid: false,
|
|
189
|
+
showAxes: false,
|
|
190
|
+
height,
|
|
191
|
+
ariaLabel: `Balance scale for ${eqLabel}`
|
|
192
|
+
})] });
|
|
193
|
+
return /* @__PURE__ */ jsx(LabFrame, {
|
|
194
|
+
title: "Balance-scale algebra",
|
|
195
|
+
controls: /* @__PURE__ */ jsxs(ControlBar, { children: [
|
|
196
|
+
/* @__PURE__ */ jsx(Field, {
|
|
197
|
+
label: eqLabel,
|
|
198
|
+
value: /* @__PURE__ */ jsxs("strong", { children: ["x = ", x] }),
|
|
199
|
+
children: /* @__PURE__ */ jsx(Slider, {
|
|
200
|
+
value: x,
|
|
201
|
+
min: 0,
|
|
202
|
+
max: maxX,
|
|
203
|
+
step: 1,
|
|
204
|
+
onChange: setX,
|
|
205
|
+
ariaLabel: "value of x"
|
|
206
|
+
})
|
|
207
|
+
}),
|
|
208
|
+
/* @__PURE__ */ jsxs("span", {
|
|
209
|
+
style: { opacity: .75 },
|
|
210
|
+
children: [
|
|
211
|
+
"left ",
|
|
212
|
+
L,
|
|
213
|
+
" · right ",
|
|
214
|
+
R
|
|
215
|
+
]
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ jsx(StatusPill, {
|
|
218
|
+
ok: balanced,
|
|
219
|
+
children: balanced ? "✓ Balanced — solved!" : "Not balanced"
|
|
220
|
+
})
|
|
221
|
+
] }),
|
|
222
|
+
footer: /* @__PURE__ */ jsx(LiveRegion, { children: balanced ? `Balanced. x equals ${x}. Solved.` : `Left load ${L}, right load ${R}.` }),
|
|
223
|
+
children: figure
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
//#endregion
|
|
228
|
+
export { BalanceAlgebraLab, balanceAlgebraDoc };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/math/derivation.d.ts
|
|
4
|
+
interface DerivationStep {
|
|
5
|
+
/** A LaTeX line, e.g. `\\frac{y - y_P}{x - x_P} = \\frac{y_Q - y_P}{x_Q - x_P}`. */
|
|
6
|
+
tex: string;
|
|
7
|
+
/** Why this step follows (shown beside the line). */
|
|
8
|
+
note?: string;
|
|
9
|
+
}
|
|
10
|
+
interface DerivationProps {
|
|
11
|
+
steps?: (DerivationStep | string)[];
|
|
12
|
+
title?: string;
|
|
13
|
+
/** Reveal all steps at once instead of stepping (e.g. for print/review). */
|
|
14
|
+
showAll?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare function Derivation({
|
|
17
|
+
steps,
|
|
18
|
+
title,
|
|
19
|
+
showAll
|
|
20
|
+
}?: DerivationProps): ReactNode;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Derivation, DerivationProps, DerivationStep };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Tex } from "../core/tex.mjs";
|
|
4
|
+
import { ControlBar, LabFrame } from "../kit/frame.mjs";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/math/derivation.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Derivation — a step-by-step algebra/equation derivation, revealed one line at a
|
|
11
|
+
* time. Each step is a LaTeX expression (rendered with KaTeX) plus an optional
|
|
12
|
+
* justification ("subtract yₚ", "cross-multiply"). The learner clicks through;
|
|
13
|
+
* the latest line is emphasized. This is how you teach a *derivation* — the
|
|
14
|
+
* two-point line form, the quadratic formula, a chord-length proof — as a guided
|
|
15
|
+
* sequence rather than a wall of algebra.
|
|
16
|
+
*
|
|
17
|
+
* Pure presentation over the engine's `<Tex>` + the shared control kit (no canvas,
|
|
18
|
+
* no equation solving implied — the author supplies the steps, optionally
|
|
19
|
+
* generated/verified with the symbolic engine).
|
|
20
|
+
*/
|
|
21
|
+
function normalize(steps) {
|
|
22
|
+
const out = (Array.isArray(steps) ? steps : []).map((s) => typeof s === "string" ? { tex: s } : s).filter((s) => !!s && typeof s.tex === "string");
|
|
23
|
+
return out.length ? out : [{
|
|
24
|
+
tex: "a^2 + b^2 = c^2",
|
|
25
|
+
note: "add your steps"
|
|
26
|
+
}];
|
|
27
|
+
}
|
|
28
|
+
function Derivation({ steps, title = "Derivation", showAll = false } = {}) {
|
|
29
|
+
const all = normalize(steps);
|
|
30
|
+
const [step, setStep] = useState(showAll ? all.length - 1 : 0);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
setStep(showAll ? all.length - 1 : 0);
|
|
33
|
+
}, [showAll, all.length]);
|
|
34
|
+
const figure = /* @__PURE__ */ jsx("ol", {
|
|
35
|
+
style: {
|
|
36
|
+
listStyle: "none",
|
|
37
|
+
margin: 0,
|
|
38
|
+
padding: 0,
|
|
39
|
+
display: "flex",
|
|
40
|
+
flexDirection: "column",
|
|
41
|
+
gap: 10
|
|
42
|
+
},
|
|
43
|
+
children: all.slice(0, step + 1).map((s, i) => /* @__PURE__ */ jsxs("li", {
|
|
44
|
+
style: {
|
|
45
|
+
display: "flex",
|
|
46
|
+
flexWrap: "wrap",
|
|
47
|
+
alignItems: "baseline",
|
|
48
|
+
gap: "4px 16px",
|
|
49
|
+
borderRadius: 8,
|
|
50
|
+
padding: "8px 12px",
|
|
51
|
+
transition: "background 120ms",
|
|
52
|
+
background: i === step && !showAll ? "color-mix(in oklab, var(--primary, var(--stage-accent)) 12%, transparent)" : "transparent"
|
|
53
|
+
},
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx("span", {
|
|
56
|
+
style: {
|
|
57
|
+
fontFamily: "ui-monospace, monospace",
|
|
58
|
+
fontSize: 12,
|
|
59
|
+
opacity: .55
|
|
60
|
+
},
|
|
61
|
+
children: i + 1
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ jsx("span", {
|
|
64
|
+
style: { fontSize: 15 },
|
|
65
|
+
children: /* @__PURE__ */ jsx(Tex, { tex: s.tex })
|
|
66
|
+
}),
|
|
67
|
+
s.note && /* @__PURE__ */ jsxs("span", {
|
|
68
|
+
style: {
|
|
69
|
+
fontSize: 13,
|
|
70
|
+
opacity: .65
|
|
71
|
+
},
|
|
72
|
+
children: ["— ", s.note]
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
}, i))
|
|
76
|
+
});
|
|
77
|
+
return /* @__PURE__ */ jsx(LabFrame, {
|
|
78
|
+
title,
|
|
79
|
+
prompt: "Work through the derivation one line at a time.",
|
|
80
|
+
controls: !showAll ? /* @__PURE__ */ jsxs(ControlBar, { children: [
|
|
81
|
+
/* @__PURE__ */ jsx("button", {
|
|
82
|
+
type: "button",
|
|
83
|
+
className: "lab-chip",
|
|
84
|
+
onClick: () => setStep((s) => Math.max(0, s - 1)),
|
|
85
|
+
disabled: step === 0,
|
|
86
|
+
children: "← Back"
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ jsxs("span", {
|
|
89
|
+
style: {
|
|
90
|
+
fontVariantNumeric: "tabular-nums",
|
|
91
|
+
opacity: .75
|
|
92
|
+
},
|
|
93
|
+
children: [
|
|
94
|
+
"step ",
|
|
95
|
+
step + 1,
|
|
96
|
+
" / ",
|
|
97
|
+
all.length
|
|
98
|
+
]
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ jsx("button", {
|
|
101
|
+
type: "button",
|
|
102
|
+
className: "lab-chip",
|
|
103
|
+
onClick: () => setStep((s) => Math.min(all.length - 1, s + 1)),
|
|
104
|
+
disabled: step >= all.length - 1,
|
|
105
|
+
children: "Next →"
|
|
106
|
+
})
|
|
107
|
+
] }) : void 0,
|
|
108
|
+
children: figure
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
//#endregion
|
|
113
|
+
export { Derivation };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { DerivativeExplorer, DerivativeExplorerProps } from "./preset.mjs";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/math/derivative-explorer/preset.d.ts
|
|
4
|
+
interface DerivativeExplorerProps {
|
|
5
|
+
equation?: string;
|
|
6
|
+
xRange?: [number, number];
|
|
7
|
+
startX?: number;
|
|
8
|
+
title?: string;
|
|
9
|
+
height?: number;
|
|
10
|
+
}
|
|
11
|
+
declare function DerivativeExplorer({
|
|
12
|
+
equation,
|
|
13
|
+
xRange,
|
|
14
|
+
startX,
|
|
15
|
+
title,
|
|
16
|
+
height
|
|
17
|
+
}?: DerivativeExplorerProps): ReactNode;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { DerivativeExplorer, DerivativeExplorerProps };
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { clamp } from "../../core/util.mjs";
|
|
4
|
+
import { Tex as Tex$1 } from "../../core/tex.mjs";
|
|
5
|
+
import { LabStyles, Slider } from "../../kit/controls.mjs";
|
|
6
|
+
import { ControlBar, Field, LabFrame } from "../../kit/frame.mjs";
|
|
7
|
+
import { useEffect, useMemo, useState } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Axes, Grid, MovableDot, Plot, Segment, Stage, compileExpr, differentiate, evaluate, simplify, toLatex } from "@classytic/stage";
|
|
10
|
+
|
|
11
|
+
//#region src/math/derivative-explorer/preset.tsx
|
|
12
|
+
/**
|
|
13
|
+
* DerivativeExplorer — "the derivative is a slope," on the @classytic/stage
|
|
14
|
+
* engine. Plot f(x); drag the point along the curve and shrink the gap h to
|
|
15
|
+
* watch the SECANT collapse onto the TANGENT (exact f'(x) from the shared expr
|
|
16
|
+
* engine's symbolic `differentiate`, numerical fallback). Replaces the canvas
|
|
17
|
+
* version — now SVG, accessible, themed, KaTeX formulas via the Tex primitive.
|
|
18
|
+
*/
|
|
19
|
+
const numericSlope = (f, x) => (f(x + 1e-4) - f(x - 1e-4)) / 2e-4;
|
|
20
|
+
function autoY(f, xMin, xMax) {
|
|
21
|
+
const ys = [];
|
|
22
|
+
for (let i = 0; i <= 200; i++) {
|
|
23
|
+
const y = f(xMin + (xMax - xMin) * i / 200);
|
|
24
|
+
if (Number.isFinite(y)) ys.push(y);
|
|
25
|
+
}
|
|
26
|
+
if (!ys.length) return [-1, 1];
|
|
27
|
+
ys.sort((a, b) => a - b);
|
|
28
|
+
let lo = Math.min(ys[Math.floor(ys.length * .02)] ?? -1, 0);
|
|
29
|
+
let hi = Math.max(ys[Math.floor(ys.length * .98)] ?? 1, 0);
|
|
30
|
+
if (lo === hi) {
|
|
31
|
+
lo -= 1;
|
|
32
|
+
hi += 1;
|
|
33
|
+
}
|
|
34
|
+
const pad = (hi - lo) * .15;
|
|
35
|
+
return [lo - pad, hi + pad];
|
|
36
|
+
}
|
|
37
|
+
function DerivativeExplorer({ equation = "0.15*x^3 - x", xRange = [-4, 4], startX = 1, title = "The derivative is a slope", height = 340 } = {}) {
|
|
38
|
+
const [xMin, xMax] = xRange;
|
|
39
|
+
const [x0, setX0] = useState(clamp(startX, xMin, xMax));
|
|
40
|
+
const [h, setH] = useState(1.2);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
setX0(clamp(startX, xMin, xMax));
|
|
43
|
+
}, [
|
|
44
|
+
startX,
|
|
45
|
+
xMin,
|
|
46
|
+
xMax
|
|
47
|
+
]);
|
|
48
|
+
const model = useMemo(() => {
|
|
49
|
+
const res = compileExpr(equation);
|
|
50
|
+
if (!res.ast) return {
|
|
51
|
+
ok: false,
|
|
52
|
+
error: res.error ?? "Invalid expression"
|
|
53
|
+
};
|
|
54
|
+
const ast = res.ast;
|
|
55
|
+
const f = (x) => evaluate(ast, { x });
|
|
56
|
+
let dNode = null;
|
|
57
|
+
try {
|
|
58
|
+
const d = differentiate(ast, "x");
|
|
59
|
+
dNode = d ? simplify(d) : null;
|
|
60
|
+
} catch {
|
|
61
|
+
dNode = null;
|
|
62
|
+
}
|
|
63
|
+
const slopeAt = dNode ? (x) => evaluate(dNode, { x }) : (x) => numericSlope(f, x);
|
|
64
|
+
return {
|
|
65
|
+
ok: true,
|
|
66
|
+
f,
|
|
67
|
+
fLatex: toLatex(ast),
|
|
68
|
+
dfLatex: dNode ? toLatex(dNode) : null,
|
|
69
|
+
slopeAt
|
|
70
|
+
};
|
|
71
|
+
}, [equation]);
|
|
72
|
+
if (!model.ok) return /* @__PURE__ */ jsxs("div", {
|
|
73
|
+
className: "not-prose",
|
|
74
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
75
|
+
style: { fontWeight: 600 },
|
|
76
|
+
children: title
|
|
77
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
78
|
+
style: {
|
|
79
|
+
padding: 12,
|
|
80
|
+
fontSize: 13,
|
|
81
|
+
color: "var(--stage-danger)"
|
|
82
|
+
},
|
|
83
|
+
children: [
|
|
84
|
+
"“",
|
|
85
|
+
equation,
|
|
86
|
+
"” — ",
|
|
87
|
+
model.error
|
|
88
|
+
]
|
|
89
|
+
})]
|
|
90
|
+
});
|
|
91
|
+
const { f, slopeAt, fLatex, dfLatex } = model;
|
|
92
|
+
const [yMin, yMax] = autoY(f, xMin, xMax);
|
|
93
|
+
const y0 = f(x0);
|
|
94
|
+
const x1 = x0 + h;
|
|
95
|
+
const y1 = f(x1);
|
|
96
|
+
const secant = (y1 - y0) / (x1 - x0);
|
|
97
|
+
const m = slopeAt(x0);
|
|
98
|
+
const lineY = (slope, atX) => y0 + slope * (atX - x0);
|
|
99
|
+
const figure = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(LabStyles, {}), /* @__PURE__ */ jsxs(Stage, {
|
|
100
|
+
view: {
|
|
101
|
+
xMin,
|
|
102
|
+
xMax,
|
|
103
|
+
yMin,
|
|
104
|
+
yMax
|
|
105
|
+
},
|
|
106
|
+
height,
|
|
107
|
+
ariaLabel: `Tangent to ${equation} at x = ${x0.toFixed(2)}`,
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ jsx(Grid, {}),
|
|
110
|
+
/* @__PURE__ */ jsx(Axes, {}),
|
|
111
|
+
/* @__PURE__ */ jsx(Plot.OfX, {
|
|
112
|
+
y: f,
|
|
113
|
+
domain: [xMin, xMax],
|
|
114
|
+
color: "var(--stage-accent)",
|
|
115
|
+
weight: 3
|
|
116
|
+
}),
|
|
117
|
+
Number.isFinite(y0) && Number.isFinite(y1) && /* @__PURE__ */ jsx(Segment, {
|
|
118
|
+
from: {
|
|
119
|
+
x: xMin,
|
|
120
|
+
y: lineY(secant, xMin)
|
|
121
|
+
},
|
|
122
|
+
to: {
|
|
123
|
+
x: xMax,
|
|
124
|
+
y: lineY(secant, xMax)
|
|
125
|
+
},
|
|
126
|
+
color: "var(--stage-accent-2)",
|
|
127
|
+
weight: 2
|
|
128
|
+
}),
|
|
129
|
+
Number.isFinite(y0) && Number.isFinite(m) && /* @__PURE__ */ jsx(Segment, {
|
|
130
|
+
from: {
|
|
131
|
+
x: xMin,
|
|
132
|
+
y: lineY(m, xMin)
|
|
133
|
+
},
|
|
134
|
+
to: {
|
|
135
|
+
x: xMax,
|
|
136
|
+
y: lineY(m, xMax)
|
|
137
|
+
},
|
|
138
|
+
color: "var(--stage-good)",
|
|
139
|
+
weight: 2,
|
|
140
|
+
dashed: true
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ jsx(MovableDot, {
|
|
143
|
+
value: {
|
|
144
|
+
x: x0,
|
|
145
|
+
y: y0
|
|
146
|
+
},
|
|
147
|
+
onMove: (p) => setX0(clamp(p.x, xMin, xMax)),
|
|
148
|
+
color: "var(--stage-fg)",
|
|
149
|
+
ariaLabel: "point on the curve"
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
})] });
|
|
153
|
+
return /* @__PURE__ */ jsx(LabFrame, {
|
|
154
|
+
title,
|
|
155
|
+
controls: /* @__PURE__ */ jsxs(ControlBar, { children: [
|
|
156
|
+
/* @__PURE__ */ jsx(Field, {
|
|
157
|
+
label: "gap h",
|
|
158
|
+
children: /* @__PURE__ */ jsx(Slider, {
|
|
159
|
+
value: h,
|
|
160
|
+
min: .05,
|
|
161
|
+
max: 3,
|
|
162
|
+
step: .05,
|
|
163
|
+
onChange: setH,
|
|
164
|
+
ariaLabel: "secant gap h"
|
|
165
|
+
})
|
|
166
|
+
}),
|
|
167
|
+
/* @__PURE__ */ jsxs("span", {
|
|
168
|
+
style: { opacity: .8 },
|
|
169
|
+
children: ["x = ", /* @__PURE__ */ jsx("strong", { children: x0.toFixed(2) })]
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ jsxs("span", {
|
|
172
|
+
style: { opacity: .8 },
|
|
173
|
+
children: ["secant slope ", /* @__PURE__ */ jsx("strong", { children: Number.isFinite(secant) ? secant.toFixed(2) : "—" })]
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ jsxs("span", {
|
|
176
|
+
style: {
|
|
177
|
+
color: "var(--stage-good)",
|
|
178
|
+
fontWeight: 600
|
|
179
|
+
},
|
|
180
|
+
children: ["f′(x) = ", Number.isFinite(m) ? m.toFixed(2) : "—"]
|
|
181
|
+
})
|
|
182
|
+
] }),
|
|
183
|
+
footer: /* @__PURE__ */ jsxs("div", {
|
|
184
|
+
style: {
|
|
185
|
+
display: "flex",
|
|
186
|
+
flexWrap: "wrap",
|
|
187
|
+
gap: "4px 18px",
|
|
188
|
+
padding: "8px 2px 0",
|
|
189
|
+
fontSize: 14
|
|
190
|
+
},
|
|
191
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
192
|
+
style: {
|
|
193
|
+
display: "inline-flex",
|
|
194
|
+
alignItems: "center",
|
|
195
|
+
gap: 6
|
|
196
|
+
},
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ jsx("span", {
|
|
199
|
+
style: { opacity: .6 },
|
|
200
|
+
children: "f(x) ="
|
|
201
|
+
}),
|
|
202
|
+
" ",
|
|
203
|
+
/* @__PURE__ */ jsx(Tex$1, { tex: fLatex })
|
|
204
|
+
]
|
|
205
|
+
}), dfLatex && /* @__PURE__ */ jsxs("span", {
|
|
206
|
+
style: {
|
|
207
|
+
display: "inline-flex",
|
|
208
|
+
alignItems: "center",
|
|
209
|
+
gap: 6,
|
|
210
|
+
color: "var(--stage-good)"
|
|
211
|
+
},
|
|
212
|
+
children: [
|
|
213
|
+
/* @__PURE__ */ jsx("span", {
|
|
214
|
+
style: { opacity: .7 },
|
|
215
|
+
children: "f′(x) ="
|
|
216
|
+
}),
|
|
217
|
+
" ",
|
|
218
|
+
/* @__PURE__ */ jsx(Tex$1, { tex: dfLatex })
|
|
219
|
+
]
|
|
220
|
+
})]
|
|
221
|
+
}),
|
|
222
|
+
children: figure
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
//#endregion
|
|
227
|
+
export { DerivativeExplorer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { FunctionMachineLab, FunctionMachineProps } from "./preset.mjs";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/math/function-machine/preset.d.ts
|
|
4
|
+
interface FunctionMachineProps {
|
|
5
|
+
prompt?: string;
|
|
6
|
+
inputs: (string | number)[];
|
|
7
|
+
outputs: (string | number)[];
|
|
8
|
+
choices: string[];
|
|
9
|
+
answer: string;
|
|
10
|
+
height?: number;
|
|
11
|
+
}
|
|
12
|
+
declare function FunctionMachineLab({
|
|
13
|
+
prompt,
|
|
14
|
+
inputs,
|
|
15
|
+
outputs,
|
|
16
|
+
choices,
|
|
17
|
+
answer,
|
|
18
|
+
height
|
|
19
|
+
}: FunctionMachineProps): ReactNode;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { FunctionMachineLab, FunctionMachineProps };
|