Computer Science 101 Project 2: Predator Prey Model Real-life situations usually are complicated and difficult to model exactly because of the large number of variables present in real systems. Computer models generally simplify the system or process being studied by including only the variables that constitute its essence and neglecting the rest. We will do this for a particular type of system, called a predator-prey system. A. Understanding the System The The first step in developing a computer model is to understand the system well. In this case, our system is one in which there are two types of organisms involved. The prey, which serves as food for the predator. The prey also relies on the predator for population control The predator, which has the prey as its main food source. The predator relies on prey being present, because if the prey dies out the predator doesn t have another source of food. Our interest is in developing a model of how the populations of such a system will vary over time. We hope that the model s predictions will give us some insight into several research questions: How will the populations change with time? Is there any relationship between the sizes of the populations as they change? Do the initial sizes of the populations have any bearing on their subsequent behavior? How do the birth and death rates of the species affect the population dynamics? B. Simplifying Assumptions The second step in developing a computer model is to choose the most important features of the system in order to simplify it, while still retaining its essence. We will consider a simplified case of an island occupied only by rabbits and foxes. Our assumptions will be the following: The island furnishes more than enough food to feed the rabbits. The only way the rabbits die is being eaten by foxes. The foxes only eat rabbits The foxes die only of natural causes. Admittedly these assumptions are only an approximation, but we think that they do capture the essence of the system in which we are interested and that they may help us understand how such a system behaves. 1
C. Symbolic/Mathematical Equations The next step is to express the simplified features of the system symbolically as mathematical equations. We will look at the populations of rabbits and foxes at different times. At each time interval we will make the following assumptions: The number of rabbits is equal to: o the number of rabbits in the previous time interval o plus the number of rabbits born o minus the number of rabbits eaten by the foxes. The number of foxes is equal to: o the number of foxes at the previous time interval o minus the number of foxes that die o plus the number of extra foxes born because there are enough rabbits available as food. We can write this symbolically in terms of mathematical equations: R(t) = # rabbits at time t R(t+1) = # rabbits at the following time t+1 F(t) = # foxes at time t F(t+1) = # foxes at the following time t+1 B = rabbit birth rate D = fox death rate L = rate of rabbit loss due to foxes eating them G = rate of gain in foxes due to eating rabbits R(t+1) = R(t) + B*R(t) L*R(t)*F(t) F(t+1) = F(t) D*F(t) + G*R(t)*F(t) * means multiply For example, suppose that the values are the following: R(t) = 200 F(t) = 50 B =.07 D =.05 L =.0007 G =.0002 Then the number of rabbits and foxes at the next time interval would be the following: R(t+1) = 200 + (.07)*(200) (.0007)*(200)*(50) = 200 + 14 7 = 207 F(t+1) = 50 (.05)*(50) + (.0002)*(200)*(50) = 50 2.5 + 2 = 49.5 Don t worry about the fractional foxes. This is just a model. 2
D. The Algorithm As well as the sequence of operations defined by the mathematical equations above, the algorithm for their solution also needs some other things: Input: six values are necessary as input for our model o The initial number of rabbits o The initial number of foxes o The rabbit birth rate (B) o The fox death rate (D) o The rate of loss of rabbits due to foxes eating them (L) o The rate of gain in foxes due to them eating the rabbits (G) When to Stop o Stop when the time t = 1000 Output o The output will be the number of rabbits and foxes at each time from 1 to 1000. o We will display the output with an Excel spreadsheet printout like the below. 3
E. The Calculations The next step is to do the algorithmic calculations using a computer. This will be your second project. F. Your Project Working independently, you should design a spreadsheet for this model. The upper part of the spreadsheet should look like the picture below. 4
Information about the spreadsheet is given below. Send this spreadsheet to me as an email attachment. I will grade the spreadsheet file and do not want a printed version. 1. The column width of columns A through K should be 11. 2. All fonts are 10 pt Arial, with the following exceptions a. The title is 14 pt and in bold b. Rows 3 through 9 are in 11 pt. The titles in row 3 are in bold c. Row 12 is in bold 3. Merge the cells required to make the Input and Model tables look like the picture on page 4. 4. Some of the cells have been shaded light gray. 5. Borders a. Add thin and thick borders as shown in the picture on page 4. 6. Text a. See the picture on page 4. 7. Put a function in cell E1 so that it will display today s date. Format the date as shown in the picture on page 4. 8. Cells E4 through E9 hold the values of the input variables a. Enter the values shown in the picture on page 4 9. The times are in cells A13 through A1013. a. Enter the number 0 in cell A13 b. Put a formula in cell A14 that adds 1 to the value in cell A13 c. Copy cell A14 and then paste it into cells A15 through A1013 10. Put a formula in cell B13 setting it equal to the value in cell E4 11. Put a formula in cell C13 setting it equal to the value in cell E5 12. Put a formula in cell B14 that does a calculation matching the algebraic equation shown below: a. R(t) + B*R(t) L*R(t)*F(t) b. R(t) is in cell B13 c. F(t) is in cell C13 d. B is in cell E6 e. L is in cell E8 f. HINT: Use absolute references when writing this formula. We will copy and paste it into other cells and don t want the values of B or L to change. 5
13. Put a formula in cell C14 that does a calculation matching the algebraic equation shown below: a. F(t) - D*F(t) + G*R(t)*F(t) b. R(t) is in cell B13 c. F(t) is in cell C13 d. D is in cell E7 e. G is in cell E9 f. HINT: Use absolute references when writing this formula. We will copy and paste it into other cells and don t the values of D or G to change. 14. Put a formula in cell D13 and E13 calculating the percents of rabbits and foxes relative to the initial numbers of rabbits and foxes respectively. a. Use absolute references when writing the formulas in cells D13 and E13 15. Copy cells B14 and C14 and paste them into the block between cells B15 and C1013 16. Copy cells D13 and E13, and paste then into the block between cells D14 and E1013 17. Format and position the numbers as shown in the picture on page 4. 18. Create the line chart that is shown in the picture on page 4. (You will need to figure out how to format the values on the x-axis.) 19. The worksheet tab should have the name Predator-Prey. 20. Add a Footer so the printed version of the spreadsheet will look like the picture on page 3. (Use Print Preview!) 21. You may need to change the page margins to fit everything into the printed page. 22. Save the sheet with the name LastName_FirstName_PP. An example would be Whisnant_David_PP. 23. Send the file to me as an email attachment by April 22. 6
G. Experimenting with the Model: Research Questions We will use the model to give us some insight about an actual predator-prey system. Use the model as a guide to try to understand and make predictions about the actual system. To help answer most of the questions below, observe the predictions of the model for values in these ranges: Initial # rabbits (R): between 50 and 200 Initial # foxes (F): between 50 and 200 Rabbit birth rate (B): between.04 and.07 Fox death rate (D:) between.04 and.07 Rate of loss of rabbits from being eaten (L): equal to.0007 Rate of gain of foxes from eating the rabbits (G): equal to.0002 Consider these questions: The model may suggest how the populations of rabbits and foxes will vary with time. o Question 1: What does the model predict about how the populations will vary over time? o Question 2: Do these predictions make sense? Assuming that the foxes and rabbits live together in an isolated location, such as an island, why might their populations behave like the model suggests? Or why not? The model may suggest how the relative populations of rabbits and foxes compare with each other; o Question 3: In the model, is one population (rabbits or foxes) always larger or smaller than the other? o Question 4: Does this prediction make sense? Why might the populations behave like the model suggests? Or why not? o Question 5: What does this have to do with a concept from Ecology called the Ecological Pyramid? The initial populations may have an effect on subsequent population sizes o Question 6: In the model, how does the initial size of the rabbit population affect the sizes of the rabbit and fox populations at later times? o Question 7: Does this prediction make sense? Why might the populations behave like the model suggests? Or why not? o Question 8: In the model, how does the initial size of the fox population affect the sizes of the rabbit and fox populations at later times? o Question 9: Does this prediction make sense? Why might the populations behave like the model suggests? Or why not? The model may suggest what would happen if there were only rabbits, and no foxes, on the island. Use an initial # foxes (F) equal 0 for this question. o Question 10: In the model, what do you observe when there are no foxes present (initial F = 0)? o Question 11: Does this prediction make sense for a real system? Why or why not. 7
The model may suggest what would happen if there were only foxes, and no rabbits, on the island. Use an initial # rabbits (R) equal 0 for this question. o Question 12: In the model, what do you observe when there are no rabbits present (initial R = 0)? o Question 13: Does this prediction make sense for a real system? Why or why not? The model may suggest how the birth rate of the rabbits will affect the populations. o Question 14: In the model, how does the birth rate of the rabbits (B) affect the populations of foxes and rabbits? o Question 15: Does this prediction make sense for a real system? Why or why not? The model may suggest how the death rate of the foxes will affect the populations. o Question 16: In the model, how does the death rate of the foxes (D) affect the populations of foxes and rabbits? o Question 17: Does this prediction make sense for a real system? Why or why not? The model may suggest what will happen if one of the species dies out. Assume that a population value less than 0.5 is essentially zero. o Question 18: In the model, there are several initial conditions for which the rabbit or fox populations drop to below 0.5 at some later time. What do you observe happening to this population after it has dropped below 0.5? Does it remain at zero? o Question 19: Does this prediction make sense for a real system? Why or why not? We need to think about the assumptions we have made for our model (see the first page of this handout). o Question 20: How could we improve our assumptions so that the model is somewhat more realistic? o More than one person may answer this question. If you have an original contribution to make, you may include it even if someone else also has answered the question. The final step in model building is to compare the model s predictions with experiment. We need to find experimental observations that help evaluate the model. o Question 21: What kind of information can you find on the web or in the Library databases about real systems that may be described by the predator-prey model? What real populations have been studied that may be described by this model? What kind of animals, plants, or other organisms were involved? Where were they located? How well does our model describe the real populations? Include references to the web sites or databases o This is an IMPORTANT question because models must be evaluated by comparison with experiment. o More than one person may answer this question. If you have an original contribution to make, you may include it even if someone else also has answered the question. 8
And finally, o Question 22: Is there anything else you would like to say about the model or its predictions. o More than one person may answer this question. If you have an original contribution to make, you may include it even if someone else also has answered the question. H. Collaborating Using a Wiki The entire class is going to produce a collaborative web document focusing on these research questions. We will use a Wiki to develop the document. Class members are asked to enter answers to the above research questions in the Wiki document. Your entry should not duplicate what someone else already has said. However, you may make a contribution about a research question someone else has answered if you have something different to say, or if you want to make a change in what they have said. You do not need to limit yourself to the research questions if you notice something interesting. The important thing is to make a new and original contribution to the document. By Thursday, April 17 each person should have answered ONE research question in the Wiki document. Please answer only one question to give everyone an opportunity to participate. The only exceptions to this are Questions 20, 21 and 22. Anyone can answer these questions before April 17, even if they have already answered one of the others. When you enter an answer in the wiki, make sure you fill out the Short description of changes: section. (See page 5 of the Using the CS 101 Wiki instructions). As added insurance send me an email message describing what you have done. On April 17, anyone can feel free to make as many more contributions to the Wiki document as they desire. The quality and quantity of your contribution(s) to the Wiki document will influence the grade on the project. Remember that this is a collaborative document, so all members of the class are responsible for ensuring that the information in the document is reliable. We must police the document for errors. If you see a statement that you think is inaccurate, strike through the offending text. (See page 7 of the Using the CS 101 Wiki instructions), and add text you think is more correct. DO NOT DELETE TEXT THAT IS WRONG, JUST STRIKE IT THROUGH. I will be the final arbitrator of disputes all wikis need one. 9
I. Project Grading This project will count 70 points 50 for the spreadsheet and 20 for the wiki. There will be four contributions to the wiki grade: Quantity: How many contributions have you made? o Remember that, until April 17, you may only answer one question. Questions 20, 21, and 22 are exceptions. There probably will be many contributions to these questions and they may be answered before April 17, even if you have answered another. o If someone has already answered a question, but you have something else original to say, you may add it. o Between April 17 and April 25, you may answer as many as you want, as long as your contributions are original. Quality: How useful are your contributions to the discussion? Use of wiki syntax o On pages 6 9 of the Using the CS 101C Wiki handout, I have included instructions on how to use the wiki syntax to add variety and emphasis to text entered in the wiki. Even more information on the syntax of this wiki can be found at the URL below: http://www.wikidot.com/doc:wiki-syntax. o I will look for use of wiki syntax in your answers Overall wiki quality: Does the wiki contain reliable information? Are there errors, inaccuracies, or poor wording present? o It is everyone s responsibility to keep the wiki as reliable as possible. Everyone must police the wiki and correct problems that they see. If you do correct a problem, strike through offending text and then enter your correction. I will be the final arbitrator of what is correct. o A portion of your wiki grade will be an overall class grade. A few points of your grade will depend on the overall quality of the wiki s information. This portion of the grade will be the same for every member of the class. DUE DATES: April 16: Deadline for answering one question on the wiki. Questions 20, 21, and 22 are exceptions. These may be answered any time, even if you have answered another question. April 22: Deadline for sending me the spreadsheet as an email attachment. April 25: Deadline for answering more questions on the wiki. 10