Skip to main content
Mathematics LibreTexts

10.4: Simulation without PyCX

  • Page ID
    7825
  • \( \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}}\)

    Finally, I would like to emphasize an important fact: The PyCX simulator file 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 verification is over, your simulator can “graduate” from PyCX and run on its own.

    For example, here is a revised version of Code 10.6, which automatically generates a series of image files without using PyCX at all. You can generate an animated movie from the saved image files using, e.g., Windows Movie Maker. This is a nice example that illustrates the main purpose of PyCX—to serve as a stepping stone for students and

    Fig. 10.3.PNG
    Figure \(\PageIndex{1}\): New parameter setter for the number of particles implemented in Code 10.10.

    researchers in learning complex systems modeling and simulation, so that it eventually becomes unnecessary once they have acquired sufficient programming skills.

    code 10.11.png

    code 10.11 pt2.png

    code 10.11 pt3.png

    Exercise \(\PageIndex{1}\)

    Develop your own interactive simulation code. Explore various features of the plotting functions and the PyCX simulator’s GUI. Then revise your code so that it automatically generates a series of image files without using PyCX. Finally, create an animated movie file using the image files generated by your own code. Enjoy!


    This page titled 10.4: Simulation without PyCX is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by Hiroki Sayama (OpenSUNY) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.