UD Complex 2016 I FractalsDynamicalSystems 2
UD Complex 2016 I FractalsDynamicalSystems 2
UD Complex 2016 I FractalsDynamicalSystems 2
currents
Convection currents on earth mantle produce tectonic displacement
Foundation of chaos theory
Lorenz did not has a title for a lecture to be
given in 1972 at the 139th congress of the
The butterfly effect
American Association for the Advancement of Foundation of the
Science. Philip Merilees, the chairperson, Popular Fascination
presented it as: “Does the flap of a butterfly’s
wings in Brazil set off a tornado in Texas?”.
produced by chaos
Theory
Lorenz Equations
dx
ay ax
dt
dy
bx y zx
dt
dz
xy cz
dt
t : time
¿ ?
x(t) : position
y(t) : temperature
z(t) : “distortion of T”
a, b, c : Parameters
Computer solutions to differential equations
x f ( x), x(0) x0
We ride on the phase point, flowing according to the
vector field.
x1 = x0 + f(x0)t
Once again
x2 = x1 + f(x1)t
And, after several iterations,
xn+1 = xn + f(xn)t
Euler Method
d
x(t ) sin x(t ) , x(0) x0 through Euler
dt
6
x2
0
x1 -2
-2 - 0 2
-4
-6
d
x(t ) sin x(t ) , x(0) x0 through Euler
dt
• Just estimate the
derivative at the left
x(1) = 0.01; y(1) = 0.01;
for j=2:20000 end of the interval
if j==200*floor(j/200)
y(1+j/200) = y(j/200) + 0.08*sin(y(j/200));
(tn,tn+1)
end
x(j) = x(j-1) + 0.0004*sin(x(j-1));
• Better to use the
end average of the
plot(0.0004*(0:19999),x,'b-',0.08*(0:100),y,'r--')
derivative within the
4
interval
20000 pasos d xn f ( xn )t
100 pasos xn1 xn 12 f ( xn ) f (d ) t
3
estado, x(t)
0
0 2 4 6 8
tiempo, t
d
x(t ) sin x(t ) , x(0) x0 Through 2nd order Euler
dt
x(1) = 0.01; y(1) = 0.01;
for j=2:20000
if j==200*floor(j/200)
d = y(j/200) + 0.08*sin(y(j/200));
y(1+j/200) = y(j/200) + 0.04*(sin(y(j/200)) + sin(d));
end
x(j) = x(j-1) + 0.0004*sin(x(j-1));
end
plot(0.0004*(0:19999),x,'b-',0.08*(0:100),y,'r--')
legend('20000 pasos','100 pasos')
xlabel('tiempo, t')
ylabel('estado, x(t)')
First order Euler
3.5 Second order Euler
20000 pasos
3
100 pasos
2.5
estado, x(t)
1.5
0.5
0
0 1 2 3 4 5 6 7 8
tiempo, t
4th order Runge-Kutta method
k1 f ( xn )t
k2 f xn k1 / 2 t
k3 f xn k2 / 2 t
k4 f xn k3 t
xn 1 xn 16 k1 2k2 2k3 k4
4
20000 pasos
20 pasos
3
estado, x(t)
0
0 2 4 6 8
tiempo, t
Multidimensional 4th order Runge-Kutta method
k1 f ( xn )t
k2 f xn k1 / 2 t
k3 f x n k / 2 t
2
k4 f x n k t
3
xn 1 xn k 2k 2k
1
6 1 2 3 k4
function x = AtractorDeLorenz
x(:,1) = [1 2 3]';
for j=2:10000
dx k1 = 0.01*ecuacion(x(:,j-1));
ay ax k2 = 0.01*ecuacion(x(:,j-1) + k1/2);
dt k3 = 0.01*ecuacion(x(:,j-1) + k2/2);
k4 = 0.01*ecuacion(x(:,j-1) + k3);
x(:,j) = x(:,j-1) + (k1 + 2*k2 + 2*k3 + k4)/6;
dy
bx y zx end
x = x';
dt plot3(x(:,1),x(:,2),x(:,3));
dz function x = ecuacion(x)
xy cz x = [10*(x(2)-x(1)); 28*x(1)-x(2)-x(1)*x(3); x(1)*x(2)-(8/3)*x(3)];
dt
Of course, in matlab Runge-Kutta is already implemented!
g = inline(‘[10*(x(2)-x(1)); 28*x(1)-x(2)-x(1)*x(3); x(1)*x(2)-(8/3)*x(3)]‘,'t','x');
[t,x] = ode45(g,[0:0.01:100],[1;2;3]);
plot(t,x);
10
x(t) 0
-10
-20
0 10 20 30 40 50 60 70 80 90 100
30
20
10
y(t) 0
-10
-20
-30
0 10 20 30 40 50 60 70 80 90 100
50
40
30
z(t) 20
10
0
0 10 20 30 40 50 60 70 80 90 100
50
45
Phase Space
40
35
30
25
20
15
10
0
-30
-20
-10
0
10
20 10 15 20
30 -5 0 5
-20 -15 -10
Homework #6, part III
xn xn1 1 xn1 , 0 xn 1
• In its natural state, corresponds to a chaotic regime, e.g. = 3.78
• For some reason, we cannot move to an stable regime
• We can only produce very small perturbations at particular instants
of time, where the system remains in a chaotic regime
• We take advantage of the existence of a fixed point (unstable, of
course) at x* = ( - 1)/
• When x(t) gets close to x*, we adjust
x(t) 0.5
0
0 500 1000 1500 2000 2500
3.8
(t) 3.79
3.78
0 500 1000 1500 2000 2500
0.6
0.4
0.8
0.6
0.4
0.2
0
0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
3.795
3.79
3.785
3.78
3.775
3.77
0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
If noise is too high, the system can get out of control every now and then
Period-2 periodic orbit
1
0.8
0.6
0.4
0.2
0
0 50 100 150
3.784
3.783
3.782
3.781
3.78
3.779
0 50 100 150
x(1) = 0.5;
ro = 3.78;
r(1) = ro;
x(2) = r(1)*x(1)*(1-x(1));
r(2) = ro • Chaos control in ventricular fibrillation
for i=3:5000 • Chaos control in brain activity
rp = x(i-2)/(x(i-1)*(1-x(i-1)));
if abs(rp-ro)<0.01 associated with epileptic attack
r(i) = rp;
else
r(i) = r(i-1);
end
x(i) = r(i)*x(i-1)*(1-x(i-1));
end
subplot(211); plot(x)
subplot(212); plot(r,'r')