Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Exploring the Logistic Map

HON292A: Entropy and Chaos: Order and Disorder in the Universe 4 September 2008

Pre-lab experiment

Visit the large pendulum in the Riddick Reading Room (near the vending machines in the large space adjacent to our classroom.) Explore its various behaviors, and report what you observe as Reading Response #4. Rather than answering the usual two questions, provide a response to following: Compare the behavior of the pendulum when it is displaced a small amount from its rest position, to the behavior when it is displaced by a large amount. How repeatable are your experiments?

Pre-lab reading

Read pages 59 to 65 of Chaos: Making a New Science (the beginning of the section entitled Lifes Ups and Downs, available through Library Reserved link). This chapter provides an introduction to the logistic map. If you keep reading past p. 65, youll nd out the dramatic ending to these investigations (so dont keep going if you dont want to spoil the surprise.) Two MATLAB scripts (short computer programs) will be provided to you in class, and the main part of each is given here. After reading the text, see if you can match up the instructions given to the computer with the algebra given on page 63. Listing 1: logistic.m
numsteps = 25; x(1) = 0.02; R = 2.7; for i = 1:numsteps x(i+1) = R * x(i) * (1-x(i)); end; plot(1:numsteps, x, bo-); % number of steps to iterate % initial population (starting value for x) % reproduction rate R (between 0 and 4) % perform logistic map for this value of R % compute and save next x

% PLOT THE RESULTS

Listing 2: R vs x.m
numR = 1000; startR = 0.0; endR = 3.0; R = linspace(startR, endR, numR); skipnum = 1000; num = 1000; % % % % SET UP VARIABLES (you can change them) how many values of R to include on plot first value of R to plot last value of R to plot

% SET UP VARIABLES (leave these alone) % number of transient values to throw away % number of values of x to plot

for j = 1:length(R) x = 0.1; for i = 1:skipnum x = R(j) * x * (1-x); end; for i = 1:num x = R(j) * x * (1-x); results(j,i) = x; end; end; plot(R, results, b.);

% LOOP THROUGH ALL VALUES OF R % initial populaiton (starting value for x) % PERFORM LOGISTIC MAP FOR THE j_th value of R % Compute next x (replaces old value)

% CONTINUE TO PERFORM LOGISTIC MAP FOR SAME R % Compute next x (replaces old value) % Save this value for later ploting

% PLOT THE RESULTS

Reasoning about growth

Imagine a dierent map than the one described in the reading: ni+1 = R ni (1)

where ni is the number of critters at the ith generation, and R is the rate of reproduction. Discuss the following question with your neighbors (using a calculator if it helps): As you go from one generation to the next (from n1 to n2 , etc.), what happens for R > 1? As you go from one generation to the next, what happens for R < 1? For a real population of critters, if the habitat gets too crowded then there arent enough resources to feed everybody. With your group, discuss why the logistic map xi+1 = R xi (1 xi ) (2)

has this additional feature built into it. In this map, xi represents is ni , where N is the maximum N number of critters who can survive in the habitat (the carrying capacity). Notice that the map given in Eq. 2 is nonlinear, unlike Eq. 1.

Using MATLAB
1. Make a folder called matlab inside your K: drive (My Documents). 2. Use your browser to go to http://nile.physics.ncsu.edu/hon292a-f08/ 3. Right-click on the les logistic.m and R vs x.m and save them into the matlab folder you created. 4. Start MATLAB from the Novell Applications menu (under the heading Math & Science). 5. A big command window will open, where you can type instructions. 6. Type 1 + 1 and hit the Enter key. Did you get the right answer? Good! Now we can start exploring the logistic map. 7. Enter R = 2.7 8. Enter x = 0.02 This is your initial condition (the same one chosen in the footnote on page 63 of The Buttery Eect.) 9. To generate a new value of x using the logistic map, enter x = R * x * (1-x)

10. Hitting the up arrow key will let you repeat a command you just used. 11. Use this feature to reproduce the numbers from the footnote on page 63 of the reading. 12. This is getting boring ... so lets use the computer to do the rest of the work for us. If you have had trouble using Matlab so far, nows a good time to ask for help ...

Exploring the logistic map

