Cellular Automata, L-Systems, Fractals, Chaos and Complex Systems

overwhelmedblueearthAI and Robotics

Dec 1, 2013 (4 years and 5 months ago)


Cellular Automata, L-Systems,
Fractals, Chaos and Complex

Online tutorial for CAs:

Online tutorial for Chaos: http://www.viewsfromscience.com/documents/webpages/

Books: The Algorithmic Beauty of Plants, The Fractal Geometry of Nature
Evolving L-systems to generate virtual creatures

Also see original papers from my teaching webpage.
Cellular Automata

Cellular automata (CA) were originally conceived by Ulam and von
Neumann in the 1940s to provide a formal framework for investigating
the behaviour of complex, extended systems.

CAs are dynamical systems in which space and time are discrete.

A cellular automaton consists of a regular grid of cells, each of which
can be in one of a finite number of k possible states, updated
synchronously in discrete time steps according to a local, identical
interaction rule.

The state of a cell is determined by the previous states of a
surrounding neighbourhood of cells.

The cellular array (grid) is n-dimensional, where n=1,2,3 is used in

Cellular Automata

The identical rule contained in each cell is essentially a finite state
machine, usually specified in the form of a rule table (also known as
the transition function), with an entry for every possible neighbourhood
configuration of states.

The neighbourhood of a cell consists of the surrounding (adjacent)

For one-dimensional CAs, a cell is connected to r local neighbours
(cells) on either side, where r is a parameter referred to as the radius
(thus, each cell has 2r+1 neighbours, including itself).

For two-dimensional CAs, two types of cellular neighbourhoods are
usually considered: 5 cells, consisting of the cell along with its four
immediate nondiagonal neighbours, and 9 cells, consisting of the cell
along with its eight surrounding neighbours.

Cellular Automata

The term
refers to an assignment of states to cells in the

When considering a finite-sized grid, spatially periodic boundary
conditions are frequently applied, resulting in a circular grid for the
one-dimensional case, and a toroidal one for the two-dimensional

Cellular Automata

This CA has k=2 states for
each cell (black or white).

