Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Utility for computing.

Project Description

Very simple computation utility for entropy and mutual information on small one-dimensional classical cellular automata (CCA).


sim_cca is a python3 package. If you have all dependencies available, no installation will be necessary. Otherwise, you can install them manually as follows:

pip install docopt numpy sympy

This will also be done automatically, if you run the setup script (requires setuptools):

python install


The setup script installs an executable named sim_cca. If you didn’t install just use python -m sim_cca instead of plain sim_cca:

    sim_cca [-r RULE] [-a SIZE] [-s COUNT | -p | -n] QUANTITIES...

    -a SIZE, --alphabet SIZE    Alphabet size [default: 2]
    -r RULE, --rule RULE        Local update rule [default: a,b: a^b]
    -s COUNT, --samples COUNT   For monte-carlo mode
    -p, --picture               Draw a picture
    -n, --numeric               Numeric calculations

The -r RULE argument can be any valid lambda expression. Its arguments are the cells neighbors from left to right.

Use the -a SIZE option if you want each cell to have more than two possible states.

The QUANTITIES signify what shannon information measures should be computed. For examples, see below.

The other options specify which of the four available modes should be used:

Picture mode

Use the -p flag to verify that cells are labeled as expected:

$ sim_cca -r 'a,b: a and b' 'I(B0:C1:A1)' -p

--  A1  --
  B0  --

Note, how the graph shows only that portion of the CCA required for the computation of all cells mentioned in the QUANTITIES parameter.

Symbolic mode

This mode allows to calculate Shannon information measures on very small CCAs exactly. The input distribution is assumed to be uniform and mutually independent. This is the default mode. Example:

$ sim_cca -r 'a,b: a and b' 'I(B0:B2|B1)' 'H(B1)'

I(B0:B2|B1) = -5*log(5)/4 + 3*log(3)/4 + 7*log(2)/4
H(B1) = -3*log(3)/4 + 2*log(2)

This mode is unusable for larger CCAs, because its execution time goes exponentially in the number of possible input configurations.

Numeric mode

This essentially is equivalent to the symbolic mode, except that the computation and result is based on floating point values. It should be slightly more performant and have less loading overhead. Use the -n option to request this mode. Example:

$ sim_cca -r 'a,b,c: (a ^ b) or c' 'I(B0:B2)' -n

I(B0:B2) = -2.220446049250313e-16

Feel free to consider small values around 10^-16 to be zero.

Monte-carlo mode

This mode should be applicable to somewhat larger grids, but will naturally yield inaccurate results. All that it does is to repeatedly evolve the CCA on randomly sampled input configurations. The mode is used if the number of samples is passed via the -s COUNT argument:

$ sim_cca -r 'a,b,c: (a ^ b) or c' 'I(B0:B2)' -s 1000

I(B0:B2) = -2.220446049250313e-16

Cell labels

In general, a cell name consists of a letter and a number. The letter signifies the time starting at A (t=0) and the number labels the spatial index. If the update rule has an uneven number of arguments, there should be no confusion. The labeling is as follows:

A0  A1  A2
B0  B1  B2
C0  C1  C2

Assuming 3 function arguments, B1 is a function of (A0,A1,A2) B1 = f(A0,A1,A2) and is a parent of C0, C1 and C2.

If the update rule has an even number of arguments, the cells at odd time steps should be imagined interleaved, for example:

A0  A1  A2
  B0  B1  B2
C0  C1  C2

Assuming 2 function arguments, B0 is a function of (A0,A1) and is preliminary for the computation of C0 and C1.

Release History

This version
History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(9.0 kB) Copy SHA256 Hash SHA256
Source Mar 21, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting