RECONSTRUCTING THE BRUSSELATOR OSCILLATIONS NUMERICALLY (USING ODEINT): A WORK IN PROGRESS

SEE HERE FOR MORE INFORMATION: http://www.idea.wsu.edu/OscilChem/#Brusselator%20Model


In [11]:
%matplotlib inline
import numpy as np
from scipy.integrate import odeint
from pylab import *

# DEFINE OUR SYSTEM OF DIFFERENTIAL EQUATIONS dy/dt = f(y, t)
A = 1
B = 3
def f(Z,t):
    X = Z[0]
    Y = Z[1]
    #the model equations
    f0 = A + np.power(X,2)*Y - B*X - X
    f1 = B*X - np.power(X,2)*Y
    return [f0 , f1]
#initial conditions
X0 = 1
Y0 = 1
Z0 = [ X0 , Y0 ]
t  = np.linspace(0, 50, 1000)   # time grid
#Solve the DEs
soln = odeint( f , Z0 , t)
X = soln[:,0]
Y = soln[:,1]

In [35]:
#PLOTTING!
plt.figure()
plt.plot(t,X , label = 'Chemical species X')
plt.plot(t,Y , label = 'Chemical species Y')
plt.xlabel('time')
plt.ylabel('concentration')
plt.legend(loc=2)


Out[35]:
<matplotlib.legend.Legend at 0x10d9f6bd0>