Computational way of understanding physics

In one of my ongoing research topic, I need to use a novel technique called automatic differentiation to take derivatives. If you never heard of automatic differentiation before, it is sort of the exact way of calculating derivatives numerically. Conventional numerical technique usually change the arguments of the function a little and examine how the output values change. Automatic differentiation is clever. If you give it a function with argument $x$, and output $x^2$, the automatic differentiation will automatically generate a function for you with argument $x$ and output $2x$.

People have established many libraries to do automatic differentiation. I use a library called jax developed by google. It is built on Python and its NumPy library. About three weeks ago, I read The Autodiff Cookbook in jax’s GitHub repository to learn how to use automatic differentiation. And this leads me to two textbooks where the excellent notations provide jax’s automatic differentiation function a convenient API design. Quite unexpectedly, these two books are all physics textbooks. One book talks about computational way of thinking about classical mechanics,  Structure and Interpretation of Classical Mechanics; the other talks about differential geometry which is a language for general relativity and quantum field theory, Functional Differential Geometry.

Prologue of the second book  talking about differential geometry gives a nice comment on the current notations in physics. It uses the famous Euler-Lagrange equations as the example. The question is how to explain this equation to a student totally ignorant of it. We can take a computer to be this insistent student and use a computer program to tell it how to interpret Euler-Lagrangian equation. This indeed lead to a much clearer notation to express Euler-Lagrangian equation.

I believe it is a nice way to think about the computational approach to physics. It is not merely about calculating some results, the more important aspect is that during this process of teaching a computer to do what we want to do, we can get a better and clearer understanding of physics.

Xinliang (Bruce) Lyu

Working on my way to become a theoretical physicist!