Welcome, guest | Sign In | My Account | Store | Cart

2 chaotic Lorenz dynamical systems get synchronized with time. (Notice 2 y and 2 z values start differently but approach each other later.)

I used the x variable as the synchronization signal but y or z can also be used.

Python, 36 lines
 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
31
32
33
34
35
36
# Synchronized Chaos using Lorenz Attractor
# FB - 201108011
import random

delta = float(10) # Prandtl number
r = float(28)
b = float(8) / 3
h = 1e-3 # time step
def Lorenz(x, y, z):
    dx_dt = delta * (y - x)
    dy_dt = r * x - y - x * z
    dz_dt = x * y - b * z
    x += dx_dt * h
    y += dy_dt * h
    z += dz_dt * h
    return (x, y, z)

maxIt = 2000
size = 30

# initial state of the driver system
x = random.random() * size * 2 - 1
y = random.random() * size * 2 - 1
z = random.random() * size * 2 - 1

# initial state of the sub-system
# x1 = random.random() * size * 2 - 1
y1 = random.random() * size * 2 - 1
z1 = random.random() * size * 2 - 1

for i in range(maxIt):
    (x, y, z) = Lorenz(x, y, z)
    # x variable of the driver is chosen as driver signal
    (x1, y1, z1) = Lorenz(x, y1, z1)
    # 2 y and 2 z values should become synched w/ time
    print '(%04i, %+07.3f, %+07.3f, %+07.3f, %+07.3f)' % (i, y, y1, z, z1)
Created by FB36 on Tue, 2 Aug 2011 (MIT)
Python recipes (4591)
FB36's recipes (148)

Required Modules

  • (none specified)

Other Information and Tasks