HAM: A PHYSICS SIMULATION FRAMEWORK Ham is a physics simulation framework that takes a Lagrangian of a system and a description of how to render it and produces a real-time, Hamiltonian-based simulation of the system. It uses Maxima for the symbolic mathematics and SDL2 for the graphics. For example, for a simple harmonic oscillator: (define-simulation simple-harmonic-oscillator :lagrangian (- (* 1/2 m (^ (dot q) 2)) (* 1/2 k (^ q 2))) :coords (q) :render (translate (* q 100) 0 (circle 20 0 0)) :start (q 1.0 p_q 0.0) :params (m 1.0 k 2.0)) To then run the simulation: (make-instance 'simple-harmonic-oscillator) SETUP If you have :sdl2 available and the sources are in ASDF's registry, loading the system should just work™: (asdf:load-system :ham) Otherwise, the full process fetching :sdl2 with Quicklisp and adding the current directory to ASDF's registry is (ql:quickload :sdl2) (push *default-pathname-defaults* asdf:*central-registry*) (asdf:load-system :ham) As it stands the system will only work with SBCL, though I don't think it would be *that* much work to get it working with other Common Lisp implementations. Maxima ended up being a bit of a pain to build fully within ASDF so the ASDF config first compiles it with its autotools set-up (so you'll need autoconf et al) and uses the FASLs from that build when possible. It's a little cursed but it does the job. I did have to call asdf::mark-operation-done directly so it might break with future versions of ASDF (I'm using version 3.3.1 at time of writing).
Languages
Common Lisp
100%