Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The population growth of a particular animal can be modelled using the following recurrence relation: +1=(1)xn+1=rxn(1xn) The population is measured as a proportion of the

The population growth of a particular animal can be modelled using the following recurrence relation:

+1=(1)xn+1=rxn(1xn)

The population is measured as a proportion of the maximum sustainable population, given the resources available. xrepresents the proportion, and n represents the year.

For example, in year 0 if the maximum possible population was 1,000 and the current population was 500, then 0x0 would be 0.5.

r represents the rate at which the population grows.

There are two restrictions:

0x0 must be between 0 and 1 (exclusive).

r must be greater than 1.

An example of the population growing over time could look like this, where the population at 0x0 is 0.7 of its maximum potential size, and r = 1.8. All numbers are rounded to 5 decimal places.

Year

Formula

Resultant population (+1xn+1)

0x0

n/a

0.7

1x1

1.8 0.7 (10.7)

0.378

2x2

1.8 0.378 (1-0.378)

0.42321

3x3

1.8 0.42321 (1-0.42321)

0.43939

4x4

1.8 0.43939 (1-0.43939)

0.44339

5x5

1.8 0.44339 (1-0.44339)

0.44423

6x6

1.8 0.44423 (1-0.44423)

0.4444

7x7

1.8 0.4444 (1-0.4444)

0.44444

8x8

1.8 0.44444 (1-0.44444)

0.44444

You can see from the table above that when rounded to 5 decimal places, x will reach a limiting value where =+1xn=xn+1and will remain stable. This will remain true as long as 0x0 is between 0 and 1 (exclusive), and r is between 1.0 and 3.1 (exclusive).

Edit Metadata

Q2(a) (7 marks)

Write a problem definition for a recursive function population that will accept an input population proportion, x_in, and a growth rate, r, and returns the stable population proportion, x_out. You should include preconditions to ensure that a stable population is attainable.

Edit Metadata

Function: population Inputs: Preconditions: Output: Postconditions:

Q2(b) (8 marks)

Write a recursive function, population, that returns the base value of x, accurate to 5 decimal places, when given appropriate values for r and x_in. The test code below will test your code with x_in=0.7 and r=1.8.

Your function should match your function definition from Q2(a).

# Write your code here

# Tests

%run -i m269_util

test_table = [["x=0.7, r=1.8",0.7,1.8,0.44444]]

test(population,test_table)

Q2(c) (8 marks)

At the start of Question 2, we mentioned that r needs to be kept between 1.0 and 3.1 (exclusive) to maintain a stable population. When a period r of 3.1 is used, the population proportion converges to two alternating values. Using x = 0.7and r = 3.1, for example, the resulting population proportions will alternate between 0.55802 and 0.76456 (your values may vary by 0.00001 depending on the method used). As the population alternates between two values, we call this a period-2 (2121) solution. At higher values of r, we get a period-4 (2222) solution (where the population converges to a sequence of four values repeated), then a period-8 (2323) solution, and so on. This is known as the periodicity. When r reaches 3.7, there is no periodic behaviour: it is described as chaotic.

Outline in English how you could use a divide-and-conquer technique to identify the lowest value of r (to 4 decimal places) that leads to a periodicity of 22y where y is defined by the user. An outline in English should not be program code or pseudo-code; see Section 6.4.1 for further guidance on outlining algorithms in English. Not using an English outline will lead to marks being deducted.

You may assume that:

You have a function, calculate_periodicity(), which is passed a value r and returns the periodicity.

Solutions of increasing periods occur in increasing order as r increases between 3.1 and 3.7, so at some value of r the periodicity will stop returning 22n and will start returning 2+12n+1. At this point there will be no return to 22n.

Your solution should return -1 if the given periodicity is not identified within the restrictions given.

Q2(d) (2 marks)

The divide-and-conquer technique relies on the fact that periodicity increases along with r, and once a particular periodicity has been reached we know a lower periodicity will not be seen again. For example, once a period-8 solution is reached, we know there will be no more period-4 solutions.

Explain how the solution you described in part (c) would need to be changed if this was not the case; you do not need to re-write your solution, just describe the changes.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Azure Analytics is a suite made up of which three tools?

Answered: 1 week ago

Question

Consistently develop management talent.

Answered: 1 week ago

Question

Create a refreshed and common vision and values across Europe.

Answered: 1 week ago

Question

Provide the best employee relations environment.

Answered: 1 week ago