Introducing the Hamilton library
Hamilton: README / hackage / github
The hamilton library is on hackage! It was mostly a proof-of-concept toy experiment to simulate motion on bezier curves, but it became usable enough and accurate enough (to my surprise, admittedly) that I finished up some final touches to make it complete and put it on hackage as a general-purpose physics simulator.
The library is, in short, a way to simulate a physical system by stating nothing more than an arbitrary parameterization of a system (a “generalized coordinate”) and a potential energy function.
I was going to write a Haskell post on the implementation, which was what interested me at first. I wanted to go over –
Using automatic differentiation to automatically compute momentum and the hamilton equations, which are solutions of differential equations.
Using type-indexed vectors and dependent types in a seamless way to encode the dimensionality of the generalized coordinate systems and to encode invariants the types of functions.