-
Notifications
You must be signed in to change notification settings - Fork 2
/
example-2-henon.py
30 lines (25 loc) · 978 Bytes
/
example-2-henon.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import numpy as np
import igraph as ig
from stn import *
from lyapunov import lyapunov_parallel
from matplotlib import pyplot as plt
if __name__=='__main__':
N = 100000 # Number of sample points of the dynamics
trans = 2000 # Number of transient samples to neglect
dt = 0.002 # Simulation timestep
a_params = np.linspace(1.20, 1.23, 100) # Control parameter range for the Henon map
lyaps = np.zeros_like(a_params)
for i, a in enumerate(a_params):
print("Param %d; a = %f" %(i,a))
# Generating the Henon map
dynamics = henon_map(N, a, 0.3, 1.0, 0.5)[:, trans:]
# Constructing the STNs
g = STN(dynamics, 20)
# Calculating the Lyapunov measure
lyaps[i] = lyapunov_parallel(g)
# Plotting the Lyapunov measure in function of the 'a' control parameter
plt.plot(a_params, lyaps)
plt.xlabel('$a$')
plt.ylabel('$\Lambda$')
plt.grid()
plt.savefig('plots/ex-2-henon-lyap.png')