Create a single line plot with two line for lists

Assignment Help Python Programming
Reference no: EM131927042

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

Reference no: EM131927042

Questions Cloud

What is percentage smallest expected loss : What is the percentage smallest expected loss in the coming month with a probability of 2.5 percent?
Describe your own interpersonal and intrapersonal skills : Describe your own interpersonal and intrapersonal skills and how you think these skills transfer to your leadership style in business.
Corporate restructuring produced shareholder value : In in case 21: Mondelez International: Has Corporate Restructuring Produced Shareholder Value?
High quality fish products and dried feline foods : Your family run business, Seafood Treats, has been manufacturing high quality fish products and dried feline foods in Halifax
Create a single line plot with two line for lists : BIO380: Practical Computing for Scientists Assignment - create a single line plot with two line for lists that track the Prey and Predadator populations
Nursing regardless of the level or type of practice : Communication effectiveness is a key factor throughout nursing regardless of the level or type of practice. Select a specific venue where healthcare policy.
Define a payback period : Based on your research and the knowledge you have gained from the course, create a simplified 4- to 5-page financial plan including tables and charts.
Developing an incentive bonus program : Last year, a cooperative developed an incentive bonus program (IBP) to give an incentive to its large customers to buy in quantity.
Choose to either plant corn or soybeans each year : A farmer must choose to either plant corn or soybeans each year. The cost of planting corn is $63,000, and the cost of planting soybeans is $49,000.

Reviews

len1927042

4/4/2018 12:53:57 AM

Subject: Python. Detailed Question: Hi i have an assignment i know it is a rush. Everything you need can be found on the attached file called assignment 4. The other file is the code given that needs to be edited to get the desired outcome for the assignment. Also for each line of code you do can you put what that code well be doing in a comment format. You will need to submit your script and a word file with your line plot, frequency histogram and answers to the questions in part 4 and 5. Make sure you name is in all the files.

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd