title: Lyapunov Exponent Python Implementation
body: <p>I have 10k data points like this:</p>
  
  <pre><code>0.010222
  0.010345
  0.010465
  0.010611
  0.010768
  0.010890
  0.011049
  0.011206
  0.011329
  0.011465
  0.011613
  0.11763
  0.011888
  0.012015
  0.012154
  0.012282
  0.012408
  0.012524
  ....
  </code></pre>
  
  <p>I want to calculate Lyapunov exponent for that. This is what I've done so far:</p>
  
  <pre><code>lyapunovs = []
  eps = 0.0001
  for i in range(N):
      for j in range(i + 1, N):
          if np.abs(data[i] - data[j]) &lt; eps:
              for k in range(1, min(N - i, N - j)):
                   d0 = np.abs(data[i] - data[j])
                   dn = np.abs(data[i + k] - data[j + k])
                   lyapunovs.append(math.log(dn) - math.log(d0))  # problem
  </code></pre>
  
  <p>My problem is that I don't know first Lyapunov exponent is average of all the  <code>lyapunovs</code> when <code>k = 1</code> or average of all the <code>lyapunovs</code> for the first time that <code>data[i] - data[j] &lt; eps</code>?</p>
  
  <p><strong>Is this right implementation for Lyapunov exponent?</strong></p>
  
  <p>And this is the <a href="https://www.bu.edu/abl/files/physicad_rosenstein93.pdf" rel="nofollow">Numerical Calculation of Lyapunov Exponent</a> </p>