In [4]:
import numpy as np
from scipy import integrate
import matplotlib.pylab as plt
%config InlineBackend.figure_format = 'retina'
%matplotlib inline
In [5]:
# Parameters specified by Abbott 2009.
def lorentz((x, y, z), t0, **kwargs):
if 'rho' in kwargs:
rho = kwargs['rho']
else:
rho = 28
if 'sigma' in kwargs:
sigma = kwargs['sigma']
else:
sigma = 10.0
if 'beta' in kwargs:
beta = kwargs['beta']
else:
beta = 8./3.
return [sigma * (y - x), x * (rho - z) - y, x * y - beta * z]
In [8]:
T = 5000 # period
x0 = [1, 1, 1] # starting vector
t = np.linspace(0, 30, T) # one thousand time steps
x_t = integrate.odeint(lorentz, x0, t)
In [9]:
plt.plot(t[:T/2], x_t[T/2:,1]);
plt.xlabel('t', fontsize=14)
plt.ylabel('x', fontsize=14)
Out[9]:
In [ ]: