Hacker News new | ask | show | jobs
by jackdawjack 6104 days ago
check out "the structure and interpretation of classical mechanics" by sussmann et al for a whole raft of things like this done in scheme.

I don't see why would you want to stay away from floats, using rationals isn't going to magically fix the numerical errors from approximating derivatives and such.

I believe they develop an automatic differentiation routine in SICM that will actually allow you to make a pretty good planetary motion simulator, i.e one that won't just go horribly wrong if you run it for a few thousand years.

Of course if you're really interested/mathematically inclined one of the best ways to simulate Hamiltonian systems is via iterated maps, not unlike what was in the article. A good (but quite hard) ref to this is "simulating hamiltonian dynamics" by Leimkuhler and Reich.