We are now going to use a pre-written set of commands known as a script or a function do these repeated calculations for us. Open the logistic.m le that you downloaded, using the menu items File Open. Now you can type logistic in the command line and hit the Enter key to run this script. Afer a few moments a window will pop up containing a graph which shows all the values of xi up to some maximum number of steps. If you go into the editor window, you can see that logistic.m is set up to use the same values (x = 0.02 and R = 2.7) as in the reading, but you can edit (and Save) the le to use a dierent set of numbers, or to make more steps. Edit the le to allow yourself to explore the following questions with your neighbors, making notes to yourself as you go. 1. What behavior do you see for 0 < R < 1?

2. How do these results depend on the starting value of x?

3. What behavior do you see for 1 < R < 3?

4. How do these results depend on the starting value of x?

5. Make a prediction/generalization: draw an approximate plot of what the nal x will be as a function of R.

6. What behavior do you see for 3 < R < 3.4? 5

7. How do these results depend on the starting value of x?

8. Describe what living in this habitat would look like if R = 3.2.

9. Try to continue your plot from #5.

Again, we can use a computer to automate what we just saw and plot the results for thousands of values of R rather than just a few. Choosing File Open from the Matlab menu to open the le R vs x.m. Go ahead and run it by typing R vs x at the Matlab command line. Observe that the script will use values from R = 0 to R = 3.4 just as we did above, and will plot every x it calculates (after discarding the transient bit at the beginning.)

10. How well did your hand-drawn plot in #9 do at predicting the full results, as calculated by the computer?

This plot of R vs. xnal is an example of something called a bifurcation diagram. You can think of R as knob that you turn up higher and higher, until the behavior switches to a dierent behavior.

11. What is the biological interpretation of the model results you see plotted on the computer screen?

12. Modify and save R vs x.m so that it plots the results all the way up to R = 3.52. Take a look a the graph (it might be helpful to drag a corner of the Figure to make it big) and make a prediction: If you were to run logistic.m with a value of R = 3.52, what would you expect to observe as the behavior of xnal ?

13. Use logistic.m to test your prediction for R = 3.52.

14. Modify and save R vs x.m so that it plots the results from R = 3.2 to R = 3.99. Take a look a the graph and make a prediction: If you were to run logistic.m with some of these large values of R, what would you expect to observe as the behavior of xnal ? Would this be true for all large R values? You can use the magnifying glass tools (from the top of the plot) to zoom in/out on various regions of the graph.

15. Use logistic.m to test your prediction for some of these large values of R.

16. For a large value of R, does the result depend on the choice of the initial value of x? What if you just change the value of x(1) by 0.1% or even less? The Matlab command hold all will be helpful if you want to put two or more logistic.m plots on top of each other for comparison: e.g. run logistic; edit and Save a new value of x(1); type hold all; run logistic again (and this time it will use the new value of x(1) you typed and plot the results on top of the other one, in a new color.)

Writing Assignment: The Buttery Eect and the Logistic Map

First, if you did not complete the full set of computer activities in the preceeding pages, then return to a Unity computer lab to complete them on your own or with classmates. You will want to refer to these results as you complete the writing assignment. The assignment is to write an approximately 700 word essay (25%) addressing the following question: How do these logistic map activities and results compare and contrast with what Edward Lorenz saw in his climate model, as presented in the reading The Buttery Eect? Your essay will be graded according to the writing rubric (see main class website for a copy), and must include reference to at least the following elements: sensitivity to initial conditions bifurcation deterministic chaotic aperiodic periodic random

Caveats: (1) Not all of these elements necessarily apply to either or both systems, but you must nonetheless refer to them all in your paper. (2) This list is not meant to limit the ideas which could be discussed, only to provide a minimum standard. While you may talk about the topic with your classmates, be sure that any words you write are your own. If you make use of published (library or online) resources in preparing the essay, be sure to provide an appropriately formatted bibliographic citation. You are encouraged to make use of the services of the Writing & Speaking oce of the NCSU Tutorial Center for assistance in preparing this essay. Links to these writing and library resources are available from the main class website.

Due date: Thursday, Sept. 11 at the start of class. See syllabus for late penalties. Format: Double-spaced in a 12-point, readable font (700 words should be approximately 3 pages), labeled with the title The Buttery Eect and the Logistic Map, your name, and the date. An emailed electronic copy (PDF preferred if you want to be certain I can read it) or a paper copy are both acceptable.

You might also like