# 10: Interactive Simulations of Complex Systems

- Page ID
- 7821

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

- 10.1: Simulation of Systems with a Large Number of Variables
- We are ﬁnally moving into the modeling and analysis of complex systems. The number of variables involved in a model will jump drastically from just a few to tens of thousands! What happens if you have so many dynamical components, and moreover, if those components interact with each other in nontrivial ways? This is the core question of complex systems.

- 10.2: Interactive Simulation with PyCX
- We can build an interactive, dynamic simulation model in Python relatively easily, using PyCX’s“pycxsimulator.py”ﬁle, which is available from http://sourceforge.net/projects/ pycx/files/ (it is also directly linked from the ﬁle name above if you are reading this electronically). This ﬁle implements a simple interactive graphical user interface (GUI) for your own dynamic simulation model, which is still structured in the three essential components—initialization,observation,and updating—just like

- 10.3: Interactive Parameter Control in PyCX
- In Code 10.6, the parameter values are all directly given in the code and are not change able from the control window. PyCX has a feature, however,by which you can create interactive parameter setters (thanks to Przemysław Szufel and Bogumił Kami´nski at the Warsaw School of Economics who developed this nice feature!).

- 10.4: Simulation without PyCX
- Finally, I would like to emphasize an important fact: The PyCX simulator ﬁle used in this chapter was used only for creating a GUI, while the core simulation model was still fully implemented in your own code. This means that your simulation model is completely independent of PyCX, and once the interactive exploration and model veriﬁcation is over, your simulator can “graduate” from PyCX and run on its own.