sicmutils

https://github.com/sicmutils/sicmutils 🤫 please don't share this yet.

(nextjournal.env/load! :sicmutils)
ClojureScript
(+ (square (sin 'x))
    (square (cos 'y)))
ClojureScript
(literal-function 'U)
ClojureScript
(defn L-central-polar [m U]
  (fn [[_ [r] [rdot φdot]]]
    (- (* 1/2 m
         (+ (square rdot)
           (square (* r φdot))))
      (U r))))
(let [potential-fn (literal-function 'U)
      L (L-central-polar 'm potential-fn)
      state (up (literal-function 'r)
              (literal-function 'φ))]
  (((Lagrange-equations L) state) 't))
ClojureScript

Runtimes (1)