Question
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).
Question
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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started