Physics in Clojure
summary
Ports Sussman and Wisdom’s SICP-classical-mechanics system into Clojure, implementing Lagrangians, automatic generation of Euler–Lagrange equations, and conversion to a state derivative for numerical integration; uses dual numbers for forward automatic differentiation, multimethod generic arithmetic, a symbolic simplifier with polynomial GCD, and codegen to JavaScript to run a double pendulum and a driven pendulum that reproduce chaos and Poincaré surface of section portraits; project takes ~2 years, ships ~1500 tests, and produces an interactive web demo that actually works.
AI-written summary · about
chapters (24)
- 0:00Intro
- 0:40SiP
- 2:47Lagrangian
- 3:33State
- 4:10Least Action
- 5:13Euler Lagrange
- 5:58Chain Rule
- 6:59Coding
- 14:26Potential
- 15:11Double pendulum
- 16:29Differential equation
- 17:27State couple
- 18:28Converting to JavaScript
- 19:00Tiny Web App
- 19:10Tiny Animation
- 19:45Shift Gear
- 25:34Simplification
- 27:12Rulebased simulation
- 28:31Application hooks
- 31:08Hamiltonian mechanics
- 32:48plonker
- 33:36driven pendulum example
- 37:18functional differential geometry
- 38:15a weird trick
related talks
39mComputational Physics, Beyond the Glass
38mCreative Clojure
25mExploring the Universal Library
47mDo You Like Physics Simulations aaaannnd C++? Me Too!
34mQuil and Field: Using Clojure for Algorithmic Digital Art
37mTimeLines: Crafting a Live Coding Musical Instrument with & out of Clojure
30mSymmetries of Things
45mNatural physics simulations and canvas hackery
