160 points · by pablode · 8y ago · 25 comments
Code and explanation: http://www.physicsandbox.com/projects/double-pendulum.html
Demo: http://www.physicsandbox.com/projects/double-pendulum-sim.ht...
http://htmlpreview.github.io/?https://github.com/aguaviva/Ph...
Cute but the models are not very robust
Do you know of any libraries for doing 'backend' physical simulations, such as calculating scattering amplitudes, making projections of spacetime models onto either space-like or time-like slices, and, especially, using tensor networks for modelling condensed matter interactions?
Complicated dynamical systems usually involve solving PDEs and for that you need to discretize your domain. How you choose to do so will drastically affect the numerical properties of your simulation. Most "real-physics" simulators tend to be specialized to a given task or even a given domain (for example simulating heat diffusion in an engine part). There's a whole literature on finite element methods to simulate various physical phenomena though it can be quite dense.
The generic game physics engines use very simple models of mechanics and allow for numerical issues (e.g. by using finite differences) in exchange for being real-time. If you're looking to simulate more advanced physical phenomena for a game, you're going to have to make similar trade-offs and will have to choose which ones make for the best gameplay.
Most modern game physics engines aren't actually discretizing an ODE or a PDE, at this point. The current standard techniques (see Nvidia's PhysX, for example) are instead solving something that look like a constraint satisfaction problem but gives force-like effects. You don't even get consistency under refinement with these methods, but they are cheap, and importantly, stable when terminated early (to remain under strict time budgets required of game based physics).
Can you recommend any general-purpose libraries (preferably with python bindings) for tensor calculus?
It may be worth saying that numerical relativity played a key part in the last Nobel prize for the detection of gravitational waves.
Nevertheless it's nice to refer to this analogy.
http://htmlpreview.github.io/?https://github.com/aguaviva/Ph...