Cellular Automata, L-Systems, Fractals, Chaos and Complex Systems
Total Page:16
File Type:pdf, Size:1020Kb
Cellular Automata, L-Systems, Fractals, Chaos and Complex Systems EXTRA READING: Online tutorial for CAs: http://users.utu.fi/jkari/ca/CAintro.pdf Online tutorial for Chaos: http://www.viewsfromscience.com/documents/webpages/ chaos.html Books: The Algorithmic Beauty of Plants, The Fractal Geometry of Nature Paper: 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 practice. 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) cells. • 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 configuration refers to an assignment of states to cells in the grid. • 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 case. 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 ignored). • 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 • Will this happen for every left every iteration. 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 n = 5 : ABAABABAABAAB n = 6 : ABAABABAABAABABAABABA n = 7 : ABAABABAABAABABAABABAABAABABAABAAB 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 executed. Lindenmayer Systems • There are many variations of L-System. We commonly use a parametric L-systems defined as a tuple G = (V, ω, P), • Where 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 system 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 Fractals • 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 self-similarity. • 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: 2 xt+1 = xt + c • • Rather like the L-System rules, this equation is applied iteratively, transforming the current state into a new state. Fractals • Mandelbrot was interested in what this equation did for imaginary numbers. • Benoit Mandelbrot wanted to know which values of c would make the length of xt 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 c, 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 c. For each value of c, the computer would stop early if the length of the imaginary number in xt was 2 or more.