Implement an iterative method with a for loop

Assignment Help JAVA Programming
Reference no: EM13738353 , Length: 3

The dynamics between predators and preys in a given ecosystem attracts a lot of attention from researchers. Different scientists have developed Predator-Prey models to try to understand the interactions and foresee the evolution of the populations.

One of the first analyzed Predator-Prey ecosystems was the "Lynx - Snowshoe hare" and one of the first Predator-Prey models defined was the one developed by Lotka and Volterra.

This Predator-Prey model defines:

* H[n] as the snowshoe hare population (being n a specific moment of time)

* L[n] as the lynx population

* It assumes that the primary growth of the hare population in the absence of lynx is a1*H[n] and that the lynx population in the absence of hares declines -b1*L[n]

* It also assumes that the primary loss of snowshoe hares is due to predating -a2*H[n]*L[n] and the growth of the lynx population is from the energy derived from eating snowshoe hares b2*H[n]*L[n]

The Lotka-Volterra model is defined by the following formula:

H[n+1] = H[n] + a1 * H[n] - a2*H[n]*L[n] = H[n] * (1 + a1 - a2*L[n])

L[n+1] = L[n] - b1 * L[n] + b2*H[n]*L[n] = L[n] * (1 - b1 +b2*H[n])

For instance, let's assume that the initial population of snowshoe hares is 300 and the initial population of lynxes is 20, and the values of the constants that regulate the model are a1 = 0.1, a2 = 0.01, b1 = 0.01 and b2 = 0.00002. The previous formula can be used to calculate the population of both lynxes and snowshoe hares after 2 periods:

After 1 period the population of snowshoe hares will be:

H[1] = H[0] + a1 * H[0] - a2*H[0]*L[0] = H[0] * (1 + a1 - a2*L[0]) = 300 *(1 + 0.1 - 0.01*20) = 270

In turn, the population of lynxes will be:

L[1] = L[0] - b1 * L[0] + b2*H[0]*L[0] = L[0] * (1 - b1 +b2*H[0]) = 20 * (1 - 0.01 + 0.00002*300) = 19.92

Notice that we keep the decimals for the following loop in the formula.

After 2 periods, the population of snowshoe hares will be:

H[2] = H[1] * (1 + a1 - a2*L[1]) = 270 * (1 + 0.1 - 0.01*19,92) = 243.216

And the population of lynxes will be:

L[2] = L[1] * (1 - b1 +b2*H[1]) = 19.92 * (1 - 0.01 + 0.00002*270) = 19.828368

If we continue, we can guess the population after 20 periods:

H[20] = 47.15 snowshoe hares

L[20] = 17.28 lynxes

or after 100 periods:

H[100] =8.44 snowshoe hares

L[100] =7.89 lynxes

or even after 200 periods:

H[200] = 903.17 snowshoe hares

L[200] = 3.91 lynxes
-----------------------------------------------------------------------------------------------
The goal of this activity is to: SOLVE THIS PROBLEM PROGRAMMING AN ITERATIVE METHOD
-----------------------------------------------------------------------------------------------

Guidelines for solving the problem:

1) The header of the method should be:

? double[] preyPredLV(double[] preyPred, double[] a, double[] b, int n)

2) The method should have as arguments:

? An array called "preyPred" with 2 doubles:
? The initial population of snowshoe hares, preyPred[0];
? The initial population of lynx, preyPred[1]

? An array called "a" with 2 doubles containing the constants a1 and a2:
? a[0] = a1;
? a[1] = a2;

? An array called "b" with 2 doubles containing the constants b1 and b2:
? b[0] = b1;
? b[1] = b2;

? The number of periods, "n", at which we want to predict the future population of snowshoe hares and lynxes.

3) The method should return the array "preyPred", in a way that it should contain:

? The population of snowshoe hares at the given number of periods "n" (H[n]) in preyPred[0];

? The population of lynxes at the given number of periods "n" (L[n]) in preyPred[1].

4) You can choose to solve this problem using one of the following two possibilities:

? To implement an iterative method with a for loop; or

? To implement an iterative method with a while loop

Reference no: EM13738353

Questions Cloud

Assignment-the strategic plan presentation : Assignment: The Strategic Plan Presentation, The Final Assignment, due in Unit 10, is your chance to bring it all together. This Strategic Management Presentation is an in-depth case study analysis and strategy for the company of your choice
Differences that exist among merit pay systems : Question 1: Explain the similarities and differences that exist among merit pay systems, incentive pay systems, and person-focused pay systems. Of the three of these pay systems, which one would you implement at your company? Explain your choice. ..
What does berkey say is the origin of the abbasid revolution : What does Berkey say is the origin of the Abbasid Revolution and what is its nature? What are the major issues surrounding Islamic identity in the early Abbasid period, according to Berkey?
What was life like in french settlements in north america : What was life like in French settlements in North America?
Implement an iterative method with a for loop : Different scientists have developed Predator-Prey models to try to understand the interactions and foresee the evolution of the populations.
How are the products and advertising programs targeted : How are the products and advertising programs targeted at these two groups different? List five of their favorite products growing up then list five of your favorite products growing up
What is lazarus implying about united states and immigration : What is Lazarus implying about the United States and immigration? Consider American attitudes regarding immigration, as well as immigrant experiences in the late nineteenth and early twentieth centuries.
Analyze impact of moors on spanish history and culture : Analyze the impact of the Moors on Spanish history and culture. What types of innovations, technology, and philosophies did they bring to Spain?
Bargaining power of the multinationals : How have unions responded to multinationals as the bargaining power of the multinationals has grown?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Calculates the area of a triangle

Write a simple Java application which calculates the area of a triangle. Your application should ask the user to enter the base and height values of the triangle.

  Implement 4 sorting algorithms in a java "sort" class.

Implement 4 sorting algorithms in a Java " Sort " class. ( insertion sort, selection sort and quicksort, and mergesort). count the number of comparisons made.

  A class is a blueprint for an object

A class is a blueprint for an object. A class may have a default constructor, a constructor with arguments, accessor methods, mutator methods, public fields, and private fields.

  Multiple choice java programming questions

Determine which of the following may be a violation of information hiding if inserted for the comment above?

  Program produces 1000 integer ranging

Then your program produces 1000 integer ranging from 1to 10000 in the array and then sort them in ascending order and then print the result into data.txt file. (You may list integers separated by space or new line)

  Most of the companies use virtualization to make test

write a 200- to 300-word short-answer response to the following many companies use virtualization to create test

  Prepare a new object of type airconditioner

Prepare a new object of type AirConditioner using the office_a_c reference variable - turn the air conditioner on using the reference to the new object.

  Application for an animal-fur trimming service

Create an application for an animal-fur trimming service. Write the code for the application. Prompt the user to indicate how many animals. Display the total fee for one year. Be pleasant in your output as it will be expensive.

  Write a program that reads a set of floating-point

Write a program that reads a set of floating-point data values from the input.

  Comparator that compares point objects by their distance

write a comparator that compares point objects by their distance from the origin of (0,0). points that are closer to the origin are considered to come before those which are further from the origin

  Functional abstraction

Question 1: What are some of the benefits of modularity? Question 2: What is functional abstraction? Question 3: What is information hiding?

  Write a recursive boolean method named ismember in java

Write a recursive boolean method named isMember in Java. The method should accept three arguments: an array, a value to search for, and the size of the part of the array being searched.

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