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.

46 CHAPTER 4. DISCRETE-TIME MODELS I: MODELINGgrowth with constant removals due <strong>to</strong> fishing, <strong>and</strong> growth <strong>of</strong> credit card balanceswith constant monthly payments (both with negative b). Change <strong>the</strong> values <strong>of</strong> a<strong>and</strong> b, <strong>and</strong> see if <strong>the</strong> system’s behaviors are <strong>the</strong> same as those <strong>of</strong> <strong>the</strong> simpleexponential growth/decay model.4.4 Simulating Discrete-Time Models with Multiple VariablesNow we are making a first step <strong>to</strong> complex systems simulation. Let’s increase <strong>the</strong> number<strong>of</strong> variables from one <strong>to</strong> two. Consider <strong>the</strong> following difference equations:x t = 0.5x t−1 + y t−1 (4.14)y t = −0.5x t−1 + y t−1 (4.15)x 0 = 1, y 0 = 1 (4.16)These equations can also be written using vec<strong>to</strong>rs <strong>and</strong> a matrix as follows:( xy)t=( ( )0.5 1 x−0.5 1)yt−1(4.17)Try implementing <strong>the</strong> simulation code <strong>of</strong> <strong>the</strong> equation above. This may seem fairlystraightforward, requiring only minor changes <strong>to</strong> what we had before. Namely, you justneed <strong>to</strong> simulate two difference equations simultaneously. Your new code may look likethis:Code 4.11: oscillation-wrong.pyfrom pylab import *def initialize():global x, y, xresult, yresultx = 1.y = 1.xresult = [x]yresult = [y]def observe():

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

Saved successfully!

Ooh no, something went wrong!