15.08.2015 Views

Introduction to the Modeling and Analysis of Complex Systems

introduction-to-the-modeling-and-analysis-of-complex-systems-sayama-pdf

introduction-to-the-modeling-and-analysis-of-complex-systems-sayama-pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

13.6. REACTION-DIFFUSION SYSTEMS 261Figure 13.17: Simulation <strong>of</strong> <strong>the</strong> Turing pattern formation model with (a, b, c, d) =(1, −1, 2, −1.5) <strong>and</strong> (D u , D v ) = (10 −4 , 6 × 10 −4 ). Densities <strong>of</strong> u are plotted in grayscale(darker = greater). Time flows from left <strong>to</strong> right.Code 13.8: turing-pattern-PDE.pyimport matplotlibmatplotlib.use(’TkAgg’)from pylab import *n = 100 # size <strong>of</strong> grid: n * nDh = 1. / n # spatial resolution, assuming space is [0,1] * [0,1]Dt = 0.02 # temporal resolutiona, b, c, d, h, k = 1., -1., 2., -1.5, 1., 1. # parameter valuesDu = 0.0001 # diffusion constant <strong>of</strong> uDv = 0.0006 # diffusion constant <strong>of</strong> vdef initialize():global u, v, nextu, nextvu = zeros([n, n])v = zeros([n, n])for x in xrange(n):for y in xrange(n):u[x, y] = 1. + uniform(-0.03, 0.03) # small noise is addedv[x, y] = 1. + uniform(-0.03, 0.03) # small noise is addednextu = zeros([n, n])

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!