Graftal Lace Cellular Automata#

AUTHORS:

  • Travis Scrimshaw (2020-04-30): Initial version

class sage.dynamics.cellular_automata.glca.GraftalLaceCellularAutomata(rule)[source]#

Bases: SageObject

Graftal Lace Cellular Automata (GLCA).

A GLCA is a deterministic cellular automaton whose rule is given by an 8-digit octal number \(r_7 \cdots r_0\). For a node \(s_i\), let \(b_k\), for \(k = -1,0,1\) denote if there is an edge from \(s_i\) to \(s'_{i+k}\), where \(s'_j\) is the previous row. We determine the value at \(t_{i+k}\) by considering the value of \(r_m\), where the binary representation of \(m\) is \(b_{-1} b_0 b_1\). If \(r_m\) has a binary representation of b’_1 b’_0 b’_{-1}`, then we add \(b'_k\) to \(t_{i+k}\).

INPUT:

  • rule – a list of length 8 with integer entries \(0 \leq x < 8\)

EXAMPLES:

sage: G = cellular_automata.GraftalLace([0,2,5,4,7,2,3,3])
sage: G.evolve(3)
sage: ascii_art(G)
       o
       |
       o
       |
     o o o
    /| |/|
   o o o o o
  /| |/|\|/|
 o o o o o o o

sage: G = cellular_automata.GraftalLace([3,0,3,4,7,6,3,1])
sage: G.evolve(3)
sage: ascii_art(G)
       o
       |
       o
       |\
     o o o
    /  |\ \
   o o o o o
  /|/  |\ \ \
 o o o o o o o

sage: G = cellular_automata.GraftalLace([2,0,3,3,6,0,2,7])
sage: G.evolve(20)
sage: G.plot()                                                                  # needs sage.plot
Graphics object consisting of 842 graphics primitives
>>> from sage.all import *
>>> G = cellular_automata.GraftalLace([Integer(0),Integer(2),Integer(5),Integer(4),Integer(7),Integer(2),Integer(3),Integer(3)])
>>> G.evolve(Integer(3))
>>> ascii_art(G)
       o
       |
       o
       |
     o o o
    /| |/|
   o o o o o
  /| |/|\|/|
 o o o o o o o

>>> G = cellular_automata.GraftalLace([Integer(3),Integer(0),Integer(3),Integer(4),Integer(7),Integer(6),Integer(3),Integer(1)])
>>> G.evolve(Integer(3))
>>> ascii_art(G)
       o
       |
       o
       |\
     o o o
    /  |\ \
   o o o o o
  /|/  |\ \ \
 o o o o o o o

>>> G = cellular_automata.GraftalLace([Integer(2),Integer(0),Integer(3),Integer(3),Integer(6),Integer(0),Integer(2),Integer(7)])
>>> G.evolve(Integer(20))
>>> G.plot()                                                                  # needs sage.plot
Graphics object consisting of 842 graphics primitives
../../../_images/glca-1.svg

REFERENCES:

evolve(number=None)[source]#

Evolve self.

INPUT:

  • number – (default: 1) the number of times to perform the evolution

EXAMPLES:

sage: G = cellular_automata.GraftalLace([5,1,2,5,4,5,5,0])
sage: ascii_art(G)
 o
 |
 o
sage: G.evolve(2)
sage: ascii_art(G)
     o
     |
     o
    / \
   o o o
  / \ / \
 o o o o o

sage: G = cellular_automata.GraftalLace([0,2,1,4,7,2,3,0])
sage: G.evolve(3)
sage: ascii_art(G)
       o
       |
       o
       |
     o o o
       |
   o o o o o
       |
 o o o o o o o
>>> from sage.all import *
>>> G = cellular_automata.GraftalLace([Integer(5),Integer(1),Integer(2),Integer(5),Integer(4),Integer(5),Integer(5),Integer(0)])
>>> ascii_art(G)
 o
 |
 o
>>> G.evolve(Integer(2))
>>> ascii_art(G)
     o
     |
     o
    / \
   o o o
  / \ / \
 o o o o o

>>> G = cellular_automata.GraftalLace([Integer(0),Integer(2),Integer(1),Integer(4),Integer(7),Integer(2),Integer(3),Integer(0)])
>>> G.evolve(Integer(3))
>>> ascii_art(G)
       o
       |
       o
       |
     o o o
       |
   o o o o o
       |
 o o o o o o o
plot(number=None)[source]#

Return a plot of self.

INPUT:

  • number – the number of states to plot

EXAMPLES:

sage: G = cellular_automata.GraftalLace([5,1,2,5,4,5,5,0])
sage: G.evolve(20)
sage: G.plot()                                                              # needs sage.plot
Graphics object consisting of 865 graphics primitives
>>> from sage.all import *
>>> G = cellular_automata.GraftalLace([Integer(5),Integer(1),Integer(2),Integer(5),Integer(4),Integer(5),Integer(5),Integer(0)])
>>> G.evolve(Integer(20))
>>> G.plot()                                                              # needs sage.plot
Graphics object consisting of 865 graphics primitives
print_states(number=None, use_unicode=False)[source]#

Print the first num states of self.

Note

If the number of states computed for self is less than num, then this evolves the system using the default time evolution.

INPUT:

  • number – the number of states to print

EXAMPLES:

sage: G = cellular_automata.GraftalLace([5,1,2,5,4,5,5,0])
sage: G.evolve(2)
sage: G.print_states()
     o
     |
     o
    / \
   o o o
  / \ / \
 o o o o o
sage: G.evolve(20)
sage: G.print_states(3)
     o
     |
     o
    / \
   o o o
  / \ / \
 o o o o o
>>> from sage.all import *
>>> G = cellular_automata.GraftalLace([Integer(5),Integer(1),Integer(2),Integer(5),Integer(4),Integer(5),Integer(5),Integer(0)])
>>> G.evolve(Integer(2))
>>> G.print_states()
     o
     |
     o
    / \
   o o o
  / \ / \
 o o o o o
>>> G.evolve(Integer(20))
>>> G.print_states(Integer(3))
     o
     |
     o
    / \
   o o o
  / \ / \
 o o o o o