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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

150 CHAPTER 8. BIFURCATIONSdef initialize():global x, resultx = 0.1result = []def observe():global x, resultresult.append(x)def update():global x, resultx = x + r - x**2def plot_asymp<strong>to</strong>tic_states():initialize()for t in xrange(100): # first 100 steps are discardedupdate()for t in xrange(100): # second 100 steps are collectedupdate()observe()plot([r] * 100, result, ’b.’, alpha = 0.3)for r in arange(0, 2, 0.01):plot_asymp<strong>to</strong>tic_states()xlabel(’r’)ylabel(’x’)show()In this code, r is gradually varied from 0 <strong>to</strong> 2 at intervals <strong>of</strong> 0.01. For each value <strong>of</strong> r, <strong>the</strong>model (Eq. (8.37)) is simulated for 200 steps, <strong>and</strong> only <strong>the</strong> second half <strong>of</strong> <strong>the</strong> state valuesare recorded in result. Once <strong>the</strong> simulation is finished, <strong>the</strong> states s<strong>to</strong>red in resultare plotted at a particular value <strong>of</strong> r in <strong>the</strong> plot (note that <strong>the</strong> expression [r] * 100 inPython produces a list <strong>of</strong> one hundred r’s). The alpha option is used <strong>to</strong> make <strong>the</strong> markerstransparent so that <strong>the</strong> densities <strong>of</strong> markers are also visible.The result is shown in Fig. 8.10. This bifurcation diagram still shows how <strong>the</strong> system’sstate depends on <strong>the</strong> parameter, but what is plotted here are no longer analytically ob-

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

Saved successfully!

Ooh no, something went wrong!