230 likes | 410 Views
Summary What have we learned ?. Many physical systems are nonlinear (at least) two types of behavior periodic motion chaotic motion Simple example: logistic map x new =ax old (1-x old ) (population dynamics) Two types of motion - depending on a. Close to chaos.
E N D
SummaryWhat have we learned ? • Many physical systems are nonlinear • (at least) two types of behavior • periodic motion • chaotic motion • Simple example: logistic map xnew=axold(1-xold) (population dynamics) • Two types of motion - depending on a
Close to chaos ... • As parameter a is increased period of motion doubles a2 -> a4->a8-> ... • Values of x on a 2-cycle (period 2 motion) gotten from x=f(f(x)) where f(x)=ax(1-x) • Gaps between successive am get smaller by constant ratio = 4.67 • This number is universal
Chaotic regime • Motion confined to aperiodic or strange attractor • Initially nearby motions diverge - butterfly effect • Lyapunov exponent > 0 • Attractor is a fractal • self-similar • fractional effective dimension • All fractals thought to be associated with chaotic dynamics
Measuring dimension • Embed fractal in ordinary space • Imagine covering this space with boxes of side length s • Count number of boxes needed to cover all fractal - N(s) • Plot log(N(s)) vs log(1/s) • gradient is dimension d. • Non space filling object with structure at all length scales
Example 1.Sierpinski triangle • Take a triangle. Remove “middle” • Now remove middle of each of 3 remaining triangles • Repeat … • Each bite removes 1/4 original area • After k bites area=(3/4)k -- goes to zero for k large
Dimension of Sierpinski • In this case cover with triangles not squares. N(s) s 1 1 3 1/2 9 1/4 ……………… 3k 1/2k D=ln(3)/ln(2)=1.585..!
Try this …Take triangle ABC Roll a die and do 1 of the following • if 1 or 2, find point midway from your current pt to A. This is your new current pt. Draw a dot there. • If 3 or 4 find point midway from your current pt to B. This is your new current pt. Draw a dot there • If 5 or 6 find point midway from your current pt to C. This is your new current pt. Draw a dot there.
Why ? • Suppose you are at (x,y) • Jump 1/2 way to A (0,0) means • x->x/2, y->y/2 • type A move • Jump 1/2 way to B (1,0) means • x->x/2+1/2, y->y/2 • type B move • Jump 1/2 way to C (1/2,1) • x->x/2+1/4, y->y/2+1/2 • type C move
Types of move • Type A moves map all pts of original triangle to region A • Type B moves map all pts of original triangle to region B • Similarly for type C moves. • But type A moves on region A map pt to region AA, move B on region A maps to region BA. • Similarly type C moves on region A produce pt in region CA etc etc
Moves -> Sierpinski • Notice: can never find pt inside large middle triangle ! • Can never find pt inside center triangle of region A! • etc etc • these moves when iterated generate every pt on Sierpinski’s triangle !
Iterate ... • If we start at a corner point every move takes us to a pt on the fractal • We never reach certain pts! • After an infinite number of moves we will have visited every point on the fractal • Dynamics is random and chaotic
Generalizations • Each point of the fractal is given by (x,y) • New points arise via a map xn+1=f(xn,yn) yn+1=g(xn,yn) • In case of Sierpinski the map is quite simple: f(x,y)=ax+by+e g(x,y)=cx+dy+f • a=b=1/2 c=d=0 and e and f vary
Nonlinear nature • If a,b,c,d,e,f were truly constant this would be linear map - no good! • Instead make nonlinear map by choosing moves at random from a fixed set. • All such fractals generated by suitable choice of sets of {a,b,c,d,e,f}
Summary of method • Suppose I have 3 different sets of {a,b,c,d,e,f} • Choose some initial (x,y) • Select 1 set at random and update x,y • Repeat very many times • If the sets are carefully chosen this will generate all pts of the fractal
Useful notation • Each set {a,b,c,d,e,f} may be labelled by an integer 0,1,2 .. • Use the notation that a[0] refers to the value of a in set 0, a[1] the value of a in set 1 etc • Thus b[3] would be the value of b in set 3 • Think of a[0], a[1], a[2] as elements of a list or array
More notation • Thus each regular fractal can be specified by giving the arrays a[],b[],c[] etc • Each update to x,y consists of choosing randomly one such set eg a[2],b[2],c[2],d[2],e[2],f[2] and computing new x,y xnew=a[2]x+b[2]y+e[2] ynew=c[2]x+d[2]y+f[2]
Sierpinski requires .. • 3 sets : • a[0]=0.5,b[0]=0,c[0]=0,d[0]=0.5 e[0]=0,f[0]=0 • a[1]=0.5,b[1]=0,c[1]=0,d[1]=0.5 e[1]=0.5,f[1]=0; • a[2]=0.5,b[2]=0,c[2]=0,d[2]=0.5 e[2]=0.25,f[2]=0.5
Hwa4- new things • public class Hwa4 extends java.applet.Applet implements Runnable{..} • Special word Runnable - indicates that class will contain animation • This animated component is given a separate thread of execution
New data private Thread runner; • Piece of animation/graphic controlled by a thread • Starting or stopping the thread starts or stops graphic • Allows many different dynamic components to program - mouse clicks run under a separate thread to the graphic
New methods ... public void start(){ runner = new Thread(this); runner.start(); } public void stop(){ if(runner!=null) runner.stop(); }
Run() public void run(){ while(true){ z=z+inc; if((z==15)||(z==-15)) inc=-inc; try{Thread.sleep(10);} repaint(); } }
Extras … • Inside paint() .. g.drawString(“Hello”,x,y+z); g.drawString(“World”,x,y-z); • Gives bouncing text effect • action(), init() and most of paint() unchanged.
Java note: • All applets used in this course have at most the structure of Hwa4 ! • A class extending java.applet • Init, start and stop methods • run method • other simple classes • user interface - action() • drawing class - paint() • perhaps a Map or Simulation class