PyCX is an online repository of simple, crude, easy-to-understand sample codes for various complex systems simulation, including iterative maps, cellular automata, dynamical networks and agent-based models. All the sample codes were written in plain Python, a general-purpose programming language widely used in industry as well as in academia, so that students can gain practical skills for both complex systems simulation and computer programming simultaneously. The core philosophy of PyCX is on the simplicity, readability, generalizability and pedagogical values of simulation codes. PyCX has been used in instructions of complex systems modeling at several places with successful outcomes.
Until nearly the end of the last century, dynamic simulations of complex systems—such as cellular automata and agent-based models—were only available to researchers who had sufficient technical skills to develop and operate their own simulation software. At that time, there were very few general-purpose simulation software packages available (e.g., (Hiebeler 1994; Wuensche 1994)), and those packages were rather hard to program, unless one had a computer science background. The lack of general-purpose simulation software easily accessible for non-computer scientists was a major limiting factor for the growth of complex systems science, given the highly interdisciplinary nature of the field.
Over the last decade, several easy-to-use complex systems modeling and simulation software packages have been developed and become widely used for scientific research, including NetLogo (2004), Repast (2003), Mason (2004) (for agent-based models) and Golly (2005) (for cellular automata). They have been playing a critical role in making complex systems modeling and simulation available to researchers outside computer science. A number of publications used these software packages as key research tools, and increasingly many online tutorials and sample simulation models are becoming publicly available.
However, such existing software has several problems when used for teaching complex systems modeling and simulation in higher education settings. These are all real issues we have faced in classrooms and other educational settings over the last several years. Firstly, and most importantly for college students, learning languages or libraries specific to particular simulation software used only in academia would not help the students advance their general technical skills. Because most students will eventually build their careers outside complex systems science, they usually want to learn something generalizable and marketable, even though they want to study complex systems science and they do appreciate its concepts and values.
Secondly, even for those who actively work on complex systems research, choices of preferred software vary greatly from discipline to discipline, and therefore it is quite difficult to come up with a single commonly agreeable choice of software useful for everyone. This is particularly problematic when one has to teach a diverse group of students, which is not uncommon in complex systems education.
Thirdly, details of model assumptions and implementations in pre-built simulation software are often hidden from the user, such as algorithms of collision detection, time allocation and state updating schemes. As we all know, such microscopic details can and do influence macroscopic behavior of the model, especially in complex systems simulations.
Finally, using existing simulation software necessarily puts unrecognized limitations to the user’s creativity in complex systems research, because the model assumptions and analytical methods are influenced significantly by what is available in the provided software. This is a fundamental issue that could hamper the advance of complex systems science, since any breakthroughs will be achieved only by creating entirely novel ways of modeling and/or analyzing complex systems that were not done before.
These issues in using existing simulation software for complex systems education leads to the following very challenging riddle: Which computational tool is best for teaching complex systems modeling and simulation, offering students generalizable, marketable skills, being accessible and useful for everyone across disciplines, maintaining transparency in details, and imposing no implicit limit to the modeling and analysis capabilities?
Obviously, there would be no single best answer to this kind of question. In what follows, we present a case of our humble attempt to give our own answer to it, hoping that some readers may find it helpful for solving their unique challenges in complex systems education.
Through several years of experience in complex systems education, people have come to realize that using a simple general-purpose computer programming language itself as a complex systems modeling platform is our current best solution to address most, if not all, of the educational challenges discussed above. By definition, general-purpose computer programming languages are universal and can offer unlimited opportunity of modeling with all the details clearly spelled out in front of the user’s eyes. Identifying a programming language that would be easily accessible and useful in a wide variety of disciplines had been difficult even a decade ago. Fortunately, several easy-to-use programming languages have recently emerged and become very popular in various scientific and industrial communities, including Python and R.
Using the Python language itself as a modeling and simulation platform, “PyCX” has been developed, an online repository of simple, crude, easy-to-understand sample codes for various complex systems simulation. The target audiences of PyCX are researchers, scientists, and students who are interested in developing their own complex systems simulation software using a general-purpose programming language but do not have much experience in computer programming. Based on carefully designed sample codes, the audience can understand, modify, create and visualize dynamic complex systems simulations relatively easily.
The core philosophy of PyCX is therefore placed on the simplicity, readability, generalizability and pedagogical values of simulation codes. This is often achieved even at the cost of computational speed, efficiency or maintainability. For example: (1) every PyCX sample code is written as a single.py file, which is a plain text file, without being split into multiple separate files; (2) all the dynamic simulations follow the same scheme consisting of three parts (initialization, visualization and updating); (3) no object-oriented programming paradigm is used because it is sometimes difficult for non-computer scientists to grasp; and (4) no global variables are used to make the code more intuitive and readable. These choices were intentionally made based on our experience in teaching complex systems modeling and simulation to non-computer scientists and their feedback.