I have the x and y coordinates for two trajectories separated by a small difference in initial conditions (for a double pendulum). Since the pendulum is physically constrained, there can only be local exponential growth. Using these two trajectories, how can I get a good numerical approximation for the Lyapunov Exponent? I've seen some studies define separation as the Euclidean distance between (angle_1, angle_2, angle_1_velocity, angle_2_velocity), and other studies use other definitions. And once I have a list of the differences between the two trajectories what do I do to it? I've tried dividing each element in the distance list with the element before, and then calculating the mean of the natural log and each element in that list, and divide that result by my time step.
distance_array = np.array(distance_lst)
lyapunov_exponent = np.mean(np.log(distance_array[1:] / distance_array[:-1])) / 0.02
But that does not seem like a sound approach. Can someone give me a few pointers on how I should use the distance list (or if I should use it at all)? Thanks in advance.