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 add ded at the end of a given word

Write a Python program to add 'ded' at the end of a given word (length should be at least 3). If the given string already end with ‘ded' then add ‘ing' instead.

  A stack data structure that uses a linked list for storing

In Python, implement a stack data structure that uses a linked list for storing its elements. In particular, you will need to implement the following three functions: 1. top(): This function returns the element that is at the top of the stack, but it..

  Write a program that asks for the users age

Write a program that asks for the user's age. Based on their response print "You can vote" (18 years old or older) or "You can't vote" and also whether or not he/she is a senior citizen (over 64). If senior citizen print "You're a Senior Citizen.

  Design flowchart that ask actual value of piece of property

Design a flowchart and Python code that ask for the actual value of a piece of property and displays the assessment value and the property tax.

  Evaluate a user''s expression

Write a function that will evaluate a user's expression. It should call the getExpression function that you previously wrote to get the expression to evaluate from the user. You should evaluate the expression step-by-step.

  Modify your code to ask the user for the id of a restaurant

Copy check1.py to check2.py and continue to work on check2.py. Modify your code to ask the user for the id of a restaurant between 1 and 155 (humans don't need to know about list ids starting at 0).

  Exploring the potential of natural language processing

For Reading Purposes. EXPLORING THE POTENTIAL OF NATURAL LANGUAGE PROCESSING AND MACHINE LEARNING IN CHILD LANGUAGE DISORDERS DIAGNOSIS, Preprocessing data from conti-4 : cleaning the raw dataset into structured form for subsequent processing and ana..

  The block of statements below the line of stars

The block of statements below the line of stars is where I need help correcting. The true line that needs to be corrected is p = add((getX(k),getY(r))), it needs to give points of the path using the block of information. I have somthing which I kn..

  Write a modularized body mass index program

Write a modularized Body Mass Index (BMI) Program which will calculate the BMI of a team player. The formula to calculate the BMI is as follows: BMI = Weight *703 / Height^2.

  Produce the simulation of the orbits of the planets

Need to produce a code with object oriented programming using python, which will produce the simulation of the orbits of the planets around the sun

  Develop python script that will implement the given command

Write a python script that will implement the following command: merge sourcedirectory1 sourcedirectory2 destinationdirectory

  Whatever is done in excel you have to do it in python

Whatever is done in excel you have to do it in python. Like you have to categorize the tweets related to app and other. It should be done by using pandas

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