The CA has radius r = 1 (two
neighbours per cell, and the
state of the current cell is

The grid is circular: the
neighbour of the leftmost cell is
the rightmost one, and the
neighbour of the rightmost cell
is the leftmost one.

Notice the way the pattern in
the initial configuration is
preserved, but shifted to the
left every iteration.

Will this happen for every
configuration? Can you prove it?
Conway’s Game Of Life

One of the most notorious CAs of all was invented by John Horton
Conway some 40 years ago.

It is a two dimensional CA, with each cell having nine neighbours
(including itself), and two states (black or white).

Conway discovered that his CA was capable of generating astonishing
patterns and structures.

He also showed that it was computation-universal.

Conway’s Game Of Life
Conway’s Game Of Life
Ramona Behravan’s 3D R-D cellular automata

Ramona Behravan’s 3D reaction-diffusion CA

Ramona Behravan’s 3D reaction-diffusion CA

Ramona Behravan’s 3D reaction-diffusion CA

Ramona Behravan’s R-D cellular automata

Cellular Automata

Over the years CAs have been applied to the study of general aspects
of the world, including communication, computation, construction,
growth, reproduction, competition and evolution.

One notable example was the work of Melanie Mitchell who
demonstrated that a genetic algorithm could evolve the rules of a 1D CA
to make it perform a simple computation.

For example, she evolved CAs capable of producing a final configuration
of all 1’s or all 0’s depending on whether there were more 1’s in the
initial configuration or not.

Other work by Hugo de Garis and later Bentley and Kumar has
examined how a GA can evolve CA rules capable of developing a “seed”
configuration into specific shapes. This is intended to be similar to the
way natural evolution evolved our DNA, which determines how we
develop. We’ll return to this in a later lecture.

Cellular Automata

CAs have been used to provide simple models of common differential
equations of physics, such as the heat and wave equations and the
Navier-Stokes equation.

CAs also provide a useful discrete model for a branch of dynamical
systems theory which studies the emergence of well-characterized
collective phenomena such as ordering, turbulence, chaos, symmetry-
breaking, fractals, etc.

The systematic study of CAs in this context was pioneered by Wolfram
and studied extensively by him, identifying four qualitative classes of CA
behaviour (referred to as Wolfram classes), with analogues in the field of
dynamical systems.

Non-uniform CAs can also be used in which the local update rule (i.e.,
rule table) need not be identical for all grid cells.

Lindenmayer Systems

Lindenmayer was a biologist who was interested in expressing natural
growth using a computer.

He created a system, or language, for describing how things change
over time.

Today we call this language

an L-System
Lindenmayer Systems

L-systems are a string-rewriting grammar. They define a string and a set
of rules which are applied in parallel to rewrite that string into a new
form, each iteration.

Lindenmayer's original L-system for modelling the growth of algae:
variables : A B
constants : none
start : A
rules : (A → AB), (B → A)

which produces:
n = 0 : A
n = 1 : AB
n = 2 : ABA
n = 3 : ABAAB
n = 4 : ABAABABA

Lindenmayer Systems

The fractal plant shown a couple of slides back is defined by:
2 variables : X F
constants : + −
Starting string : X
rules : (X → F-[[X]+X]+F[+FX]-X), (F → FF) angle : 25°

We can then interpret parts of the resulting string as drawing
instructions, where, F means "draw forward", - means "turn left 25°” and
+ means "turn right 25°”.

X does not correspond to any drawing action and is used to control the
evolution of the curve. [ corresponds to saving the current values for
position and angle, which are restored when the corresponding ] is

Lindenmayer Systems

There are many variations of L-System. We commonly use a parametric
as a tuple

G = (V, ω, P),

V (the alphabet) is a set of symbols containing elements that can be replaced (variables)
ω (start, axiom or initiator) is a string of symbols from V defining the initial state of the
P is a set of production rules or productions defining the way variables can be replaced
with combinations of constants and other variables.

A production consists of two strings, the predecessor and the successor.
For any symbol A in V which does not appear on the left hand side of a
production in P, the identity production A → A is assumed; these
symbols are called constants.

The rules of the L-system grammar are applied iteratively starting from
the initial state. As many rules as possible are applied simultaneously,
per iteration.

Lindenmayer Systems

An L-system is context-free if each production rule refers only to an
individual symbol and not to its neighbours.

Context-free L-systems are thus specified by either a prefix grammar, or
a regular grammar. If a rule depends not only on a single symbol but
also on its neighbours, it is termed a context-sensitive L-system.

If there is exactly one production for each symbol, then the L-system is
said to be deterministic (a deterministic context-free L-system is
popularly called a D0L-system).

If there are several, and each is chosen with a certain probability during
each iteration, then it is a stochastic L-system.
Evolving Generative Systems

Evolving L-systems to generate virtual creatures
Gregory S. Hornby, Jordan B. Pollack

Greg had the idea of evolving L-Systems, first for virtual creatures, then
for designs. (After completing his PhD he went to work for NASA and
used the same method to evolve an antenna which was sent to space.)

Some of his evolved virtual creatures:
Evolving Generative Systems

Jon McCormack’s evolved generative artwork

Evolving Generative Systems

Jon McCormack’s evolved generative artwork


A fractal is “
a rough or fragmented geometric shape that can be split into
parts, each of which is (at least approximately) a reduced-size copy of
the whole
” according to Mandelbrot.

In other words it has

Although L-Systems can create fractals, the first and most famous
fractal was discovered by the mathematician Benoit Mandelbrot in 1978.

It is known as the Mandelbrot Set and some regard it as so important
that they call it “the true geometry of nature”.

Mandelbrot used a computer to visualise a very simple equation:

+ c

Rather like the L-System rules, this equation is applied iteratively,
transforming the current state into a new state.

Mandelbrot was interested in what this equation did for

Benoit Mandelbrot wanted to know which values of
would make the
length of
stop growing when the equation was applied for an infinite
number of times.

He discovered that if the length ever went above 2, then it was
unbounded – it would grow forever. But for the right imaginary values of
, sometimes the result would simply oscillate between different lengths
less than 2.

Mandelbrot used his computer to apply the equation many times for
different values of
. For each value of
, the computer would stop early
if the length of the imaginary number in
was 2 or more. If the computer
hadn’t stopped early for that value of
, a black dot was drawn.

The dot was placed at coordinate (
) using the numbers from the
value of
: (
) where
was varied from –2.4 to 1.34 and
varied from 1.4 to -1.4, to fill the computer screen.

The resulting image was the Mandelbrot Set – an inkblot resembling a
squashed bug with little tendrils at the edges. Instead of being a pure
geometric form such as a square or circle, it looked distinctly organic.

Its appearance was so strange that Mandelbrot tried magnifying the
image – only to find more detail. The more he zoomed in, the more
intricate structure he saw.

As we’ve seen from CAs, L-Systems and Fractals, even deterministic
systems can be unpredictable. Chaotic systems are another example:

Chaotic systems can be defined as:

sensitive to initial conditions

an arbitrarily small perturbation of the current trajectory may lead to significantly
different future behaviour (the Butterfly Effect)

topologically mixing

the system will evolve over time so that any given region or open set of its

phase space will eventually overlap with any other given region

dense periodic orbits

every point in the space is approached arbitrarily closely by periodic orbits

strange attractors

some chaotic systems are only chaotic in one region of their phase spaces

although a chaotic system is unpredictable, it may have
strange attractors

classes of behaviours that the system may switch between.

the most famous is the Lorenz attractor, derived from a simple model of weather
Complex Systems
Complex Systems

An example of a complex system is a society.

A society consists of many independent, locally interacting
components, namely humans.

The current state of the society is the global structure.

Each and every individual responds to the current state and thereby
create the new state of society in the next moment.

And so on.

Other examples of complex systems include: the economy, the
Internet, and most biologist systems, e.g., evolution, the brain,
embryogenesis, the immune system, an ant colony, etc…

Complex Systems

A complex system:

consists of many independent components,

these components interact locally,

the overall behavior is independent of the internal structure of the
components, and

the overall behavior of the system is well-defined.

Complex Systems

"The system consists of many independent components”

Two important points: there are
components in the
system and there are
of them.

In other words, a Complex system is NOT a whole that is built up of
parts. It is a whole built up of other wholes.

These components may therefore themselves be complex systems.
(Think of an ecology built from animals, built from cells, built from
molecules, etc)

Complex Systems

"The components interact locally”

a neuron only interacts with its nearby neurons, ants with its nearby
ants and so on.

No component interacts with all the other components in the system,
at least not simultaneously. Each component is
connected to
all other components in the system via other components.

So although the components of the system only interact locally they
have global effect on the system.

An example of this is a car queue. If a car in car queue suddenly slows
down from 50 m/h to 40 m/h then the car behind him would have to
slow down too and the car behind that car and so on. The speed
reduction of that single car will propagate like a shock wave through
the car queue and affect the speed of the cars miles down the road.
This illustrates how local interactions produces global effects in
complex systems.

Complex Systems

"The overall behavior is independent of the internal structure of
the components”

it doesn't matter how the components of the complex system is built
as long as they do the same things

This means that the same emergent property will arise in completely
different systems.

One example of this is the wave. Waves of course emerge in water
and air. We also saw that a speed reduction travels like a wave
through a car queue. You’ll even see the same thing in an ant colony:
bump one ant and it moves erratically, bumping into other ants which
makes them move erratically, until the whole nest is boiling.
Complex Systems

"The overall behavior of the system is well-defined”

If we disregard the components in a complex system and only look at
the emergent phenomenon then it turns out that it behaves in easily
described patterns.

Indeed, the simplest of all emergent phenomena, the wave, is
incorporated as a part of mathematics because it has exact and well-
defined overall properties. Waves are linear, i.e. they can be added,
and the derivative of a sine wave is a cosine wave.

Likewise more complex emergent phenomena evolves along quite
distinct patterns. You could even say economies follow clear patterns
– cycles of boom and bust.
Properties of Complex Systems

A complex system is not amenable to precise prediction

Same as a chaotic system: there are often clear types of behaviour,
but it is not possible to predict exactly which behaviour the system will
be exhibiting (or the precise details of that behaviour) at any arbitrary
point in the future. This is true even if the rules that govern the
behaviour are deterministic (non random).

For example, despite using the most powerful computers in the world
the weather remains unpredictable; despite intensive study and
analysis, ecosystems and immune systems do not behave as
expected. Even in something as simple as a CA, no-one can predict
what emergent behaviours will result from a few simple rules applied

However – like chaotic systems, a complex system may have a state
space containing attractors, where each attractor corresponds to a
common type of behaviour.
Properties of Complex Systems

A complex system is emergent

Rather than being planned or controlled, the agents in a complex
system interact (perhaps in apparently random ways).

From all these interactions, patterns
which inform the
behaviour of the agents within the system and the behaviour of the
system itself.

For example a termite hill is a wondrous piece of architecture with a
maze of interconnecting passages, large caverns, ventilation tunnels
and much more. Yet there is no grand plan and no central controller,
the hill just emerges as a result of the termites following a few simple
local rules.
Properties of Complex Systems

A complex system is embodied / co-evolves

All systems exist within their own environment and they are also part
of that environment.

Therefore, as their environment changes they change to ensure best

But because they are part of their environment, when they change,
they change their environment, and as it changes they need to change
again, and so it goes on as a constant process.
Properties of Complex Systems

A complex system is non-homogeneous

If everything was the same in a complex system then when one agent
fails (e.g. from a new disease) then they all fail.

Variety within the system makes the system stronger.

Evolution could not occur without variation driving novelty.

Democracy is a good example in that its strength is derived from its
tolerance and even insistence of a variety of political perspectives.
Properties of Complex Systems

A complex system is highly connected

The ways in which the agents in a system connect and relate to one
another is critical to the survival of the system, because it is from
these connections that the patterns are formed and the feedback

The relationships between the agents are generally more important
than the agents themselves.

Indeed, you can argue that the three most important ways to vary a
complex system are: the number of agents, the number of connections
between the agents, and the strength of the connections between
agents. (For more on this, read about Kauffman’s N-K model, where
systems are modelled as N nodes linked by K connections.)
Properties of Complex Systems

A complex system is driven by simple rules

Complex adaptive systems are often not complicated.

The emerging patterns may have a rich variety, but like a
kaleidoscope the rules governing the function of the system are quite

A classic example is that all the water systems in the world, all the
streams, rivers, lakes, oceans, waterfalls etc with their infinite beauty,
power and variety are governed by the simple principle that water
finds its own level.
Properties of Complex Systems

A complex system is driven by iteration

Because those simple rules are iterated over and over, small changes
in the initial conditions of the system can have significant effects after
they have passed through the emergence-feedback loop a few times
(often referred to as the butterfly effect in chaotic systems).

A rolling snowball for example gains on each roll much more snow
than it did on the previous roll and very soon a fist sized snowball
becomes a giant one.
Properties of Complex Systems

A complex system is self-organising

There is no hierarchy of command and control in a complex adaptive

There is no planning or managing, but there is a constant re-
organising to find the best fit with the environment.

A classic example is that if one were to take any western town and
add up all the food in the shops and divide by the number of people in
the town there will be near enough two weeks supply of food, but there
is no food plan, food manager or any other formal controlling process.

The system is continually self organising through the process of
emergence and feedback.
Properties of Complex Systems

A complex system is “on the edge of chaos”

Complexity theory is not the same as chaos theory, which is derived
from mathematics.

But chaos does have a place in complexity theory in that systems exist
on a spectrum ranging from equilibrium to chaos.

A system in equilibrium does not have the internal dynamics to enable
it to respond to its environment and will slowly (or quickly) die.

A system in chaos ceases to function as a system. The most
productive state to be in is at the “edge of chaos” where there is
maximum variety and creativity, leading to new possibilities
Properties of Complex Systems

A complex system comprises nested systems / embedded

Most systems are nested within other systems and many systems are
systems of smaller systems.

Take the example in self organising previously and consider a food

The shop is itself a system with its staff, customers, suppliers, and
neighbours. It also belongs the food system of that town and the larger
food system of that country. It belongs to the retail system locally and
nationally and the economy system locally and nationally, and
probably many more. Therefore it is part of many different systems
most of which are themselves part of other systems.
End of Lecture!