Below is a realtime simulation of a double pendulum with point masses and no friction. I derived the differential equations of the double pendulum from scratch with sympy. The simulation uses the Runge–Kutta method to integrate the differential equations at each time step.
The code is here: https://github.com/robz/pendulum_math
My goal with this project was to use the double pendulum as a case study for understanding how to simulate arbitrary physical systems, eventually to play around with different control algorithms. I was inspired by the acrobot, a robot problem that I learned about in MIT's Underactuated Robotics course.