Skip to content
Go back

A programming language for describing (most) of the world

La filosofia è scritta in questo grandissimo libro che continuamente ci sta aperto innanzi a gli occhi (io dico l’universo), ma non si può intendere se prima non s’impara a intender la lingua, e conoscer i caratteri, ne’ quali è scritto. Egli è scritto in lingua matematica, e i caratteri son triangoli, cerchi, ed altre figure geometriche, senza i quali mezzi è impossibile a intenderne umanamente parola; senza questi è un aggirarsi vanamente per un oscuro laberinto.

Of all the topics in physics, I find the variational approach to classical mechanics to be the most beautiful and profound. Not surprisingly, one of my favorite technical books is literally dedicated to the principle of least action. Structure and Interpretation of Classical Mechanics (MIT Press, second edition, 2015) by Gerald Jay Sussman and Jack Wisdom, follows an approach in which many mechanical systems —including several without analytical solutions— can be represented as computer programs. This strategy relies on two components: differential notation, which inspired the JAX API, and the use of MIT/GNU Scheme. That’s enough motivation for me to decide to write a Jupyter kernel for this language.

Scheme is a programming language in the Lisp family. It can be regarded as an implementation of the lambda calculus. Scheme has a minimalist syntax with little structure. It encourages a functional programming style and is well suited for describing symbolic mathematics and classical mechanics, among other things.

Scheme is not a popular programming language, is not widely used in the industry, and might even be bit-roting (hopefully, we can bring it back). Why to learn or care about it then? I don’t have any utilitarian reasons other than the fact that it’s a great tool for studying very interesting topics, like the ones mentioned above.

MIT/GNU Scheme has a long tradition of being used in academia, particularly at MIT, to teach programming and computer science concepts. Along with the Scmutils library, it provides a powerful environment for simulating and analyzing mechanical systems.

There is a good Emacs mode for mit-scheme, but I found the LaTeX output printing in a pop-up Xdvi window cumbersome. That’s why I decided to implement a Jupyter kernel.

You can find the package in this GitHub repo, and install it with pip install mit-scheme-kernel or uv pip install mit-scheme-kernel (if you are cool 😎).

If you give it try, please let me know if you find any issues or have any suggestions.

GitHub Repo

Note: Structure and Interpretation of Classical Mechanics is an open-access book and there is also an unofficial HTML version.


Share this post on:

Previous Post
Who is up for a programming challenge?
Next Post
A physics- and geometry-aware programming language for telling love stories