Professional Documents
Culture Documents
UD Complex 2016 I FractalsSelfOrganization I
UD Complex 2016 I FractalsSelfOrganization I
Fractals from
Self-Organization
http://www.youtube.com/watch?v=ukS4UjCauUs
http://www.youtube.com/watch?v=R07_JFfnFnY&feature=related
The Brain
The actions of
neurons and the
pattern of
connections
among groups of
neurons are what
cause perception,
thought, feelings,
consciousness.
http://phineasgage.wordpress.com/2007/03/15/google-tech-talk-lecture-computational-neuroscience
The Immune System
http://www.youtube.com/watch?v=LSYED-7riNY
Economy
Dow-jones index
The simple microscopic
components consist of people
buying and selling goods and the
collective behavior is the
complex, hard-to-predict
behavior of markets as a whole,
including prices of housing and
fluctuation in stock prices.
The World Wide Web
Individuals post web
pages, linking to other
web pages. But the
overall structure, the
growing pattern and the
co-evolutionary
relationships between
search engines and the
Web´s link structure are
highly complex
Some common aspects
www
“Tractable” model
“Realistic” model
Natural math model
As usual, simplified math modeling
Simple topological interconnections: Each component interacts with two immediate neighbors in a row
Simple internal states and interactions: on/ff and three-input boolean functions
Cellular Automaton
…
…
…
…
…
-1) ci-r(t-1) … ci-1(t-1) ci(t-1) ci+1(t-1) … ci+r(t-1) c
…
…
…
…
time space
ci(t) is the state of cell i at instant t
The next state of cell i depends on the current states of the neighbor cells in a radius r
For k states we need R = k2r+1 rules and there are kR possible sets of rules
50
100
150
200
250
50 100 150 200 250 300 350 400 450 500
colormap([1 1 1; 0 0 0]) % 0 blanco, 1 negro
n = 512; i=2:n-1; % Tamaño de la linea
c = zeros(n,n); % Historia del autómata
c(1,:) = (rand(1,n)>0.95); % Estado inicial
for t=2:n % Indice de tiempo
sum(i) = c(t-1,i-1) + c(t-1,i) + c(t-1,i+1);
sum(1) = c(t-1,n) + c(t-1,1) + c(t-1,2);
sum(n) = c(t-1,1) + c(t-1,n) + c(t-1,n-1);
c(t,:) = (sum<3).*(sum>0); % Evalúa la regla
end
imagesc(c)
50
100
150
200
250
300
350
400
450
500
50 100 150 200 250 300 350 400 450 500
Elementary (binary neighbor-3)
cellular automata
ci-1(t) ci(t) ci+1(t) ci(t+1)
0 0 0 x0 8 bits : 256 possible rules
0 0 1 x1 011111102 = 12610
0 1 0 x2
0 1 1 x3
1 0 0 x4
1 0 1 x5
1 1 0 x6
1 1 1 x7
Elementary cellular automata
regla = 126; % Evalúa el autómata celular binario unidimensional con vecindario 3 para la regla dada
AC = zeros(800,800); % Autómata celular
AC(1,:) = (rand(1,800)>0.975); % Estado inicial (~20 celdas prendidas)
regla = fliplr(dec2bin(regla,8)); % Función lógica para 111,110,101,100,011,010,001,000
for i=1:8 % [ r7 r6 r5 r4 r3 r2 r1 r0]
r(i)=str2num(regla(i));
end
for i=2:800 % Simula 800 pasos
for j=2:799 % Recorre cada columna
x = AC(i-1,j+(-1:1)); % Vecindario de (i,j)
AC(i,j) = (~x(1) & ~x(2) & ~x(3) & r(1)) | (~x(1) & ~x(2) & x(3) & r(2)) | ... % Evalúa
(~x(1) & x(2) & ~x(3) & r(3)) | (~x(1) & x(2) & x(3) & r(4)) | ... % la regla
( x(1) & ~x(2) & ~x(3) & r(5)) | ( x(1) & ~x(2) & x(3) & r(6)) | ... % para (i,j)
( x(1) & x(2) & ~x(3) & r(7)) | ( x(1) & x(2) & x(3) & r(8));
end
end
imshow(~AC) % Muestra el resultado (blanco: apagado, negro: prendido)
title(['Regla # ' fliplr(regla)]) % Despliega la regla evaluada
Elementary cellular automata
Regla # 0 Regla # 1 Regla # 2 Regla # 3 Regla # 4 Regla # 5 Regla # 6 Regla # 7
Regla # 96 Regla # 97 Regla # 98 Regla # 99 Regla # 100 Regla # 101 Regla # 102 Regla # 103
Regla # 104 Regla # 105 Regla # 106 Regla # 107 Regla # 108 Regla # 109 Regla # 110 Regla # 111
Regla # 112 Regla # 113 Regla # 114 Regla # 115 Regla # 116 Regla # 117 Regla # 118 Regla # 119
Regla # 120 Regla # 121 Regla # 122 Regla # 123 Regla # 124 Regla # 125 Regla # 126 Regla # 127
Elementary cellular automata
Regla # 128 Regla # 129 Regla # 130 Regla # 131 Regla # 132 Regla # 133 Regla # 134 Regla # 135
Regla # 136 Regla # 137 Regla # 138 Regla # 139 Regla # 140 Regla # 141 Regla # 142 Regla # 143
Regla # 144 Regla # 145 Regla # 146 Regla # 147 Regla # 148 Regla # 149 Regla # 150 Regla # 151
Regla # 152 Regla # 153 Regla # 154 Regla # 155 Regla # 156 Regla # 157 Regla # 158 Regla # 159
Regla # 160 Regla # 161 Regla # 162 Regla # 163 Regla # 164 Regla # 165 Regla # 166 Regla # 167
Regla # 168 Regla # 169 Regla # 170 Regla # 171 Regla # 172 Regla # 173 Regla # 174 Regla # 175
Regla # 176 Regla # 177 Regla # 178 Regla # 179 Regla # 180 Regla # 181 Regla # 182 Regla # 183
Regla # 184 Regla # 185 Regla # 186 Regla # 187 Regla # 188 Regla # 189 Regla # 190 Regla # 191
Elementary cellular automata
Regla # 192 Regla # 193 Regla # 194 Regla # 195 Regla # 196 Regla # 197 Regla # 198 Regla # 199
Regla # 200 Regla # 201 Regla # 202 Regla # 203 Regla # 204 Regla # 205 Regla # 206 Regla # 207
Regla # 208 Regla # 209 Regla # 210 Regla # 211 Regla # 212 Regla # 213 Regla # 214 Regla # 215
Regla # 216 Regla # 217 Regla # 218 Regla # 219 Regla # 220 Regla # 221 Regla # 222 Regla # 223
Regla # 224 Regla # 225 Regla # 226 Regla # 227 Regla # 228 Regla # 229 Regla # 230 Regla # 231
Regla # 232 Regla # 233 Regla # 234 Regla # 235 Regla # 236 Regla # 237 Regla # 238 Regla # 239
Regla # 240 Regla # 241 Regla # 242 Regla # 243 Regla # 244 Regla # 245 Regla # 246 Regla # 247
Regla # 248 Regla # 249 Regla # 250 Regla # 251 Regla # 252 Regla # 253 Regla # 254 Regla # 255
Elementary cellular automata
1. Uniform 2. Repetitive Regla # 01001101
¡Computational
Capacity!
Current PCs are sophisticated TM based John Von Neumann and the IAS computer
on Von Neumann architecture
¡But John Von Neumann designed many different computer architectures, trying to model life!
1948 Hixon Symposyum in Pasadena “General theory of
automata” :
Turing Machines (logical process), -Alan Turing
Neural Networks (brain learning), -McCulloch and Pitts
Cellular Automata (self-reproduction) -Stanislaw Ulam
n = 128;
mundo = zeros(n,n);
mundo(2:4,2:4) = [0 0 1; 1 0 1; 0 1 1];
mundo(20:32,3:15) = [0 0 1 1 1 0 0 0 1 1 1 0 0;...
0 0 0 0 0 0 0 0 0 0 0 0 0;...
1 0 0 0 0 1 0 1 0 0 0 0 1;...
1 0 0 0 0 1 0 1 0 0 0 0 1;...
1 0 0 0 0 1 0 1 0 0 0 0 1;...
0 0 1 1 1 0 0 0 1 1 1 0 0;...
0 0 0 0 0 0 0 0 0 0 0 0 0;...
0 0 1 1 1 0 0 0 1 1 1 0 0;...
1 0 0 0 0 1 0 1 0 0 0 0 1;...
1 0 0 0 0 1 0 1 0 0 0 0 1;...
1 0 0 0 0 1 0 1 0 0 0 0 1;...
0 0 0 0 0 0 0 0 0 0 0 0 0;...
0 0 1 1 1 0 0 0 1 1 1 0 0];
mundo(90:93,45:49) = [0 1 1 0 0;...
1 1 0 1 1;...
0 1 1 1 1;...
0 0 1 1 0];
mundo(20:24,100:104) = [1 1 0 0 0;...
1 0 0 0 0;...
0 1 0 1 0;...
0 0 0 0 1;...
0 0 0 1 1];
Game of life
mundo = zeros(n,n);
Glider gun
% Inicializa el mundo
mundo(2:10,2:37) = [0 0 0 0 1 1 0 0 0; ...
0 0 0 0 1 1 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 1 1 1 0 0; ...
0 0 0 1 0 0 0 1 0; ...
0 0 1 0 0 0 0 0 1; ...
0 0 1 0 0 0 0 0 1; ...
0 0 0 0 0 1 0 0 0; ...
0 0 0 1 0 0 0 1 0; ...
0 0 0 0 1 1 1 0 0; ...
0 0 0 0 0 1 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 1 1 1 0 0 0 0; ...
0 0 1 1 1 0 0 0 0; ...
0 1 0 0 0 1 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
1 1 0 0 0 1 1 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0 0; ...
0 0 1 1 0 0 0 0 0; ...
0 0 1 1 0 0 0 0 0]';
Why “Game of life”?
… Self-reproduction!
They use significative and suggestive (and funny) names:
• Since extremely simple dynamical systems (as simple as rule 110) can
support universal computation, most natural systems can probably
support universal computation too…
• A nice way to think about processes in nature is that they are computing…
• Physics has gone from matter and energy to information…
mundo = ...
2*(mundo==2) - ((mundo==2) & (suma>0 | (rand(n,n)<p))) + ... % de dos a uno porque se quema
2*((mundo==0) & rand(n,n)<q) ; % de cero a dos porque nace un árbol
% de uno a cero porque queda vacío
imagesc(mundo)
drawnow
end
Connected site
Isolated site
Simplified model of forest-fires
17/64 13/64
Simplified model of forest-fires
function y = Bosque_SOC(ro)
n=100; N = 200; % Tamaño del mundo, número de simulaciones
p = zeros(N,1); % Densidad después del rayo
for i = 1:N
mundo=2*double((rand(n,n)<ro)); % Mundo inicial
x = randi(n); y = randi(n); % Sitio de impacto
if mundo(x,y)==2 % Es un árbol: la región entera se debe quemar
L = bwlabel((mundo==2),4); % Regiones conectadas
k = L(x,y); % Región en la que se encuentra el sitio de impacto
mundo = mundo.*(L~=k) + double((L==k)); % quema la región entera
end
p(i) = sum(mundo(:)==2)/n/n; % Densidad después del rayo
imagesc(mundo); % Visualiza el mundo
colormap([0 0 0; 1 0 0; 0 1 0]); % Negro=vacío, rojo=quemado, verde=vivo
axis equal; axis tight; axis off
drawnow
end
y = mean(p);
Yield, y
L = bwlabel((mundo==2),4); 0.4
k = L(x,y);
mundo = mundo.*(L~=k) + double((L==k));
0.3
end
p(i) = sum(mundo(:)==2)/n/n;
imagesc(mundo); 0.2
colormap([0 0 0; 1 0 0; 0 1 0]);
axis equal; axis tight; axis off
0.1
drawnow
end
y = mean(p); 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Density,
0.9
no sparks
0.8 “critical point”
0.7
0.6
Yield, y
0.5
0.4
0.3
0.2 sparks
0.1
0
0 0.2 0.4 0.6 0.8 1
Density,
limit 1
N 0.9
0.6
Yield, y
0.5
0.4
0.3
0.2
0.1 c = .5927
0
0 0.2 0.4 0.6 0.8 1
Density,
Simplified model of forest-fires
Fires
don’t
matter.
Simplified model of forest-fires
Everything burns.
Simplified model of forest-fires
Critical point
Percolation Models
At what density appears the first canopy
path between two borders of the forest?
Percolation
Percolation Models
At what density appears the first canopy
path between two borders of the forest?
For an infinite grid, at what density
appears the first infinite cluster?
For a given density, what is the probability that a
canopy path exists between two borders of the forest?
y ( ρ) 1 P ( ρ) ρ P ( ρ) ρ P ( ρ)
y ( ρ) 1 P ( ρ) ρ P ( ρ) ρ P ( ρ)
Percolation Models
1
0.9
0.8
0.7
0.6
P 0.5
0.4
0.3
0.2
0.1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
ρ
Critical Point
n = 512;
Percolation Models
% Grilla de 512x512
b = 2.^(0:18)';
h = zeros(19,3);
% 19 tamaños de clusters
% 3 densidades iniciales
SOC: Self-
ro = [0.3 0.593 0.8]';
for i=1:3
% antes, durante y después del punto crítico Organized
for j=1:6000 % 6000 simulaciones para cada densidad
mundo = logical(rand(n,n)<ro(i)); % Construye el bosque
Criticality
CC = bwconncomp(mundo,4); % Halla los componentes conectados
numPixels = cellfun(@numel,CC.PixelIdxList); % Calcula sus tamaños
h(:,i) = h(:,i) + hist(numPixels,b)'; % Suma los histogramas
end
h(:,i) = h(:,i)/sum(h(:,i)); % Estima la probabilidad de cada rango de tamaños
end
loglog(b,1-cumsum(h)) % Grafica las colas de las distribuciones
0
10
ro = 0.3
ro = 0.593 Los incendios
-1 ro = 0.8
10 forestales reales
Frecuencia relativa
-4
10
0 1 2 3 4
10 10 10 10 10
Tamaño del incendio
SOC/EoC
0
10
ro = 0.3
ro = 0.593
-1 ro = 0.8 Self-Organized
10 Criticality at the
Frecuencia relativa
Edge of Chaos
-2
10
Chaos
-3
10
-4
10
0 1 2 3 4
10 10 10 10 10
Tamaño del incendio
Forest-fire model
n=100; % Tamaño del mundo
p = 0.0001; % Probabilidad de que caiga un rayo
q = 0.01; % Probabilidad de que nazca un árbol
mundo=zeros(n,n); % El bosque empieza vacío
imagesc(mundo); % Visualiza el mundo
colormap([0 0 0; 1 0 0; 0 1 0]); % 0–negro(vacío), 1-rojo(quemado), 2-verde (vivo)
axis equal
axis tight
while(1)
suma = (mundo(1:n,[n 1:n-1])==1) + (mundo(1:n,[2:n 1])==1) + ... % suma(i,j) = # de árboles
(mundo([n 1:n-1], 1:n)==1) + (mundo([2:n 1],1:n)==1) ; % quemándose en la vecindad de (i,j)
mundo = ...
2*(mundo==2) - ((mundo==2) & (suma>0 | (rand(n,n)<p))) + ... % de dos a uno porque se quema
2*((mundo==0) & rand(n,n)<q) ; % de cero a dos porque nace un árbol
% de uno a cero porque queda vacío
imagesc(mundo)
drawnow
end