The Collatz process embeds a base conversion algorithm
simcqca
is a simulator for the 2D Collatz Quasi Cellular Automaton. Please refer to the paper and the following Example section for more details and explanations about the above image: The Collatz process embeds a base conversion algorithm, Tristan Stérin and Damien Woods.
You need to install the graphic library SFML
(>=2.5) in order to build simcqca
as well as the cmake
toolchain.
All the necessary information is here: https://www.sfml-dev.org/download.php.
You can configure some parameters to adapt the rendering engine to your CPU/GPU configuration, see Advanced graphic configuration.
To build simcqca
do:
git clone https://github.com/tcosmo/simcqca.git
cd simcqca
mkdir build
cd build
cmake ..
make
- You are good to go! Look at the examples and controls to get started!
Building simcqca
has been tested on Linux and Mac OS, if it doesn't work for you please feel free to open an issue.
The latest stable release is v0.4.2
you can build this version of simcqca
by doing (after cloning):
git fetch --all --tags
git checkout tags/v0.4.2 -b v0.4.2-branch
Git will put you in a separate branch with version 0.4.2 of simcqca
.
You can go back to the development version by doing: git checkout master
.
In row mode, the input is a binary string. Each successive row corresponds to a new odd iteration of the Collatz process expressed in binary.
Examples
./simcqca --row 1001011111001000
./simcqca --row 10001010111000110000000000001111111111111111
Basic Controls
- Press
N
to trigger one simulation step - Press
M
to trigger as many steps as can fit in the screen - Press
P
to generate enough simulation steps in order to visualise the base conversion property: columns, which are written in base 3, convert to rows, which are written in base 2. Look at the terminal which will output some information about the numbers encoded in the outlined row/column (be careful of 64 bit precision).
In Column mode, the input is a ternary string. Each successive column corresponds to a new iteration of the Collatz process expressed in ternary.
./simcqca --col 12210000100011100110111112000
./simcqca --col 110012201
./simcqca --col 0001001010010222110010
In Border mode, the input is a parity vector. The automaton reconstructs the corresponding input row.
./simcqca --border 1100000000000000011111000101011011
./simcqca --border 0011000
In cycle mode, the input is a parity vector supposed to be the support of a cycle. The automaton reconstructs the 3-adic expansion of the corresponding rational cycling over this parity vector. If the option --cycle-row
is given, the automaton will reconstruct the 2-adic expansion of the same number (rational Collatz cyclic numbers are both 2-adic and 3-adic integers). If the option --cycle-both
is given the automaton will construct them both at the same time.
./simcqca --cycle 1000110
./simcqca --cycle 1000110 --cycle-row
./simcqca --cycle 00010101100
./simcqca --cycle 00010101100 --cycle-row
./simcqca --cycle 00010101100 --cycle-both
You can try it on the 4 known non-zero integer cycles (1 non-negative and 3 non-positive):
./simcqca --cycle 101010
: constructs the cycle (1,2,1,...)./simcqca --cycle 111111
: constructs the cycle (-1,-1,...)./simcqca --cycle 110110
: constructs the cycle (-5, -7, -10, -5, ...)./simcqca --cycle 11110111000
: constructs the cycle (-17, -25, -37, -55, -82, -41, -61, -91, -136, -68, -34, -17, ...)
ESC
: quitA
: outputs some performance information (FPS, vertex array size, etc..)
N
: next simulation stepM
: runs simulation step until they are not in view anymoreR
: resets the simulationP
:- In row/column modes will outline one instance of the base conversion result in the 2D CQCA. The outlined column represents a number in base 3' (most significant trit on top) and thus in base 3 by mapping each cell (bit,carry) as follows: (0,0) maps to the trit 0, (0,1) maps to the trit 1, (1,0) maps to the trit 1 and (1,1) maps to the trit 2. The outlined row represents a number in base 2 (most significant bit to the left) by simply keeping each cell's bit and ignoring carries. Those two numbers are the same. The terminal reads those numbers for you but be careful of the 64 bits precision: if the row gets too big (>64 bits) the output will look like nonsense.
- In border mode, pressing
P
will run the simulation until it is complete (finite evolution space). - In cycle mode, pressing
P
will run the simulation until the period of the 3-adic/2-adic expansion of the cycle is found. Will then output in the console the initial segment and period of that expansion (both little and big endian conventions). Warning: this printing is disabled inv0.4
.
We recommend the use of an optical mouse to manage the camera as functions of the trackpad are not supported and keyboard camera controls potentially cumbersome to use.
C
: centers the view on the originCTRL + SHIFT + ARROWS
: translates the viewMOUSE WHEEL BUTTON
: translates the view following the mouseCTRL + MOUSE WHEEL UP/DOWN
orCTRL + A/Z
: zoom in and out
T
: whether to render text information or not. Text rendering is quite efficient (not CPU intensive) in the last versions ofsimcqca
even when zoomed out farK
: enables colors for bit-carry-defined cells. One color per bit/carry possibility (0,0), (0,1), (1,0), (1,1)O
: outlines the origin in blue. When you are lost pressC
to center the view on the originE
: outlines all cells on the edge of the computed world in green.F
: in border and cycle mode outlines the original cells of the parity vector Warning: rendering for modesE
andF
are not optimized hence potential performance issues if used when too many cells on the edge/parity vector (too many being thousands).
ALT + LEFT ARROW/RIGHT ARROW
: rotates the input parity vector to the left/right and re-runs the simulation until it is not in view anymore
In order to visually outline some pattern of your choice you can select cells on the screen:
SHIFT + LEFT CLICK
: toggles (i.e. selects if not selected and unselect otherwise) the clicked cell with the current selection colorSHIFT + RIGHT/LEFT ARROW
: changes the current selection color (2 colors)SHIFT + RIGHT CLICK
: unselects all the cell sharing the same selection color (if any) as the clicked cellCTRL + LEFT CLICK + MOUSE MOVE
: selects all the cells hovered by the mouse (does not toggle, just selects)SHIFT + ALT + LEFT CLICK
: in cycle mode toggles the cell and outlines the underlying parity vector (which sets the equivalence relation on the world)
In the file src/config.h.in
the following constants have an impact on the rendering engine and its CPU/GPU performances. If you modify these values, they will be taken into account at your next make
:
TARGET_FPS
: the frame per seconds rate that is enforced by the engine. Default is 80. Higher rates are more CPU/GPU intensive.VERTEX_ARRAY_MAX_SIZE
: the number of vertices which are rendered at once by the GPU. Defaulft value is5*100*100
which is quite conservative. Advanced GPUs should be able to handle a lot more.