Chaos Theory: Difference Equation Iterator Program

This program demonstrates an interesting aspect of Chaos Theory. It shows how by iterating a simple non-linear equation, you can reproduce the apparent chaotic behaviour of complex-dynamical systems like the global weather, animal and plant populations, social interactions, boom and bust in economies and the ups and downs of trading markets.

Panel of the 'c' version of the Difference Equation Iterator.

This program incorporates all the applets shown in this series of web pages about Chaos Theory. It is written entirely in 'C' and does not use any external widget libraries. Create a new directory [folder] called 'chaos' in a place convenient to you. You can do this using your file browser or by opening a terminal and entering the command: md chaos

Use your browser's download facility [usually right-click on the link chaos.zip and select 'download' or 'save link as' in the drop-down menu that appears]. Place the downloaded file in your new 'chaos' directory. Unzip chaos.zip. Two files: 'chaos' and 'chaos.c' should now be present in your new directory alongside 'chaos.zip'.

If you are running 64-bit Linux you can run the ready-compiled program by entering the command: ./chaos

The program window shown above should appear ready to RUN. If it doesn't, you probably have a 32-bit com­puter: chaos, as downloaded is for a 64-bit computer. However, all you need to do is compile the source file chaos.c on your own computer [see below].

Mainstream warnings notwithstanding, this program will neither blow up your computer nor wreak any other kind of fanciful mischief. It simply draws on your screen. However, if you really do not trust a program from a "non bone fide" source like me, you can download and scrutinize the source code, then compile it and run it on your own computer as follows:

To compile the program from the source file, open a terminal and change directory to your new 'chaos' directory by entering the command: cd chaos. The compiling command is shown near the beginning of the source listing:

gcc chaos.c -L/usr/X11R6/lib -o chaos -lX11 -lm

All the necessary link libraries should be present in any Linux distribution. The compiling process should not take more than a couple of seconds. If the gcc compiler cannot find or link to the header file 'X11R6/lib' then you need to install it by entering the command: sudo apt-get install libx11-dev Your Unix/Linux distribution may use an installer other than apt-get.

To run the program, simply enter the command: ./chaos The program window shown above should appear ready to RUN. The resulting compiled code is for Unix-based operating systems [such as BSD or Linux] using the X11 windowing library. You can compile the program for other operating systems but you may need to invoke different libraries and adjust the code for proprietary non-standard language differences.


Home Page, Parent Page — © December 2019 Robert John Morton