Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Python Expert

Practical Computing for Scientists Assignment -

Object-oriented programming and Individual-based Simulation Models: Lotka-Volterra Predator-Prey Interactions

As we have been working on in class, individual-based simulation models are powerful tools for exploring all kinds of hypotheses about how natural systems function. In order to use these tools, however, you must understand how object-oriented programming works and how programs can be written to "model" natural systems. In class, we worked on a single organism population model, but now we will progress to one in which we will examine a more complicated dynamic.

Predator-Prey interactions have been an important areas of research in the field of Population Ecology for a long-time and one of the classic examples in this field are Predator- Prey interactions as described by Lotka-Volterra equations. The Lotka-Volterra equations were analytical solutions (partial differential equations) derived to describe a system where there existed only two populations of species, a predator and a prey species:

438_figure.png

where x is the number of prey (for example, rabbits); y is the number of some predator (for example, foxes); dy/dt and dx/dt represent the growth rates of the two populations over time; t represents time; and α, β, γ, δ are positive real parameters describing the interaction of the two species. Overall, these equations yield the following dynamic of a harmonic relationship between the two species:

176_figure1.png

For your assignment, you will be altering a provided "population" Python script similar to one we worked on in class to re-create this dynamic, but from an individual-based modeling perspective. There are two options you will have to set when running the program: 1) where to do a parameterization run or not ('Y' or 'N'); 2) how many iterations to run on the model. To complete this assignment, do the following:

1) Add a "Predator" class (called "Predator") to the population.assignment.py script. It must have variables for "age" and "offspring" that are initially equal to zero, a method called "reproduce" that changes the number of offspring each Predator has to 2, and a method called "changeAge" that changes a Predator's age to increase by 1.

2) Fill in all the blank comments throughout the program. These are lines with only a "#" on them. Explain what is the purpose/action of the code following each of these "#"s. FYI: "pop" method for lists removes an item from the end of the list each time it is called.

3) Add code to use the matplotlib package to create a single line plot with two line for lists that track the Prey and Predadator populations, respectively. Run the program with parameterization turned off ('N') and 1 iteration. You should see Lotka-Volterra-like behavior.

4) Change the line of code that is currently shown as:

if(PreyPop[i].age>=PreyAgeReprod and len(PreyPop) < Q ):

to

if(PreyPop[i].age>=PreyAgeReprod):

Create a line plot from the results. Compare it to the previous line plot. How are the two plots different? What is the role of the variable "Q"? Do the Lotka-Volterra equations from the introduction have variable "Q"? Which model to you think is more realistic and why?

5) Models are great for figuring out what values are reasonable for variable you might be interested in knowing about if you trust your model. For instance, say you were going to allow hunting on foxes, how much mortality would you be able to tolerate from hunting mortality? To figure this out, we can use a simple model "parameterization" method. The basic process is to propose a random value for mortality and then test to see if the model is viable under this new parameter. You will notice there is a "Parameterization run" as a raw input switch in the code.

Change the model code back to what it was before you changed it in Part 4. Run the code and turn it on (answer 'Y' to 'Parameterization run?' question) and set number of iteration for the model to 10,000. This will take some time to run.

To parameterize this model for the hunting of foxes, you have changed the model to one that includes mortality due to hunting on the "fox" predators. It also changes the model so that it will only consider a value hunting mortality rate as viable if as the population stays above at least 20 individuals, which we will assume to be the minimum number of foxes to allow the population to persist.

This parameterization run will output a frequency histogram for viable values for hunting mortality that allow fox population to cycle for the 50 years of the model and have a final population greater than 20.

Describe precisely how the probability of foxes dying from hunting (i.e. HuntMortRate) is being generated and examine the output by generating a frequency histogram of the data. Examine the resulting histogram and report what is reasonable rate of harvesting for foxes that allows for population persistence and what ranges are likely to drive the species to extinction?

Attachment:- Assignment Files.rar

Python, Programming

  • Category:- Python
  • Reference No.:- M92765701

Have any Question?


Related Questions in Python

Show times in tmus and seconds1 an associate grasps an oven

Show times in TMUs and seconds. 1. An associate grasps an oven door within reach and pulls it open 18 inches with the left hand (he does not relinquish control of the door). With a pan in the right hand, he carefully pos ...

Sieve of eratosthenes in pythonthe goal is to find all the

Sieve of Eratosthenes (in Python) The goal is to find all the prime numbers less than or equal to some natural number maxn. We have a list that tells us if any of the numbers 0..maxn are "marked". It can be an array of b ...

Question research pythons dictionary data type dictdiscuss

Question : Research Python's dictionary data type (dict). Discuss its interface and usage. Include examples. Discuss practical applications of dictionaries.

Simple python traffic lightswrite a program that simulates

Simple Python (Traffic lights) Write a program that simulates a traffic light. The program lets the user select one of three lights: red, yellow, or green. When a radio button is selected, the light is turned on, and onl ...

A software company sells a package that retails for 99

A software company sells a package that retails for $99. Quantity discounts are given according to the following table: Quantity Discount 10 - 19 20% 20 - 49 30% 50 - 99 40% 100 or more 50% Write a program using python t ...

Below zero - ice cream storethe local ice-cream store needs

Below Zero - ice cream store The local ice-cream store needs a new ordering system to improve customer service by streamlining the ordering process. The manager of the store has found that many orders are incorrect and s ...

Foundations of programming assignment - feduni bankingthis

Foundations of Programming Assignment - FedUni Banking This assignment will test your skills in designing and programming applications to specification. Assignment Overview - You are tasked with creating an application t ...

Quesiton write a python script that counts occurrences of

Quesiton: Write a python script that counts occurrences of words in a file. • The script expects two command-line arguments: the name of an input file and a threshold (an integer). Here is an example of how to run the sc ...

Tasksdemonstrate data scraping of a social network of

Tasks Demonstrate data scraping of a social network of choice. Develop technical documentation, including the development of the code & detailing the results. Provide a report on the findings, that includes research into ...

Part i the assignment filesone of the most important

Part I: The Assignment Files One of the most important outcomes of this assignment is that you understand the importance of testing. This assignment will follow an iterative development cycle. That means you will write a ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As