The idea of this animation is to give an example of Liouville’s theorem in phase space.

I’m using a Hamiltonian suggested by Josh in the Portland Math and Science Group:

Leading to the update equations:

This Hamiltonian is not intended to represent any actual physical system. I’m using it simply because it exhibits an “interesting” behaviour.

We start out with a circle of radius 5 centered at the origin. In particular, it should be the case that none of the interior points (colored red) ever “cross” the boundary (colored black). Of course, I can only animate a finite number of points (in this case 1000 boundary points). But hopefully, it gives the basic picture.

The source code can be found at:

The Portland Math & Science repro at Github

It works on Ubuntu 12.04 with “all the regular python stuff” installed, for whatever that’s worth.

*Related*