Lagrangian Neural Networks
greydanus.github.io
greydanus.github.io
Man, that was a great summer.
https://www.feynmanlectures.caltech.edu/II_19.html
http://www.damtp.cam.ac.uk/user/tong/dynamics/two.pdf
https://theoreticalminimum.com/courses/classical-mechanics/2...
Conservation laws (and/or the associated symmetries) might be more fascinating, but that all builds on Lagrangian mechanics.
So is it true to say that the production of a particular solution to a differential equation is a statement about how a system will behave based on its initial conditions, and that the statement captures within it the principle of action minimization by virtue of the fact that it is a derivation of information from natural laws?
As you see it clicks for many people, and doesn't mean much for others. Back then it was a very welcome click.
After all, it should be possible to find antiderivatives and solve ODEs without doing the dance with substitutions and change of variables, but still, we find it many magnitudes easier than just looking at it and divining the correct solution.
I'd love to see a plot of the analytic Lagrangian vs the numerical one over the two parameter space of the double pendulum. How uniform is the approximation? Since the double pendulum isn't ergodic, I'd be curious to see if there's a correlation between probability of occupying a state and precision there. If there were it could be used as a hint of where to look for non-ergodic behavior in experimental systems.
Another possible fun thing to do with it: imagine you have a chain hanging from two points in the presence of an uneven mass distribution producing gravity. Since you've got the machinery in place for the calculus of variations more generally than just Lagrangian mechanics, you might be able to get the neural net to produce an estimate of the mass distribution from the shape of the chain, which is a toy example of something that might be usable in mineral exploration.
I've tried implementing something somewhat related where I had a rotationally invariant learning target but was trying to use a feature vector which wasn't. I would randomly rotate my samples and add a loss function on the gradient of the rotation parameters to encourage the gradient w.r.t. rotation to be 0. Maybe in 2D this would have worked but in 3D it seemed to be too difficult for the NN to learn well enough for conservation of energy. It seems your examples use relatively simple model systems as examples. Do you have any insight into how this might work with more complex invariences?
Soft constraints via loss functions can also help, but in my experience they are much less effective than hard constraints. My impression is that this is pretty broadly consistent with the experience of others working in this field.
For neural nets with 3D invariance, I would strongly recommend looking into the literature on "group equivariant convolutions". This has been very active area of research over the past few years, e.g., see the work of Taco Cohen: https://arxiv.org/abs/1902.04615
One annoying thing I've encountered is that I have some symmetries that I cannot figure out how to enforce. For example, if I have two degrees of freedom a and b and know that my physical system has a symmetry under exchange of a and b. Suppose I want to train a network to compute something in my system. For each configuration of my system I can train on (a,b) and (b,a). But the order in which I feed those as training matters, so that the network only has _approximate_ exchange symmetry, rather than exact.
Is there a way around this inexactness?
For generically enforcing symmetries, variational autoencoders are the best technique I'm aware of. You can impose any symmetry you like in your generative model. Of course it's still approximate though.
I'd be interested to hear more about your problem, send me an email.
You want to learn a function that represents the dynamics of your system, either as a function of the system state or some output like a picture of the system. If you just apply some NN technique directly, this is possible but will require a lot of data since the NN doesn't have any knowledge of physics. If you use their system, you are trying to learn the Lagrangian of the system, which contains information on e.g. its symmetries, and bakes in physical knowledge into the learning problem at hand. As a result, less data is needed to learn the system dynamics.
I think more people need to learn to see the positive side of TANSTAAFL...
(I suppose it's learning a symmetry in the following sense: just _what_ is conserved depends on what the Lagrangian is, and so as it's learning the dynamics it's also learning what the energy is that it should be conserving. But at every point in the training process, there's _some_ thing, which we might as well call "energy", which its model conserves.)
Glancing over the paper I understand little, there’s too much math I don’t know (yet— starting uni this year— I promise I’ll get there) but the application is absolutely beatiful, as I have taken physics for almost two years now, Appendix B made my day.
The Principle of Least Action
[...]
At first glance, S seems like an arbitrary combination of energies. But it has one remarkable property.
It turns out that for all possible paths between x0 and x1, there is only one path that gives a stationary value of S. Moreover, that path is the one that nature always takes.
I know about the reader mode, and will use it if necessary. But this will loose me all pictures, gif/js animations, and whatnot. I prefer to just have readable websites. I know and accept that some people don't care, even if a more readable site wouldn't hurt their enjoyment the least. Still I prefer sites that work appropriately when I zoom, and that abstain from such visual hostilities.