Automata
Automata: elementary, life-like, noisy, and group automata, and subshifts.
It also holds automata over infinite alphabets.
AddingMachineSystem(digits=6, *, base=2, initial=None, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The adding machine r → r + 1 on the q-adic integers.
It is the odometer acting on the q-ary tree.
The cells hold the digits of r, the lowest first, the first digits letters of its infinite word, a vertex of the
q-ary tree. Every step adds 1: the lowest digit turns by the cycle 0 → 1 → ... → q - 1 → 0, and a digit turns when
every lower digit is q - 1, the carry (Ceccherini-Silberstein and Coornaert 2023, Exercise 6.59). The machine is
an automorphism of the tree of infinite order whose orbits are dense, and on the first digits levels it visits all
q^digits vertices in turn. The lowest digit reads q - 1 beyond the segment, the carry of +1. The system has
the digits cells.digit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
digits
|
int
|
The number of digits kept, the depth of the tree. |
6
|
base
|
int
|
The base |
2
|
initial
|
ArrayLike | None
|
The initial digits, the lowest first, or |
None
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ParameterError
|
The base is below 2. |
Examples:
>>> from skcomplex.systems.computer_science.automata import AddingMachineSystem
>>> AddingMachineSystem(3).prepare().simulate(until=5).get_values('cells.digit')[-1].tolist()
[1.0, 0.0, 1.0]
Source code in src/skcomplex/systems/computer_science/automata/_shift_spaces.py
634 635 636 637 638 639 640 641 642 643 644 645 646 647 | |
AdditiveRuleInteraction(label, *, target='cells')
Bases: Interaction
Additive rule over the nonnegative integers, x'(n) = x(n - 1) + x(n).
From a single 1 the cells after t steps hold the binomial coefficients C(t, k).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import AdditiveRuleInteraction
>>> AdditiveRuleInteraction('addition', target='cells').target
'cells'
Source code in src/skcomplex/systems/computer_science/automata/_variants.py
201 202 203 | |
AntCellElement(label, *, color=0, ant=-1, space=None)
Bases: Element
Cell of Langton's ant: a color, and the heading of the ant on it or -1.
A LangtonsAntInteraction turns the ant right on a white cell and left on a black one, flips the cell's color, and
moves the ant one cell forward. With space, the element holds one cell on every site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cells. |
required |
color
|
Annotated[float | Array, {0, 1}]
|
The initial color, 0 for white and 1 for black, or one color per cell. |
0
|
ant
|
Annotated[float | Array, ZZ]
|
The initial heading of an ant on the cell, 0 to 3 for north, east, south, and west, or -1 for none, or one heading per cell. |
-1
|
space
|
BaseSpace | None
|
The space with one cell on every site, such as a lattice, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import AntCellElement
>>> AntCellElement('cell').ant
-1
Source code in src/skcomplex/systems/computer_science/automata/_automata.py
62 63 64 65 66 67 68 69 70 71 72 | |
BaumslagSolitarAutomatonSystem(m=1, n=2, *, radius=6, density=0.5, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The majority automaton on a ball of the Baumslag-Solitar group BS(m, n).
The group has exponential growth. Every cell reads itself and the cells at a, a^-1, t, and t^-1, and takes
the majority value. The ball is built from a confluent rewriting system of the presentation, which GAP finds for
BS(1, n). The system has the cells cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m
|
int
|
The exponent of |
1
|
n
|
int
|
The exponent it is conjugated to. |
2
|
radius
|
int
|
The radius of the ball. |
6
|
density
|
float
|
The probability that a cell starts at 1. |
0.5
|
random_state
|
int | Generator | None
|
The seed or generator of the initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import BaumslagSolitarAutomatonSystem
>>> BaumslagSolitarAutomatonSystem(radius=2).prepare().simulate(until=1).get_values('cells.alive').shape
(2, 17)
Source code in src/skcomplex/systems/computer_science/automata/_group_automata.py
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | |
BinaryCellElement(label, *, alive=0, space=None)
Bases: Element
Cell of an automaton whose value alive is 0 or 1.
The local rule of an interaction changes the value. With space, the element holds one cell on every site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cells. |
required |
alive
|
Annotated[float | Array, {0, 1}]
|
The initial value, 0 or 1, or one value per cell. |
0
|
space
|
BaseSpace | None
|
The space with one cell on every site, such as a lattice, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import BinaryCellElement
>>> BinaryCellElement('cell', alive=1).alive
1
Source code in src/skcomplex/systems/computer_science/automata/_binary_cell.py
34 35 36 37 38 39 40 41 42 | |
CarryInteraction(label, *, target='cells', base=2, digits=6)
Bases: Interaction
Addition of 1 to the digits of a q-adic integer, the lowest first.
A digit turns by the cycle 0 → 1 → ... → q - 1 → 0 when every lower digit is q - 1, the carry, and keeps its
value otherwise. The lowest digit reads q - 1 beyond the digits, so it turns at every step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells of the digits, whose state |
'cells'
|
base
|
int
|
The base |
2
|
digits
|
int
|
The number of digits. |
6
|
Examples:
>>> from skcomplex.systems.computer_science.automata import CarryInteraction
>>> CarryInteraction('carry', target='cells', base=3).base
3
Source code in src/skcomplex/systems/computer_science/automata/_shift_spaces.py
281 282 283 284 285 | |
ContextFreeMoveInteraction(label, *, target='cells', size=60)
Bases: Interaction
Random moves of a ring of symbols that stay in the context-free subshift.
Every step proposes to change every cell, in a random order, to one of the two other symbols, and rejects the
changes that would leave a block 0 1^h 2^k 0 with h != k. The moves sample the admissible rings uniformly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells of the ring, whose state |
'cells'
|
size
|
int
|
The number of cells of the ring. |
60
|
Examples:
>>> from skcomplex.systems.computer_science.automata import ContextFreeMoveInteraction
>>> ContextFreeMoveInteraction('moves', target='cells', size=12).size
12
Source code in src/skcomplex/systems/computer_science/automata/_shift_spaces.py
193 194 195 196 | |
ContextFreeSubshiftSystem(size=60, *, initial=None, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A Markov chain on the context-free subshift.
The subshift holds the ternary rings where every block 0 1^h 2^k 0 has h = k.
The subshift is not sofic, since a finite graph cannot match the counts of ones and twos (Ceccherini-Silberstein and
Coornaert 2023, Exercise 6.80). Every step proposes to change every cell of the ring, in a random order, to one of
the two other symbols, and rejects the changes that would leave the subshift, so the chain samples its admissible
rings uniformly. It starts from blocks 0 1^h 2^h, with h drawn from a geometric law. The system has the symbols
cells.symbol.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
The number of cells of the ring. |
60
|
initial
|
ArrayLike | None
|
The initial symbols, an admissible ring, or |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the initial blocks. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ParameterError
|
The initial ring is not admissible. |
Examples:
>>> from skcomplex.systems.computer_science.automata import ContextFreeSubshiftSystem
>>> ContextFreeSubshiftSystem(12).prepare().system_.elements[0].symbol.tolist()
[0.0, 1.0, 1.0, 2.0, 2.0, 0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 0.0]
Source code in src/skcomplex/systems/computer_science/automata/_shift_spaces.py
486 487 488 489 490 491 492 493 494 495 496 497 498 499 | |
DNAComputationSystem(n_strands=2000, *, edges=ADLEMAN_EDGES, start=0, end=6, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Adleman's DNA computation of a Hamiltonian path.
It runs by random ligation of edge oligos in a test tube. Every node of a directed graph is an oligonucleotide, and
every link an oligo that joins the end of one node to the start of the next, so ligation builds strands that spell
random paths of the graph. The tube starts with edge oligos drawn uniformly from the links, which meet in random
pairs and join when the end of one is the start of the other. Adleman's filters then keep the strands that start at
start and end at end, that pass through as many nodes as the graph has, and that visit every node, and any
strand left is a Hamiltonian path. On the graph of Adleman's experiment, with seven nodes and fourteen links,
solutions appear after some steps and every one of them is the path 0, 1, 2, 3, 4, 5, 6, while a graph without a
Hamiltonian path leaves no strand. The system has the group strands of paths path, padded with -1. Its standard
observable solutions is the number of strands that pass the filters for the default nodes of Adleman's graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_strands
|
int
|
The number of strands in the tube. |
2000
|
edges
|
Sequence[tuple[int, int]]
|
The directed links of the graph, with the nodes numbered from 0. |
ADLEMAN_EDGES
|
start
|
int
|
The node the paths start at. |
0
|
end
|
int
|
The node the paths end at. |
6
|
random_state
|
int | Generator | None
|
The seed or generator of the initial oligos. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ParameterError
|
The graph has no links, or the start or the end is not a node of it. |
Examples:
>>> from skcomplex.systems.computer_science.automata import DNAComputationSystem
>>> DNAComputationSystem(10).prepare().system_.elements[0].path.shape
(10, 7)
Source code in src/skcomplex/systems/computer_science/automata/_dna_computation.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
DiffusionAutomatonSystem(shape=(50, 50), *, r=0.1, width=10, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A cellular automaton of diffusion, c' = c + r Σ (c_neighbour - c).
It starts from a square of ones. The total content is conserved on the torus, and the square spreads into a Gaussian
bump. The system has the contents cells.level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
Sequence[int]
|
The number of rows and columns of the torus. |
(50, 50)
|
r
|
float
|
The share of the difference with a neighbour exchanged in a step. |
0.1
|
width
|
int
|
The side of the central square of cells that start with content 1. |
10
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import DiffusionAutomatonSystem
>>> float(DiffusionAutomatonSystem((20, 20), width=4).prepare().system_.elements[0].level.sum())
16.0
Source code in src/skcomplex/systems/computer_science/automata/_variants.py
423 424 425 426 427 428 429 430 431 432 433 434 435 436 | |
DiffusionCellElement(label, *, level=0.0, space=None)
Bases: Element
Cell of a lattice with a nonnegative content.
A DiscreteDiffusionInteraction exchanges a share of the difference of contents with every neighbour. With space,
the element holds one cell on every site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cells. |
required |
level
|
Annotated[float | Array, closed_open(0, oo)]
|
The initial content, or one content per cell. |
0.0
|
space
|
BaseSpace | None
|
The space with one cell on every site, such as a lattice, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import DiffusionCellElement
>>> DiffusionCellElement('cell', level=2.0).level
2.0
Source code in src/skcomplex/systems/computer_science/automata/_variants.py
63 64 65 66 67 68 69 70 71 | |
DigitCellElement(label, *, digit=0, space=None)
Bases: Element
Cell holding a digit of a q-adic integer, from 0 to base - 1.
The digit is the label of a vertex of the q-ary tree. With space, the element holds one cell on every site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cells. |
required |
digit
|
Annotated[float | Array, ZZ]
|
The initial digit, or one digit per cell. |
0
|
space
|
BaseSpace | None
|
The space with one cell on every site, such as a lattice, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import DigitCellElement
>>> DigitCellElement('cell', digit=1).digit
1
Source code in src/skcomplex/systems/computer_science/automata/_shift_spaces.py
61 62 63 64 65 66 67 68 69 | |
DiscreteDiffusionInteraction(label, *, target='cells', r=0.1)
Bases: Interaction
Discrete diffusion of the contents of cells, c' = c + r Σ (c_neighbour - c).
Every cell exchanges the share r of the difference of contents with each of its four nearest neighbours, so the
total content is conserved on a torus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
r
|
float
|
The share of the difference with a neighbour exchanged in a step, below |
0.1
|
Examples:
>>> from skcomplex.systems.computer_science.automata import DiscreteDiffusionInteraction
>>> DiscreteDiffusionInteraction('diffusion', target='cells', r=0.2).r
0.2
Source code in src/skcomplex/systems/computer_science/automata/_variants.py
155 156 157 158 | |
ElementaryAutomatonSystem(rule=30, *, size=101, initial=None, label='system', solver='auto', backend='auto')
Bases: BaseSystem
An elementary cellular automaton by its Wolfram number.
By default it starts from a single live cell. The system has the cells cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rule
|
int
|
The Wolfram number from 0 to 255. |
30
|
size
|
int
|
The number of cells of the ring. |
101
|
initial
|
Sequence[float] | None
|
The initial cells, or |
None
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import ElementaryAutomatonSystem
>>> trajectory = ElementaryAutomatonSystem(90, size=7).prepare().simulate(until=2)
>>> trajectory.get_values('cells.alive')[-1].astype(int).tolist()
[0, 1, 0, 0, 0, 1, 0]
Source code in src/skcomplex/systems/computer_science/automata/_automata.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
ElementaryRuleInteraction(label, *, target='cells', rule=30)
Bases: Interaction
Elementary rule of a line of cells, given by its Wolfram number.
Every cell reads itself and its two neighbours, which make one of eight patterns, and the bit of the Wolfram number at the place of that pattern gives its next value. Rule 30 looks random, and rule 90 draws Pascal's triangle modulo 2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
rule
|
int
|
The Wolfram number from 0 to 255. |
30
|
Examples:
>>> from skcomplex.systems.computer_science.automata import ElementaryRuleInteraction
>>> ElementaryRuleInteraction('rule', target='cells', rule=90).rule
90
Source code in src/skcomplex/systems/computer_science/automata/_automata.py
98 99 100 101 | |
FredkinReplicatorSystem(shape=(128, 128), *, initial=None, radius=4.0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Fredkin's parity automaton.
Its local law copies any initial pattern into translated replicas.
Every cell takes the sum modulo 2 of its four nearest neighbours, x(i, j, n + 1) = x(i - 1, j, n) + x(i + 1, j, n)
+ x(i, j - 1, n) + x(i, j + 1, n) (mod 2). The law is linear over the integers modulo 2, and raising it to the
power 2^k gives the sum of the pattern translated by 2^k cells in each of the four directions, so at the times
2^k the initial pattern reappears four times, far enough apart not to overlap once 2^k exceeds its width, and at
other times the copies multiply in more complex arrangements. By default the pattern is a circumference, as in
Dilão's example. The system has the cells cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
Sequence[int]
|
The number of rows and columns of the torus. |
(128, 128)
|
initial
|
ArrayLike | None
|
The initial cells, an array of the shape, or |
None
|
radius
|
float
|
The radius of the default circumference. |
4.0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import FredkinReplicatorSystem
>>> int(FredkinReplicatorSystem((32, 32)).prepare().system_.elements[0].alive.sum())
32
Source code in src/skcomplex/systems/computer_science/automata/_fredkin_replicator.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
FreeGroupAutomatonSystem(rank=2, *, radius=6, density=0.5, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The majority automaton on a ball of the free group.
The ball is a tree in which every cell follows its neighbours. Every cell reads itself and the cells at its
generators and their inverses, and takes the majority value, so the random start freezes into blocks of agreeing
cells. Cells on the boundary count only their neighbours inside the ball. The system has the cells cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rank
|
int
|
The number of generators. |
2
|
radius
|
int
|
The radius of the ball. |
6
|
density
|
float
|
The probability that a cell starts at 1. |
0.5
|
random_state
|
int | Generator | None
|
The seed or generator of the initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import FreeGroupAutomatonSystem
>>> FreeGroupAutomatonSystem(radius=3).prepare().simulate(until=1).get_values('cells.alive').shape
(2, 53)
Source code in src/skcomplex/systems/computer_science/automata/_group_automata.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
GameOfLifeSystem(shape=(100, 100), *, density=0.3, initial=None, born=(3,), survive=(2, 3), random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Conway's Game of Life, or another life-like rule, on a torus.
The system has the cells cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
Sequence[int]
|
The number of rows and columns. |
(100, 100)
|
density
|
float
|
The probability that a cell starts alive, when no initial cells are given. |
0.3
|
initial
|
ArrayLike | None
|
The initial cells, an array of the shape, or |
None
|
born
|
Sequence[int]
|
The numbers of live neighbours that bring a dead cell to life. |
(3,)
|
survive
|
Sequence[int]
|
The numbers of live neighbours that keep a live cell alive. |
(2, 3)
|
random_state
|
int | Generator | None
|
The seed or generator of the random initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import GameOfLifeSystem
>>> GameOfLifeSystem((20, 30)).prepare().simulate(until=1).get_lattice('cells.alive').shape
(2, 20, 30)
Source code in src/skcomplex/systems/computer_science/automata/_automata.py
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
GapShiftInteraction(label, *, target='cells', hazards=(1.0,), size=120)
Bases: Interaction
Shift of a window of a binary configuration whose gaps between ones are independent.
Every step moves the window one cell to the left. The cell entering on the right is a one with the hazard of the gap since the last one, the probability that a gap of that length ends there.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells of the window, whose state |
'cells'
|
hazards
|
Sequence[float]
|
The probability that a gap ends at every length, from 0. |
(1.0,)
|
size
|
int
|
The number of cells of the window. |
120
|
Examples:
>>> from skcomplex.systems.computer_science.automata import GapShiftInteraction
>>> GapShiftInteraction('shift', target='cells', hazards=(0.5, 1.0), size=10).size
10
Source code in src/skcomplex/systems/computer_science/automata/_shift_spaces.py
129 130 131 132 133 134 135 136 137 138 139 140 | |
GapSubshiftSystem(size=120, *, gaps=None, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The shift on the S-gap subshift.
The S-gap subshift holds the binary sequences whose runs of zeros between ones lie in S.
With S the even numbers it is the even subshift, strictly sofic and not of finite type (Ceccherini-Silberstein and
Coornaert 2023, Exercises 1.85 and 1.92). The cells are a window of a configuration drawn from the measure of
maximal entropy, whose gaps are independent with the probability λ^-(h + 1) of the gap h, where λ solves
sum_(h in S) λ^-(h + 1) = 1 and log λ is the entropy. Every step shifts the window one cell to the left, and the
cell entering on the right is a one with the probability that the gap since the last one ends there. A gap longer
than the window counts as the window. Gaps are taken below ten times the size. The system has the cells
cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
The number of cells of the window. |
120
|
gaps
|
Sequence[int] | None
|
The allowed numbers of zeros between consecutive ones, the set |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the initial window. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ParameterError
|
No allowed gap lies below ten times the size. |
Examples:
>>> from skcomplex.systems.computer_science.automata import GapSubshiftSystem
>>> cells = GapSubshiftSystem(40).prepare().system_.elements[0].alive
>>> runs = [len(run) for run in ''.join(str(int(cell)) for cell in cells).strip('0').split('1') if run]
>>> all(run % 2 == 0 for run in runs)
True
Source code in src/skcomplex/systems/computer_science/automata/_shift_spaces.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
GeneratorNeighborhood(generators, *, center=True, inverses=True, label='neighborhood')
Bases: MemoryNeighborhood
Memory set of the generators of a group.
It is a MemoryNeighborhood whose words are the generators of the group of a cellular automaton on a Cayley graph.
The identity comes first, and the inverses follow when asked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
generators
|
tuple[str, ...]
|
The names of the generators of the group. |
required |
center
|
bool
|
Whether the identity comes first. |
True
|
inverses
|
bool
|
Whether every generator is followed by its inverse. |
True
|
label
|
str
|
The label of the neighbourhood. |
'neighborhood'
|
Attributes:
| Name | Type | Description |
|---|---|---|
elements_ |
The words of the memory set. |
Examples:
>>> from skcomplex.systems.computer_science.automata import GeneratorNeighborhood
>>> GeneratorNeighborhood(['a', 'b']).prepare().elements_
('1', 'a', 'a^-1', 'b', 'b^-1')
Source code in src/skcomplex/systems/computer_science/automata/_generator_neighborhood.py
38 39 40 41 42 43 44 45 46 47 48 49 | |
GoldenCellElement(label, *, alive=0, space=None)
Bases: Element
Cell of the golden mean shift, whose state alive is 0 or 1.
Its configurations hold no two adjacent ones. With space, the element holds one cell on every site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cells. |
required |
alive
|
Annotated[float | Array, GOLDEN_MEAN]
|
The initial value, 0 or 1, or one value per cell. |
0
|
space
|
BaseSpace | None
|
The space with one cell on every site, such as a lattice, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import GoldenCellElement
>>> GoldenCellElement('cell', alive=1).alive
1
Source code in src/skcomplex/systems/computer_science/automata/_group_automata.py
59 60 61 62 63 64 65 66 67 | |
GoldenMeanMoveInteraction(label, *, target='cells')
Bases: Interaction
Random flips of binary cells that never put two ones side by side.
Every step proposes to flip every cell, in a random order, with probability one half, and rejects the flips that would put a one next to another one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import GoldenMeanMoveInteraction
>>> GoldenMeanMoveInteraction('flips', target='cells').target
'cells'
Source code in src/skcomplex/systems/computer_science/automata/_group_automata.py
266 267 268 | |
GrigorchukAutomatonSystem(*, radius=8, density=0.5, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The majority automaton on a ball of the Grigorchuk group.
The group has intermediate growth. Every cell reads itself and the cells at the generators a, b, c, and d,
all of order 2, and takes the majority value. The ball of radius 8 holds 271 sites, and cells on its boundary count
only their neighbours inside it. The system has the cells cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
int
|
The radius of the ball. |
8
|
density
|
float
|
The probability that a cell starts at 1. |
0.5
|
random_state
|
int | Generator | None
|
The seed or generator of the initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import GrigorchukAutomatonSystem
>>> GrigorchukAutomatonSystem(radius=3).prepare().simulate(until=1).get_values('cells.alive').shape
(2, 23)
Source code in src/skcomplex/systems/computer_science/automata/_group_automata.py
754 755 756 757 758 759 760 761 762 763 764 765 766 767 | |
GroupCellElement(label, *, value=0, space=None)
Bases: Element
Cell of an automaton whose alphabet is a group.
It holds a group element by its number. The number is the site of the element in a group space, or its position in
the list of a finite group, and a negative number names no element, the fill value read outside a ball. With
space, the element holds one cell on every site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cells. |
required |
value
|
Annotated[float | Array, ZZ]
|
The number of the initial group element, 0 for the identity, or one number per cell. |
0
|
space
|
BaseSpace | None
|
The space with one cell on every site, such as a lattice or a group, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import GroupCellElement
>>> GroupCellElement('cell', value=2).value
2
Source code in src/skcomplex/systems/computer_science/automata/_alphabets.py
61 62 63 64 65 66 67 68 69 | |
GroupDifferenceAutomatonSystem(size=60, *, group=None, initial=None, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The automaton τ(x)(n) = x(n)^-1 x(n + 1) whose alphabet is a finite group.
It runs on a ring. Over the integers, with the generator s0 = 1 of infinite order and a nontrivial group alphabet,
the automaton is surjective but not injective (Ceccherini-Silberstein and Coornaert 2023, Exercise 3.24): every
constant configuration maps to the identity. The ring is the finite quotient of order size, where the product of
the image around the ring is the identity. Cells hold group elements by their number in the Cayley table of Sage,
the identity first. The system has the group elements cells.value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
The number of cells of the ring. |
60
|
group
|
PermutationGroup_generic | None
|
The finite group, a Sage permutation group, or |
None
|
initial
|
ArrayLike | None
|
The initial numbers of the elements, or |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the random initial elements. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import GroupDifferenceAutomatonSystem
>>> GroupDifferenceAutomatonSystem(10).prepare().simulate(until=1).get_values('cells.value').shape
(2, 10)
Source code in src/skcomplex/systems/computer_science/automata/_alphabets.py
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | |
GroupDifferenceInteraction(label, *, target='cells', group=None)
Bases: Interaction
Difference τ(x)(n) = x(n)^-1 x(n + 1) of cells holding elements of a finite group.
Cells hold group elements by their number in the Cayley table of Sage, the identity first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
group
|
PermutationGroup_generic | None
|
The finite group, a Sage permutation group, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import GroupDifferenceInteraction
>>> GroupDifferenceInteraction('difference', target='cells').group is None
True
Source code in src/skcomplex/systems/computer_science/automata/_alphabets.py
341 342 343 344 | |
HeisenbergAutomatonSystem(*, radius=5, density=0.5, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The majority automaton on a ball of the discrete Heisenberg group.
The group has polynomial growth of degree 4. Every cell reads itself and the cells at a, a^-1, b, and b^-1,
on the right, and takes the majority value. The system has the cells cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
int
|
The radius of the ball. |
5
|
density
|
float
|
The probability that a cell starts at 1. |
0.5
|
random_state
|
int | Generator | None
|
The seed or generator of the initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import HeisenbergAutomatonSystem
>>> HeisenbergAutomatonSystem(radius=2).prepare().simulate(until=1).get_values('cells.alive').shape
(2, 17)
Source code in src/skcomplex/systems/computer_science/automata/_group_automata.py
481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
HighlifeSystem(shape=(100, 100), *, rule='B36/S23', density=0.3, initial=None, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
HighLife, B36/S23, or any other life-like automaton of the planar zoo.
The automaton is given by its rule. It runs on a torus. HighLife adds birth on six neighbours to Conway's rule,
which gives it a small self-replicating pattern. Other members of the zoo are Seeds, B2/S, Day and Night,
B3678/S34678, and Life without death, B3/S012345678. The system has the cells cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
Sequence[int]
|
The number of rows and columns. |
(100, 100)
|
rule
|
str
|
The rule in the notation |
'B36/S23'
|
density
|
float
|
The probability that a cell starts alive, when no initial cells are given. |
0.3
|
initial
|
ArrayLike | None
|
The initial cells, an array of the shape, or |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the random initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ParameterError
|
The rule is not in the notation |
Examples:
>>> from skcomplex.systems.computer_science.automata import HighlifeSystem
>>> rule = HighlifeSystem((10, 10), rule='B2/S').prepare().system_.interactions[0]
>>> rule.born, rule.survive
((2,), ())
Source code in src/skcomplex/systems/computer_science/automata/_variants.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | |
InvolutiveAutomatonSystem(n=3, *, size=80, density=0.6, initial=None, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A binary automaton on a ring that is its own inverse.
Its minimal memory set is {-1, 0, ..., n}. A cell at the left end of a run of exactly n ones, the window
alpha = 0 1^n 0, becomes 0, a cell just before a run of exactly n - 1 ones, the window beta = 0 0 1^(n - 1) 0,
becomes 1, and every other cell keeps its value (Ceccherini-Silberstein and Coornaert 2023, Exercise 1.36). The two
moves undo each other, so two steps return every configuration to itself, and the automaton is invertible with
τ^-1 = τ. The system has the cells cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
The length of the runs of ones, at least 3. |
3
|
size
|
int
|
The number of cells of the ring. |
80
|
density
|
float
|
The probability that a cell starts at 1, when no initial cells are given. |
0.6
|
initial
|
ArrayLike | None
|
The initial cells, or |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the random initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ParameterError
|
The run length is below 3. |
Examples:
>>> from skcomplex.systems.computer_science.automata import InvolutiveAutomatonSystem
>>> values = InvolutiveAutomatonSystem(3, size=20).prepare().simulate(until=2).get_values('cells.alive')
>>> bool((values[2] == values[0]).all())
True
Source code in src/skcomplex/systems/computer_science/automata/_line_automata.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
InvolutiveRuleInteraction(label, *, target='cells', n=3)
Bases: Interaction
Rule of a binary line that is its own inverse.
Every cell reads the window of offsets -1, 0, ..., n. The window alpha = 0 1^n 0 sends the cell to 0, the
window beta = 0 0 1^(n - 1) 0 sends it to 1, and every other window keeps it, so two steps return every
configuration to itself.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
n
|
int
|
The length of the runs of ones. |
3
|
Examples:
>>> from skcomplex.systems.computer_science.automata import InvolutiveRuleInteraction
>>> InvolutiveRuleInteraction('rule', target='cells', n=4).n
4
Source code in src/skcomplex/systems/computer_science/automata/_line_automata.py
104 105 106 107 | |
LamplighterAutomatonSystem(*, radius=7, density=0.1, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The parity automaton on a ball of the lamplighter group.
It is a linear rule over the field of two elements. Every cell takes the sum modulo 2 of itself and the cells at the
generators a and b, so a few ones spread into nested, self-similar patterns over the Diestel-Leader graph of the
group. The system has the cells cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
int
|
The radius of the ball. |
7
|
density
|
float
|
The probability that a cell starts at 1. |
0.1
|
random_state
|
int | Generator | None
|
The seed or generator of the initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import LamplighterAutomatonSystem
>>> LamplighterAutomatonSystem(radius=3).prepare().simulate(until=1).get_values('cells.alive').shape
(2, 39)
Source code in src/skcomplex/systems/computer_science/automata/_group_automata.py
413 414 415 416 417 418 419 420 421 422 423 424 425 426 | |
LangtonsAntInteraction(label, *, target='cells')
Bases: Interaction
Move of Langton's ant over the colored cells.
The ant turns right on a white cell and left on a black one, flips the color of the cell it leaves, and moves one cell forward. Every cell holds its color and the heading of an ant on it, or -1 for none.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose states |
'cells'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import LangtonsAntInteraction
>>> LangtonsAntInteraction('ant', target='cells').target
'cells'
Source code in src/skcomplex/systems/computer_science/automata/_automata.py
136 137 138 | |
LangtonsAntSystem(shape=(80, 80), *, heading=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Langton's ant, which builds a periodic highway after a chaotic transient.
It wanders chaotically for about 10,000 steps before it builds the highway. The system has the colors cells.color
and the ant cells.ant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
Sequence[int]
|
The number of rows and columns of the torus. |
(80, 80)
|
heading
|
int
|
The initial heading of the ant, 0 to 3 for north, east, south, and west. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import LangtonsAntSystem
>>> int((LangtonsAntSystem((9, 9)).prepare().system_.elements[0].ant >= 0).sum())
1
Source code in src/skcomplex/systems/computer_science/automata/_automata.py
346 347 348 349 350 351 352 353 354 355 356 357 | |
LaplacianCellElement(label, *, value=0, space=None)
Bases: Element
Cell of an automaton over the field of a prime number of elements.
An example is the discrete Laplacian on a ring. With space, the element holds one cell on every site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cells. |
required |
value
|
Annotated[float | Array, ZZ]
|
The initial value, an integer from 0 to the size of the field minus 1, or one value per cell. |
0
|
space
|
BaseSpace | None
|
The space with one cell on every site, such as a lattice, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import LaplacianCellElement
>>> LaplacianCellElement('cell', value=2).value
2
Source code in src/skcomplex/systems/computer_science/automata/_group_automata.py
91 92 93 94 95 96 97 98 99 | |
LaplacianRuleInteraction(label, *, target='cells', modulus=3)
Bases: Interaction
Discrete Laplacian x(g - 1) + x(g + 1) - 2 x(g) of cells on a ring, modulo the size of a field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
modulus
|
int
|
The prime size of the field. |
3
|
Examples:
>>> from skcomplex.systems.computer_science.automata import LaplacianRuleInteraction
>>> LaplacianRuleInteraction('laplacian', target='cells', modulus=5).modulus
5
Source code in src/skcomplex/systems/computer_science/automata/_group_automata.py
219 220 221 222 | |
LeniaSiteElement(label, *, A=0.0, B=0.0, C=0.0, space=None)
Bases: Element
Site of a Lenia world, with a value in [0, 1] for each of its channels.
A world has up to three channels. The updates of the world change the channels, and a world of one channel leaves
B and C at 0. With space, the element holds one site on every site of the space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the sites. |
required |
A
|
Annotated[float | Array, closed(0, 1)]
|
The initial value of the first channel, or one value per site. |
0.0
|
B
|
Annotated[float | Array, closed(0, 1)]
|
The initial value of the second channel, or one value per site. |
0.0
|
C
|
Annotated[float | Array, closed(0, 1)]
|
The initial value of the third channel, or one value per site. |
0.0
|
space
|
BaseSpace | None
|
The space of the world, such as a torus of sites, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import LeniaSiteElement
>>> LeniaSiteElement('site', A=0.5).A
0.5
Source code in src/skcomplex/systems/computer_science/automata/_lenia.py
89 90 91 92 93 94 95 96 97 98 99 100 101 | |
LeniaSystem(shape=(64, 64), *, initial=None, R=13.0, T=10.0, mu=0.15, sigma=0.015, beta=(1.0,), channels=1, kernels=None, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Lenia, a continuous automaton whose ring-kernel convolutions grow solitons.
The solitons are gliding and lifelike. The world is a torus of sites with values in [0, 1], and one step of
1 / T adds the growth map of the convolution of the world with a ring kernel and clips the result,
A <- [A + G(K * A) / T] in [0, 1], with G(u) = 2 exp(-(u - mu)^2 / (2 sigma^2)) - 1 and the kernel of radius
R, whose concentric rings peak at beta. The expanded universe of Chan (2020) has several channels and several
kernels (source, destination, r, h, beta, mu, sigma), each of radius r R with its own growth map, which reads
its source channel and grows its destination with the weight h over the sum of the weights into that destination,
A_j <- [A_j + sum_k (h_k / h_j) G_k(K_k * A_i) / T], on worlds of three or more dimensions. By default the world
holds Orbium unicaudatus, which glides across the torus at a steady speed while its mass stays near 71. Every step
of the system is one update, so a unit of Lenia's time takes T steps. The system has the values world.A,
world.B, and world.C of the three channels of the sites, the last two at 0 for a world of one channel. Its
standard observables mass_A, mass_B, and mass_C are the totals of the values of every channel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
Sequence[int]
|
The number of sites along every axis of the torus, two or more axes. |
(64, 64)
|
initial
|
ArrayLike | None
|
The initial values, an array of the shape shared by every channel, or one per channel, or |
None
|
R
|
float
|
The radius of the kernels in sites. |
13.0
|
T
|
float
|
The number of steps per unit time, the inverse of the increment of the update. |
10.0
|
mu
|
float
|
The centre of the growth map of the single kernel. |
0.15
|
sigma
|
float
|
The width of the growth map of the single kernel. |
0.015
|
beta
|
Sequence[float]
|
The peaks of the concentric rings of the single kernel. |
(1.0,)
|
channels
|
int
|
The number of channels of the world, from one to three. |
1
|
kernels
|
Sequence[Kernel] | None
|
The kernels |
None
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ParameterError
|
The world has fewer than two axes or not one to three channels, Orbium does not fit a default world, the initial values do not have the shape, or a kernel names a channel the world does not have. |
Examples:
>>> from skcomplex.systems.computer_science.automata import LeniaSystem
>>> LeniaSystem().prepare().system_.elements[0].A.shape
(4096,)
Source code in src/skcomplex/systems/computer_science/automata/_lenia.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
LeniaUpdateInteraction(label, *, target='world', channel='A', kernels=(('A', 13.0, 1.0, (1.0,), 0.15, 0.015),), T=10.0, n_dim=2)
Bases: Interaction
Update of a channel of a Lenia world by the growth maps of convolutions.
The convolutions are of channels with ring kernels.
Every kernel (source, radius, h, beta, mu, sigma) reads the state of its source channel, and its concentric
rings peak at beta. At the distance q in units of its radius, with B rings, it is beta_i K_C(B q - i) on
the ring i = floor(B q), with the bump K_C(x) = exp(4 - 1 / (x (1 - x))), normalised to a sum of 1 over the
sites. Its growth map is G(u) = 2 exp(-(u - mu)^2 / (2 sigma^2)) - 1, and one step adds the growths weighted by
h over the sum of the weights and clips the channel, A <- [A + sum_k (h_k / h) G_k(K_k * A_k) / T] in
[0, 1].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the world. |
'world'
|
channel
|
str
|
The name of the state of the channel that the update changes. |
'A'
|
kernels
|
Sequence[RingKernel]
|
The kernels |
(('A', 13.0, 1.0, (1.0,), 0.15, 0.015),)
|
T
|
float
|
The number of steps per unit time. |
10.0
|
n_dim
|
int
|
The number of dimensions of the world. |
2
|
Examples:
>>> from skcomplex.systems.computer_science.automata import LeniaUpdateInteraction
>>> LeniaUpdateInteraction('update', target='world').T
10.0
Source code in src/skcomplex/systems/computer_science/automata/_lenia.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
LifeInATreeSystem(*, radius=4, density=0.3, initial=None, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The Game of Life on the free group F4, surjective but not pre-injective.
The free group F4 is a tree of degree 8. The memory set is the identity and the generators a, b, c, d with
their inverses, and a cell is alive after a step when the sum over the memory set is 3, or 4 with the cell alive,
Conway's rule on the Cayley graph of F4 (Ceccherini-Silberstein and Coornaert 2023, Exercise 5.14). On the tree the
automaton is surjective but not pre-injective, unlike Life on the plane, which is neither. Cells on the boundary of
the ball read 0 outside it. The system has the cells cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
int
|
The radius of the ball of F4. |
4
|
density
|
float
|
The probability that a cell starts alive, when no initial cells are given. |
0.3
|
initial
|
ArrayLike | None
|
The initial cells, one per site, or |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the random initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import LifeInATreeSystem
>>> LifeInATreeSystem(radius=2).prepare().simulate(until=1).get_values('cells.alive').shape
(2, 65)
Source code in src/skcomplex/systems/computer_science/automata/_free_group_automata.py
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | |
LifeRuleInteraction(label, *, target='cells', born=(3,), survive=(2, 3), neighborhood=MOORE)
Bases: Interaction
Life-like rule of cells, such as B3/S23 of Conway's Game of Life.
A dead cell comes to life when its number of live neighbours is one of born, and a live cell stays alive when it
is one of survive. Every other cell is dead at the next step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
born
|
Sequence[int]
|
The numbers of live neighbours that bring a dead cell to life. |
(3,)
|
survive
|
Sequence[int]
|
The numbers of live neighbours that keep a live cell alive. |
(2, 3)
|
neighborhood
|
BaseNeighborhood
|
The neighbours every cell counts, the eight cells around it by default. |
MOORE
|
Examples:
>>> from skcomplex.systems.computer_science.automata import LifeRuleInteraction
>>> LifeRuleInteraction('rule', target='cells', born=(3, 6)).born
(3, 6)
Source code in src/skcomplex/systems/computer_science/automata/_life_rule.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
LigationInteraction(label, *, target, edges=ADLEMAN_EDGES)
Bases: Interaction
Random ligation of the strands of a test tube.
It joins a strand that ends at a node to one that starts there. Every step the strands meet in random pairs. The oligo of the node that the first strand ends at and the second starts at holds their ends together, and the ligase joins them into one strand, as long as the joined path fits the longest path the tube holds. The second strand is consumed, and an edge oligo drawn uniformly from the links of the graph takes its place, since the tube holds a vast excess of oligos.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the group of strands. |
required |
edges
|
Sequence[tuple[int, int]]
|
The directed links of the graph, one edge oligo each. |
ADLEMAN_EDGES
|
Examples:
>>> from skcomplex.systems.computer_science.automata import LigationInteraction
>>> LigationInteraction('ligation', target='strands', edges=((0, 1),)).edges
((0, 1),)
Source code in src/skcomplex/systems/computer_science/automata/_dna_computation.py
115 116 117 118 119 120 121 122 123 124 | |
LinearRingAutomatonSystem(size=101, *, modulus=3, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The discrete Laplacian as a linear automaton on a ring.
It runs over the field of modulus elements.
The ring is the cyclic group of order size, a periodic lattice, and every cell becomes x(g - 1) + x(g + 1) - 2
x(g) modulo the field size, the element a^-1 + a - 2 of the group ring. From a single 1 in the middle the values
spread as binomial coefficients reduced modulo the field size, a self-similar triangle. The system has the cells
cells.value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
The order of the cyclic group, the number of cells of the ring. |
101
|
modulus
|
int
|
The prime size of the field. |
3
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import LinearRingAutomatonSystem
>>> LinearRingAutomatonSystem(11).prepare().simulate(until=1).get_values('cells.value').shape
(2, 11)
Source code in src/skcomplex/systems/computer_science/automata/_group_automata.py
633 634 635 636 637 638 639 640 641 642 643 644 | |
MajorityRuleInteraction(label, *, target='cells', neighborhood=FREE_GENERATORS)
Bases: Interaction
Majority rule of binary cells on the sites of a group.
Every cell takes the value held by more than half of itself and its neighbours, and a tie keeps its value. Only the neighbours inside the space count, so the cells on the boundary of a ball read fewer neighbours.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
neighborhood
|
BaseNeighborhood
|
The neighbours of every cell, such as the generators of the group and their inverses. |
FREE_GENERATORS
|
Examples:
>>> from skcomplex.systems.computer_science.automata import GeneratorNeighborhood, MajorityRuleInteraction
>>> rule = MajorityRuleInteraction('majority', target='cells', neighborhood=GeneratorNeighborhood(['a', 'b']))
>>> rule.neighborhood.generators
['a', 'b']
Source code in src/skcomplex/systems/computer_science/automata/_group_automata.py
125 126 127 128 | |
MorseSubshiftSystem(axiom='0', *, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The Thue-Morse substitution 0 → 01, 1 → 10.
Its words make the language of the Morse subshift. Generation n from 0 is the prefix T(0) ... T(2^n - 1) of
the Thue-Morse sequence, and the Morse subshift is the orbit closure under the shift of the configuration
x(n) = T(n) for n >= 0 and T(-n - 1) for n < 0, an infinite minimal subshift that is not sofic, with zero
entropy (Ceccherini-Silberstein and Coornaert 2023, Exercises 3.51 and 3.52). Its words of every length are the
factors of the generations, which number at most a multiple of their length. The system has the word morse and its
length morse.size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axiom
|
str
|
The word at generation 0, |
'0'
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import MorseSubshiftSystem
>>> MorseSubshiftSystem().prepare().simulate(until=3).get_values('morse.size').tolist()
[1.0, 2.0, 4.0, 8.0]
Source code in src/skcomplex/systems/computer_science/automata/_shift_spaces.py
560 561 562 563 564 565 566 567 568 569 | |
MullerAutomatonSystem(*, radius=5, modulus=2, initial=None, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Muller's automaton on the free group F2, pre-injective but not surjective.
The alphabet is A = H x H for the cyclic group H of order modulus, and every cell becomes p1(x(ga)) +
p2(x(gb)) + p1(x(ga^-1)) + p2(x(gb^-1)), where p1(h, k) = (h, 0) and p2(h, k) = (k, 0) (Ceccherini-Silberstein
and Coornaert 2023, Section 5.11). The image lies in H x {0}, so the automaton is not surjective, yet two
configurations that differ on a finite set have different images, so it is pre-injective, which the Garden of Eden
theorem forbids on amenable groups. For a prime modulus it is the linear automaton over K^2 of Section 8.10. Cells
on the boundary of the ball read 0 outside it. The system has the coordinates cells.first and cells.second.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
int
|
The radius of the ball of F2. |
5
|
modulus
|
int
|
The order of |
2
|
initial
|
ArrayLike | None
|
The initial pairs, an array of shape |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the random initial pairs. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ParameterError
|
The modulus is below 2. |
Examples:
>>> from skcomplex.systems.computer_science.automata import MullerAutomatonSystem
>>> MullerAutomatonSystem(radius=2).prepare().simulate(until=1).get_values('cells.first').shape
(2, 17)
Source code in src/skcomplex/systems/computer_science/automata/_free_group_automata.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
MullerRuleInteraction(label, *, target='cells', modulus=2)
Bases: Interaction
Muller's rule on pairs, p1(x(ga)) + p2(x(gb)) + p1(x(ga^-1)) + p2(x(gb^-1)).
The projections are p1(h, k) = (h, 0) and p2(h, k) = (k, 0), and the sum is taken modulo the order of the
cyclic group, so every image lies in H x {0}.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells on the free group, whose states |
'cells'
|
modulus
|
int
|
The order |
2
|
Examples:
>>> from skcomplex.systems.computer_science.automata import MullerRuleInteraction
>>> MullerRuleInteraction('rule', target='cells', modulus=3).modulus
3
Source code in src/skcomplex/systems/computer_science/automata/_free_group_automata.py
97 98 99 100 | |
NetworkLifeInteraction(label, *, target='cells')
Bases: Interaction
Rules of Conway's Game of Life on the nodes of a network.
A dead cell with three live neighbours comes to life, a live cell with two or three live neighbours survives, and every other cell is dead at the next step. The neighbours are those of the node on the network.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import NetworkLifeInteraction
>>> NetworkLifeInteraction('life', target='cells').target
'cells'
Source code in src/skcomplex/systems/computer_science/automata/_small_world_life.py
55 56 57 | |
NilpotentAutomatonSystem(n=4, *, size=80, density=0.7, initial=None, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A binary automaton on a ring that is nilpotent of class n.
Every configuration reaches 0 in n steps. The memory set is {-1, 0, ..., n - 1}, and a cell becomes 0 when the
whole window holds ones or when it is the left end of a run of ones, p(-1) = 0 and p(0) = 1, and keeps its value
otherwise (Ceccherini-Silberstein and Coornaert 2023, Exercise 1.15). After one step every run of ones is shorter
than n, and every further step removes the left end of each run, so n steps reach 0 and the run of n + 1 ones
needs all of them. The exercise prints the memory set {-1, ..., n - 2}, whose class is n - 1, while its solution
relies on {-1, ..., n - 1}, which this system takes. The system has the cells cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
The nilpotency class, at least 2. |
4
|
size
|
int
|
The number of cells of the ring. |
80
|
density
|
float
|
The probability that a cell starts at 1, when no initial cells are given. |
0.7
|
initial
|
ArrayLike | None
|
The initial cells, or |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the random initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ParameterError
|
The class is below 2. |
Examples:
>>> from skcomplex.systems.computer_science.automata import NilpotentAutomatonSystem
>>> trajectory = NilpotentAutomatonSystem(3, size=12, density=1.0).prepare().simulate(until=3)
>>> trajectory.get_values('cells.alive').sum(axis=1).tolist()
[12, 0, 0, 0]
Source code in src/skcomplex/systems/computer_science/automata/_line_automata.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
NilpotentRuleInteraction(label, *, target='cells', n=4)
Bases: Interaction
Rule of a binary line that reaches 0 from every configuration in n steps.
Every cell reads the window of offsets -1, 0, ..., n - 1. It becomes 0 when the whole window holds ones or when
it is the left end of a run of ones, and keeps its value otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
n
|
int
|
The nilpotency class. |
4
|
Examples:
>>> from skcomplex.systems.computer_science.automata import NilpotentRuleInteraction
>>> NilpotentRuleInteraction('rule', target='cells', n=3).n
3
Source code in src/skcomplex/systems/computer_science/automata/_line_automata.py
52 53 54 55 | |
NoisyAutomataSystem(rule=18, *, noise=0.01, size=101, density=0.5, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
An elementary cellular automaton whose outputs are flipped at random.
The outputs are flipped with a small probability. The system has the cells cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rule
|
int
|
The Wolfram number from 0 to 255. |
18
|
noise
|
float
|
The probability that a cell's output is flipped in a step. |
0.01
|
size
|
int
|
The number of cells of the ring. |
101
|
density
|
float
|
The probability that a cell starts alive. |
0.5
|
random_state
|
int | Generator | None
|
The seed or generator of the random initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import NoisyAutomataSystem
>>> NoisyAutomataSystem(184, size=11).prepare().simulate(until=3).get_values('cells.alive').shape
(4, 11)
Source code in src/skcomplex/systems/computer_science/automata/_variants.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | |
NoisyRuleInteraction(label, *, target='cells', rule=18, noise=0.01)
Bases: Interaction
Elementary rule of a line of cells whose outputs are flipped at random.
Every cell takes the output of the elementary rule of its Wolfram number, and a uniform draw below noise flips
it. Without noise it is the elementary automaton, and at noise 1/2 every cell is a fair coin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
rule
|
int
|
The Wolfram number from 0 to 255. |
18
|
noise
|
float
|
The probability that the output of a cell is flipped in a step. |
0.01
|
Examples:
>>> from skcomplex.systems.computer_science.automata import NoisyRuleInteraction
>>> NoisyRuleInteraction('rule', target='cells', noise=0.1).noise
0.1
Source code in src/skcomplex/systems/computer_science/automata/_variants.py
99 100 101 102 103 | |
PairCellElement(label, *, first=0, second=0, space=None)
Bases: Element
Cell of an automaton over the product H x H of the integers modulo n.
For a prime n the product is K^2. With space, the element holds one cell on every site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cells. |
required |
first
|
Annotated[float | Array, ZZ]
|
The initial first coordinate, an integer from 0 to |
0
|
second
|
Annotated[float | Array, ZZ]
|
The initial second coordinate, an integer from 0 to |
0
|
space
|
BaseSpace | None
|
The space with one cell on every site, such as a group, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import PairCellElement
>>> PairCellElement('cell', first=1).first
1
Source code in src/skcomplex/systems/computer_science/automata/_free_group_automata.py
62 63 64 65 66 67 68 69 70 71 72 | |
ParityRuleInteraction(label, *, target='cells', neighborhood=LAMPLIGHTER_MEMORY)
Bases: Interaction
Parity rule of binary cells, the sum modulo 2 of a cell and its neighbours.
It is a linear rule over the field of two elements, so a sum of configurations maps to the sum of their images.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
neighborhood
|
MemoryNeighborhood
|
The cell and its neighbours, such as a memory set of a group. |
LAMPLIGHTER_MEMORY
|
Examples:
>>> from skcomplex.systems.computer_science.automata import ParityRuleInteraction
>>> from skcomplex.systems.computer_science.common.automata import MemoryNeighborhood
>>> memory = MemoryNeighborhood(('1', 'a', 'b'))
>>> ParityRuleInteraction('parity', target='cells', neighborhood=memory).neighborhood.elements
('1', 'a', 'b')
Source code in src/skcomplex/systems/computer_science/automata/_group_automata.py
174 175 176 177 178 179 180 181 182 183 | |
PascalCellElement(label, *, value=0, space=None)
Bases: Element
Cell of an automaton over the nonnegative integers.
With space, the element holds one cell on every site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cells. |
required |
value
|
Annotated[float | Array, NN]
|
The initial value, a nonnegative integer, or one value per cell. |
0
|
space
|
BaseSpace | None
|
The space with one cell on every site, such as a lattice, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import PascalCellElement
>>> PascalCellElement('cell', value=3).value
3
Source code in src/skcomplex/systems/computer_science/automata/_pascal_cell.py
36 37 38 39 40 41 42 43 44 | |
PowerSeriesAutomatonSystem(size=31, *, order=8, field='QQ', initial=None, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The automaton τ(x)(n) = x(n) - t x(n + 1) over the power series K[[t]].
The power series are formal, on a ring. The alphabet K[[t]] has infinite dimension, and the automaton is bijective
with the inverse sigma(y)(n) = sum_j t^j y(n + j), which is not continuous, so it is no cellular automaton
(Ceccherini-Silberstein and Coornaert 2023, Exercise 1.37). The cells hold the series truncated at the order, which
keeps every coefficient below it exact, since the coefficient of t^i of the image reads coefficients of t^i and
t^(i - 1) alone. From the constant series 1 at one cell, the cells at step s hold C(s, k) (-t)^k at the k-th
cell to the left, as long as k stays below the order. The system has the coefficients cells.value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
The number of cells of the ring. |
31
|
order
|
int
|
The number of coefficients kept. |
8
|
field
|
str
|
The field |
'QQ'
|
initial
|
ArrayLike | None
|
The initial coefficients, an array of shape |
None
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import PowerSeriesAutomatonSystem
>>> PowerSeriesAutomatonSystem(5, order=3).prepare().system_.elements[0].value.shape
(5, 3)
Source code in src/skcomplex/systems/computer_science/automata/_alphabets.py
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
PowerSeriesCellElement(label, *, ring=RATIONAL_SERIES, value=0.0, space=None)
Bases: Element
Cell of an automaton over a ring K[[t]] of truncated formal power series.
The series are truncated at an order. The cell holds the value value in the ring it is given, the coefficients
a_0, ..., a_{order - 1} of a series, which a local rule reads as one row per cell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cell or the cells. |
required |
ring
|
PowerSeriesSpec
|
The truncated power series ring of the values. |
RATIONAL_SERIES
|
value
|
ArrayLike
|
The coefficients of the series, one row per cell, or a number for every coefficient. |
0.0
|
space
|
BaseSpace | None
|
The space with one cell on every site, such as a lattice, or |
None
|
Examples:
>>> from skcomplex.core.components import PowerSeriesSpec
>>> from skcomplex.systems.computer_science.automata import PowerSeriesCellElement
>>> PowerSeriesCellElement('cell', ring=PowerSeriesSpec(3)).ring.order
3
Source code in src/skcomplex/systems/computer_science/automata/_alphabets.py
98 99 100 101 102 103 104 105 106 107 108 | |
PowerSeriesDifferenceInteraction(label, *, target='cells', ring=RATIONAL_SERIES)
Bases: Interaction
Difference τ(x)(n) = x(n) - t x(n + 1) of cells holding truncated power series.
The coefficients of every series sit on the last axis of the state value, and the product with t shifts them
by one place in the ring.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
ring
|
PowerSeriesSpec
|
The truncated power series ring of the values. |
RATIONAL_SERIES
|
Examples:
>>> from skcomplex.core.components import PowerSeriesSpec
>>> from skcomplex.systems.computer_science.automata import PowerSeriesDifferenceInteraction
>>> PowerSeriesDifferenceInteraction('difference', target='cells', ring=PowerSeriesSpec(3)).ring.order
3
Source code in src/skcomplex/systems/computer_science/automata/_alphabets.py
215 216 217 218 | |
QuadraticRuleInteraction(label, *, target='cells')
Bases: Interaction
Rule τ(x)(n) = x(n + 1) - x(n)^2 of cells holding real numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import QuadraticRuleInteraction
>>> QuadraticRuleInteraction('quadratic', target='cells').target
'cells'
Source code in src/skcomplex/systems/computer_science/automata/_alphabets.py
297 298 299 | |
RealCellElement(label, *, value=0.0, space=None)
Bases: Element
Cell of an automaton over the real numbers.
With space, the element holds one cell on every site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cells. |
required |
value
|
Annotated[float | Array, RR]
|
The initial value, or one value per cell. |
0.0
|
space
|
BaseSpace | None
|
The space with one cell on every site, such as a lattice, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import RealCellElement
>>> RealCellElement('cell', value=0.5).value
0.5
Source code in src/skcomplex/systems/computer_science/automata/_alphabets.py
139 140 141 142 143 144 145 146 147 | |
RealQuadraticAutomatonSystem(size=64, *, amplitude=0.25, initial=None, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The automaton τ(x)(n) = x(n + 1) - x(n)^2 over the reals on a ring.
It is pre-injective but not injective, since the constant configurations 0 and 1 both map to 0, and its image is
dense but neither closed nor everything (Ceccherini-Silberstein and Coornaert 2023, Exercise 5.64). The square pulls
the cells down at every step, and cells far from the origin run off to minus infinity. The system has the cells
cells.value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
The number of cells of the ring. |
64
|
amplitude
|
float
|
The half width of the uniform initial values. |
0.25
|
initial
|
ArrayLike | None
|
The initial values, or |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the random initial values. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import RealQuadraticAutomatonSystem
>>> RealQuadraticAutomatonSystem(8).prepare().simulate(until=1).get_values('cells.value').shape
(2, 8)
Source code in src/skcomplex/systems/computer_science/automata/_alphabets.py
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | |
SelfIndexedShiftInteraction(label, *, target='cells')
Bases: Interaction
Map τ(x)(g) = x(g · x(g)) of cells whose values are elements of the group of their sites.
Every cell takes the value of the cell at the product of its site and its own value, so the cell it reads moves with the configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells on a group space, whose state |
'cells'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import SelfIndexedShiftInteraction
>>> SelfIndexedShiftInteraction('translation', target='cells').target
'cells'
Source code in src/skcomplex/systems/computer_science/automata/_alphabets.py
169 170 171 | |
SelfIndexedShiftSystem(group=None, *, radius=4, initial=None, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The map τ(x)(g) = x(g · x(g)) over the group as alphabet.
It is continuous and equivariant but no automaton. Every cell holds a group element, the number of its site, and
takes the value of the cell at the product of its site and its value, so the cell it reads moves with the
configuration. On an infinite group no finite memory set describes the map, which is continuous and commutes with
the shifts but is no cellular automaton (Ceccherini-Silberstein and Coornaert 2023, Example 1.8.2). The simulation
truncates the group: on a ball, a product outside it reads -1, a value that names no element and stays, and a
finite group, without a radius, keeps every product. The system has the group elements cells.value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
group
|
object | None
|
The group, a Sage or GAP group, or |
None
|
radius
|
int | None
|
The radius of the ball, or |
4
|
initial
|
ArrayLike | None
|
The numbers of the initial elements, one per site, or |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the random initial elements, drawn uniformly among the sites. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import SelfIndexedShiftSystem
>>> SelfIndexedShiftSystem(radius=2).prepare().simulate(until=1).get_values('cells.value').shape
(2, 17)
Source code in src/skcomplex/systems/computer_science/automata/_alphabets.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |
SmallWorldLifeSystem(shape=(50, 50), *, p=0.0, density=0.3, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Conway's Game of Life on a small-world network.
The network is rewired from the Moore lattice of a torus.
Every cell is a node linked to its eight Moore neighbours. The rewiring cuts two random links and joins the four
loose ends the other way, which keeps every node at eight neighbours, and repeats it p times half the number of
links, so a fraction of about p of the links becomes shortcuts across the torus. The rules of life are the same on
the network: a dead cell with three live neighbours comes to life, and a live cell with two or three survives. For
p = 0 the network is the lattice and the automaton is the Game of Life, and the shortcuts change the density of
live cells it settles at, which serves as an order parameter of the rewiring. The system has the cells
cells.alive, one per node in row-major order of the torus. Its standard observable density is the fraction of
live cells.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
Sequence[int]
|
The number of rows and columns of the torus. |
(50, 50)
|
p
|
float
|
The rewiring probability, the fraction of the links rewired. |
0.0
|
density
|
float
|
The probability that a cell starts alive. |
0.3
|
random_state
|
int | Generator | None
|
The seed or generator of the rewiring and of the initial cells. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ParameterError
|
The rewiring probability is outside |
Examples:
>>> from skcomplex.systems.computer_science.automata import SmallWorldLifeSystem
>>> graph = SmallWorldLifeSystem((10, 10), p=0.2).prepare().system_.elements[0].space.graph
>>> sorted({degree for _, degree in graph.degree()})
[8]
Source code in src/skcomplex/systems/computer_science/automata/_small_world_life.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
StrandElement(label, *, path=EMPTY, size=None)
Bases: Element
Strand of DNA in the test tube.
It holds the path of nodes its ligated edge oligos spell, padded with -1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the strand or the group. |
required |
path
|
object
|
The initial nodes of the path, padded with -1 to the longest path the tube holds, one row per strand. |
EMPTY
|
size
|
int | None
|
The number of strands, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import StrandElement
>>> StrandElement('strand', path=(0, 1, -1)).path
(0, 1, -1)
Source code in src/skcomplex/systems/computer_science/automata/_dna_computation.py
75 76 77 78 79 80 81 82 83 | |
SubshiftsSystem(size=200, *, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A Markov chain on the golden mean shift.
The shift holds the configurations of a ring that never hold two adjacent ones.
The ring is the cyclic group of order size, a periodic lattice. It starts empty, and every step proposes to flip
every cell in a random order, rejecting the flips that would put two ones side by side. The chain samples the
admissible configurations, whose number grows as the power of the golden ratio. The system has the cells
cells.alive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
The number of cells of the ring, the order of the cyclic group. |
200
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import SubshiftsSystem
>>> SubshiftsSystem(10).prepare().simulate(until=1).get_values('cells.alive').shape
(2, 10)
Source code in src/skcomplex/systems/computer_science/automata/_group_automata.py
694 695 696 697 698 699 700 701 702 703 | |
SubtractionAutomatonSystem(size=41, *, height=10, initial=None, label='system', solver='auto', backend='auto')
Bases: BaseSystem
The automaton τ(x)(n) = max(0, x(n) - x(n + 1)) over the naturals.
Its image is not closed. The image of the configurations x_M, equal to M left of the origin and to
max(0, M - n) from it, is the block of M ones from the origin. These blocks converge to the configuration of
ones on the half line, which is no image, so the image of the automaton over the infinite alphabet N is not closed
(Ceccherini-Silberstein and Coornaert 2023, Example 3.3.3). The cells sit on a segment with fixed ends that read 0,
and start at x_M with M = height, its origin a quarter of the way along. The system has the cells cells.value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
The number of cells. |
41
|
height
|
int
|
The value |
10
|
initial
|
ArrayLike | None
|
The initial values, or |
None
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ParameterError
|
The height is negative. |
Examples:
>>> from skcomplex.systems.computer_science.automata import SubtractionAutomatonSystem
>>> SubtractionAutomatonSystem(12, height=3).prepare().system_.elements[0].value.tolist()
[3.0, 3.0, 3.0, 3.0, 2.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
Source code in src/skcomplex/systems/computer_science/automata/_alphabets.py
570 571 572 573 574 575 576 577 578 579 580 581 582 583 | |
SubtractionRuleInteraction(label, *, target='cells')
Bases: Interaction
Truncated difference τ(x)(n) = max(0, x(n) - x(n + 1)) of cells holding natural numbers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells whose state |
'cells'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import SubtractionRuleInteraction
>>> SubtractionRuleInteraction('subtraction', target='cells').target
'cells'
Source code in src/skcomplex/systems/computer_science/automata/_alphabets.py
260 261 262 | |
SurjectiveLinearAutomatonSystem(*, radius=5, modulus=2, initial=None, random_state=0, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A linear automaton over K^2 on the free group F2.
It is surjective but not pre-injective. Every cell becomes q1(x(ga)) + q1(x(ga^-1)) + q2(x(gb)) + q2(x(gb^-1)),
where q1(h, k) = (h, 0) and q2(h, k) = (0, h), over the field of a prime number modulus of elements
(Ceccherini-Silberstein and Coornaert 2023, Section 8.11). The configuration (0, 1) at the identity and 0
elsewhere maps to 0, so the automaton is not pre-injective, while a preimage of every configuration is built by
induction on the word length, so it is surjective, which the Garden of Eden theorem forbids on amenable groups.
Cells on the boundary of the ball read 0 outside it. The system has the coordinates cells.first and
cells.second.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
int
|
The radius of the ball of F2. |
5
|
modulus
|
int
|
The prime size of the field |
2
|
initial
|
ArrayLike | None
|
The initial pairs, an array of shape |
None
|
random_state
|
int | Generator | None
|
The seed or generator of the random initial pairs. |
0
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ParameterError
|
The modulus is below 2. |
Examples:
>>> from skcomplex.systems.computer_science.automata import SurjectiveLinearAutomatonSystem
>>> SurjectiveLinearAutomatonSystem(radius=2).prepare().simulate(until=1).get_values('cells.first').shape
(2, 17)
Source code in src/skcomplex/systems/computer_science/automata/_free_group_automata.py
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | |
SurjectiveLinearRuleInteraction(label, *, target='cells', modulus=2)
Bases: Interaction
Linear rule on pairs, q1(x(ga)) + q1(x(ga^-1)) + q2(x(gb)) + q2(x(gb^-1)).
The maps are q1(h, k) = (h, 0) and q2(h, k) = (0, h), over the field of a prime number of elements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells on the free group, whose states |
'cells'
|
modulus
|
int
|
The prime size of the field |
2
|
Examples:
>>> from skcomplex.systems.computer_science.automata import SurjectiveLinearRuleInteraction
>>> SurjectiveLinearRuleInteraction('rule', target='cells', modulus=3).modulus
3
Source code in src/skcomplex/systems/computer_science/automata/_free_group_automata.py
148 149 150 151 | |
TapeCellElement(label, *, symbol=0, head=-1, space=None)
Bases: Element
Cell of the tape of a Turing machine.
It holds a symbol, and the internal state of the head on it or -1. A TuringMachineInteraction lets the head on a
cell write the symbol of its action table, move one cell left or right, or stay, and take its next internal state.
A halted head keeps its cell and the tape stays unchanged. With space, the element holds one cell on every site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cells. |
required |
symbol
|
Annotated[float | Array, NN]
|
The initial symbol, or one symbol per cell. |
0
|
head
|
Annotated[float | Array, ZZ]
|
The internal state of the head on the cell, from 0, or -1 for no head, or one value per cell. |
-1
|
space
|
BaseSpace | None
|
The space with one cell on every site, such as a lattice, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import TapeCellElement
>>> TapeCellElement('cell').head
-1
Source code in src/skcomplex/systems/computer_science/automata/_turing_machine.py
66 67 68 69 70 71 72 73 74 75 76 | |
TernaryCellElement(label, *, symbol=0, space=None)
Bases: Element
Cell of a subshift over the alphabet {0, 1, 2}.
An example is the context-free subshift. With space, the element holds one cell on every site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cells. |
required |
symbol
|
Annotated[float | Array, {0, 1, 2}]
|
The initial symbol, 0, 1, or 2, or one symbol per cell. |
0
|
space
|
BaseSpace | None
|
The space with one cell on every site, such as a lattice, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import TernaryCellElement
>>> TernaryCellElement('cell', symbol=2).symbol
2
Source code in src/skcomplex/systems/computer_science/automata/_shift_spaces.py
93 94 95 96 97 98 99 100 101 | |
TuringMachineInteraction(label, *, target='tape', table=None)
Bases: Interaction
Head of a Turing machine that reads, writes, and moves on the cells of a tape.
The action table maps the internal state of the head and the symbol under it to the symbol it writes, its move
'L', 'R', or 'N', and its next internal state, 'H' to halt. Every step is a local rule on three cells: the
cell under the head takes the written symbol, and a cell takes the head that moves onto it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The cells of the tape, whose states |
'tape'
|
table
|
Mapping[tuple[str, int], tuple[int, str, str]] | None
|
The action table, or |
None
|
Examples:
>>> from skcomplex.systems.computer_science.automata import TuringMachineInteraction
>>> TuringMachineInteraction('machine', target='tape').table is None
True
Source code in src/skcomplex/systems/computer_science/automata/_turing_machine.py
102 103 104 105 106 107 108 109 110 111 | |
TuringMachineSystem(size=21, *, table=None, start='A', label='system', solver='auto', backend='auto')
Bases: BaseSystem
A Turing machine, a head that reads, writes, and moves on a tape of symbols.
The head has an internal state.
The action table maps the internal state of the head and the symbol under it to the symbol it writes, its move
'L', 'R', or 'N', and its next internal state, 'H' to halt. Every step is a local rule on the cells of a
ring of tape: the cell under the head takes the written symbol, and a cell takes the head that moves onto it. The
default table is the busy beaver of three states and two symbols, which writes the most ones a halting machine of
its size can write on a blank tape: it halts after 13 steps with six ones on the tape. The system has the symbols
tape.symbol and the head tape.head, which holds the index of the internal state of the head, in the sorted order
of the states of the table, on its cell, that index plus one when the head has halted, and -1 elsewhere.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
The number of cells of the ring of tape, large enough that the head never wraps around. |
21
|
table
|
Mapping[tuple[str, int], tuple[int, str, str]] | None
|
The action table, or |
None
|
start
|
str
|
The internal state of the head at the start, on the middle cell of a blank tape. |
'A'
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Raises:
| Type | Description |
|---|---|
ParameterError
|
The start is not a state of the table, or a move is not |
Examples:
>>> from skcomplex.systems.computer_science.automata import TuringMachineSystem
>>> int(TuringMachineSystem(11).prepare().system_.elements[0].head[5])
0
Source code in src/skcomplex/systems/computer_science/automata/_turing_machine.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
UnboundedAlphabetAutomatonSystem(size=101, *, label='system', solver='auto', backend='auto')
Bases: BaseSystem
An additive automaton over the nonnegative integers, x'(n) = x(n - 1) + x(n).
It starts from a single 1.
Its alphabet has no bound: from a single 1 the cells after t steps hold the binomial coefficients C(t, k), so
every row of Pascal's triangle appears. Reduced modulo 2, the rule is the mirror image of the additive automaton
x(n) + x(n + 1) of Ceccherini-Silberstein and Coornaert (2023, Example 3.3.8), which this system lifts to the
nonnegative integers. The system has the cells cells.value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
The number of cells of the ring. |
101
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.computer_science.automata import UnboundedAlphabetAutomatonSystem
>>> int(UnboundedAlphabetAutomatonSystem(9).prepare().system_.elements[0].value.sum())
1
Source code in src/skcomplex/systems/computer_science/automata/_variants.py
486 487 488 489 490 491 492 493 494 495 | |
Wolfram(number)
dataclass
Elementary cellular automaton by its Wolfram number.
The rule reads the left, centre, and right cells. A local rule takes it as its rule and reads it through table().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
int
|
The rule number from 0 to 255. |
required |
Examples:
>>> from skcomplex.systems.computer_science.automata import Wolfram
>>> Wolfram(30).get_table().mapping[(1, 0, 0)]
1
get_table()
Return the rule as a table of the eight patterns.
Returns:
| Name | Type | Description |
|---|---|---|
table |
TableSpec
|
The table. |
Raises:
| Type | Description |
|---|---|
ValueError
|
The number is outside 0 to 255. |
Source code in src/skcomplex/systems/computer_science/automata/_codes.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
baumslag_solitar(m=1, n=2)
Return the Baumslag-Solitar group BS(m, n) = <a, t | t a^m t^-1 = a^n>.
Its balls are built from a confluent rewriting system, which Knuth-Bendix completion finds for BS(1, n).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m
|
int
|
The exponent of |
1
|
n
|
int
|
The exponent it is conjugated to. |
2
|
Returns:
| Name | Type | Description |
|---|---|---|
group |
GapElement
|
The finitely presented GAP group. |
Examples:
>>> from skcomplex.systems.computer_science.automata import baumslag_solitar
>>> from skcomplex.systems.computer_science.common.automata import CayleySpace
>>> CayleySpace(baumslag_solitar(), ball=1).prepare().generators_
('a', 't')
Source code in src/skcomplex/systems/computer_science/automata/_groups.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
free_group(rank=2)
Return the free group of a rank, generated by a, b, and so on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rank
|
int
|
The number of generators, from 1 to 26. |
2
|
Returns:
| Name | Type | Description |
|---|---|---|
group |
GapElement
|
The free group, a GAP group. |
Raises:
| Type | Description |
|---|---|
ValidationError
|
The rank is not between 1 and 26. |
Examples:
>>> from skcomplex.systems.computer_science.automata import free_group
>>> from skcomplex.systems.computer_science.common.automata import CayleySpace
>>> CayleySpace(free_group(3), ball=1).prepare().generators_
('a', 'b', 'c')
Source code in src/skcomplex/systems/computer_science/automata/_groups.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
grigorchuk_group()
Return the Grigorchuk group as an automaton group.
It has intermediate growth, and it is the automaton group of its action on the binary tree. The generators act by
the wreath recursion a = (1, 1)(0 1), b = (a, c), c = (a, d), d = (1, b). The group is amenable, not
finitely presented, and its balls grow faster than any polynomial and slower than any exponential.
Returns:
| Name | Type | Description |
|---|---|---|
group |
GapElement
|
The GAP automaton group of the AutomGrp package. |
Examples:
>>> from skcomplex.systems.computer_science.automata import grigorchuk_group
>>> from skcomplex.systems.computer_science.common.automata import CayleySpace
>>> CayleySpace(grigorchuk_group(), ball=1).prepare().generators_
('a', 'b', 'c', 'd')
Source code in src/skcomplex/systems/computer_science/automata/_groups.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
heisenberg()
Return the discrete Heisenberg group of upper unitriangular integer matrices.
It is generated by a and b. Its commutator a b a^-1 b^-1 is central, and its balls grow as the fourth power of
the radius.
Returns:
| Name | Type | Description |
|---|---|---|
group |
FinitelyGeneratedMatrixGroup_generic
|
The Sage matrix group over the integers. |
Examples:
>>> from skcomplex.systems.computer_science.automata import heisenberg
>>> from skcomplex.systems.computer_science.common.automata import CayleySpace
>>> CayleySpace(heisenberg(), ball=1).prepare().generators_
('a', 'b')
Source code in src/skcomplex/systems/computer_science/automata/_groups.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
lamplighter()
Return the lamplighter group as automaton group.
It is the wreath product of the group of order 2 with the integers. The automaton a = (a, b)(0 1), b = (a, b) of
Grigorchuk and Zuk generates it, and its Cayley graph is the Diestel-Leader graph.
Returns:
| Name | Type | Description |
|---|---|---|
group |
GapElement
|
The GAP automaton group of the AutomGrp package. |
Examples:
>>> from skcomplex.systems.computer_science.automata import lamplighter
>>> from skcomplex.systems.computer_science.common.automata import CayleySpace
>>> CayleySpace(lamplighter(), ball=1).prepare().generators_
('a', 'b')
Source code in src/skcomplex/systems/computer_science/automata/_groups.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
life(born=(3,), survive=(2, 3))
Return a life-like rule in the notation B3/S23 of Conway's Game of Life.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
born
|
Iterable[int]
|
The numbers of live neighbours that bring a dead cell to life. |
(3,)
|
survive
|
Iterable[int]
|
The numbers of live neighbours that keep a live cell alive. |
(2, 3)
|
Returns:
| Name | Type | Description |
|---|---|---|
rule |
OuterTotalisticSpec
|
The outer totalistic rule. |
Examples:
>>> from skcomplex.systems.computer_science.automata import life
>>> rule = life()
>>> rule.rule[(0, 3)], rule.rule[(1, 2)], (1, 4) in rule.rule
(1, 1, False)
Source code in src/skcomplex/systems/computer_science/automata/_codes.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |