Use the this as the basis: https://github.com/spsanderson/random_r_projects/blob/main/double_pendulum/double_pendulum.r