Why do my calculation of Lyapunov exponents strongly depend on the number of iterations?

I have a project in my school so I have to calculate my arranged double pendulum system's Lyapunov exponents, I refer to this method.

http://sprott.physics.wisc.edu/chaos/lyapexp.htm

As the title says, my Lyapunov exponents strongly depend on the number of iterations, but not on its parameters. If I double my number of iterations, the Lyapunov exponents are increased at a constant rate. I can't understand why this kind of situation happens in my code.

If there is a another good method to calculate Lyapunov exponent, please explain me about that.

They shouldn't. Possible mistakes:

• transient: forgetting to throw away enough initial iterations - if you want to calculate the exponent associated with the attractor, you must wait until your trajectory converges to it;
• distance rescaling between the trajectories: as the OP source (Sprott) reminds:

Readjust one orbit so its separation is $d_0$ and is in the same direction as $d_1$ [...] This is probably the most difficult and error-prone step.

Also, remember that the initial separation between the two orbits should be as small as numerically feasible, since the exponent is a local property.

• average: an error that could explain the OP result of exponents that grow with the number of steps would be to calculate the sum of exponents instead of their average.

Of course, the list above isn't exhaustive.

More sophisticated methods exist, which don't require much more than a bit of matrix handling and simple derivatives. I'd highlight the one presented in Ott (1st ed., Eq. 4.40), but other textbooks on nonlinear dynamics and even Wikipedia and Scholarpedia entries describe how to calculate the exponent.

And, last but not least, there is already an answered question on precisely the calculation of the Lyapunov exponent of the double pendulum: Max Lyapunov Exponent of a Double Pendulum.

• Thank you. My algorithms problem is in distance scaling. Now i decrease it down by 1/100, now it works correctly. – Hee Ryang Choi May 29 '18 at 9:30
• @HeeRyangChoi, Great you found it, thanks for reporting. I've included the specific advice on choosing very nearby orbits to the answer, so that it's more useful to future readers. – stafusa May 29 '18 at 9:44