16.12.2012 Views

Computer Algebra Recipes

Computer Algebra Recipes

Computer Algebra Recipes

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8.3. THE BIFURCATION DIAGRAM 339<br />

After a short transient interval, the logistic system oscillates back and forth<br />

between the two branches shown in the ¯gure. This is characteristic of a period-<br />

2 solution, there being only one branch in steady state for a period-1 solution.<br />

As a is increased, further bifurcations occur.<br />

To create a bifurcation diagram for the logistic map, a particular initial<br />

value of x0 is chosen, and the map iterated for a given a. A certain number of<br />

the initial points are thrown away to remove the transient part of the solution,<br />

and the subsequent steady-state points plotted. Then, one increments a by a<br />

small amount and repeats the process, and so on. The whole process is easily<br />

automated, as is now illustrated.<br />

> restart: with(plots):<br />

As you may con¯rm by running the ¯rst part of the recipe, a period-1 solution<br />

prevails until a =3:0, at which point period two begins. In the recipe, the range<br />

of a is taken from the starting value Sa =2:9 uptothe¯nalavalue Fa =4. If<br />

this a range is divided into, say, N = 200 equal intervals,<br />

> Sa:=2.9: Fa:=4: N:=200: stepsize:=(Fa-Sa)/N; x:=0.2;<br />

stepsize := 0:005500000000 x := 0:2<br />

the stepsize is ¢a =0:0055. The initial value of x has been taken to be x =0:2.<br />

A total of 500 iterations will be considered and the ¯rst 100 points ignored<br />

in order to remove any transients. This leaves 400 points to be plotted for each<br />

a value. The quantity c is a counter to keep track of the plots, a graph being<br />

produced for each a value. The counter is initially set equal to zero.<br />

> totalpts:=500: ignorepts:=100: pts:=totalpts-ignorepts; c:=0:<br />

pts := 400<br />

In the following double do loop, the ¯rst, or outer, loop increments a from the<br />

starting value Sa to the ¯nal a value Fa in incremental steps given by stepsize.<br />

> for a from Sa to Fa by stepsize do<br />

The second, or inner, do loop iterates the logistic equation from 1 to totalpts.<br />

> for n from 1 to totalpts do<br />

> x:=a*x*(1-x);<br />

The points for a given a value are formed into a list,<br />

> pts[n]:=[a,x];<br />

> end do;<br />

and the inner do loop completed. Then, the counter is advanced by one,<br />

> c:=c+1;<br />

and a list of lists is made using the ¯nal 400 (presumably) steady-state points.<br />

> points:=[seq(pts[k],k=ignorepts..totalpts)]:<br />

Aplotismadeforeachavalue using a point style,<br />

> Gr[c]:=pointplot(points,symbol=point,color=black):<br />

> end do:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!