Visualizing the beauty in physics and mathematics
📌 Based on this code and accompanying video
📌 Refactored and ported to JavaScript by Zeger Hendrikse to numerical_methods.js
👉 Also refactored to numerical_methods.py
📌 Semi-implicit (= symplectic) Euler $\Rightarrow$ symplectic $\Rightarrow$ energy stays bounded
📌 Verlet $\Rightarrow$ symplectic $\Rightarrow$ energy oscillates
📌 RK4 $\Rightarrow$ not symplectic $\Rightarrow$ energy grows slowly.
Corollary:
👉 Game engines use Verlet
👉 Physics engines use symplectic integrators
👉 RK4 is numerically more accurate per step, but performs worse for Hamiltonian systems in the long run.
Share on: