Matlab

profileYhtomit
44983063_mme2_sp5_2014_leslie_1.pdf

Mathematical Methods for Engineers 2 (MATH1064)

Leslie matrix Matlab group project

Due no later than 2 pm on Friday 10th October, 2014

Graduate Qualities: This project is designed to help the student achieve course objective 4: solve simple applied problems using software such as Matlab , and to develop Graduate Qualities 1 & 3, namely operating effectively with and upon a body of knowledge, and effective problem solving.

Assessment:

The assessment will take into account all of your documentation of the mathematical analysis of the problem, your Matlab m-file(s), your Matlab output, the correctness of the final solutions and the presentation of your whole report.

Groups should contain two or three people. It will be assumed that each member of the team contributed equally and will be awarded individually the mark allocated to the report. If this is not the case, then a lesser percentage for one or more members must be agreed by the team and clearly indicated. This especially will apply to absences from the practical class or non-attendance at agreed team meetings. The University policy on plagiarism will apply between different groups. Students who wish to can submit a peer assessment form which can be found on the course webpage.

How to divide the work: Each team member must participate in all aspects of the project: math- ematical calculations, Matlab work and report writing.

Only one copy of your project report is required for each group.

Summary: In this project you will:

• Investigate the Leslie matrix model for a population

• Explain how a Leslie matrix can be used to calculate the population in each age class from time to time

• Use Matlab to draw plots of age class populations evolving over time

• Use Matlab to study the long term behaviour of population numbers

Your report must be typed, and submitted through LearnOnline by one member of your group. It should include:

• Written worked answers to all questions where this is required.

• Appropriately labeled figures where required.

• A listing of your Matlab script file should be included at the end of your report in an appendix.

• A coversheet is not needed but your report must have a title page that lists the names and student identification numbers of all members of the group.

• The group’s .m file must be submitted as a saparate file via LearnOnline. Be sure to list all group members at the top of the file; only one copy per group is required. There will be marks awarded for submitting this file, so don’t forget. Your .m file may be run and checked during the marking process.

1

Leslie Matrix Model

Invented by Patrick H. Leslie in the 1940s, the Leslie Matrix is a mathematical model of population growth for a species. Time is divided into discrete periods, with individual memebers of the population progressing through discrete age classes at given survival rates. Here is a simplified example:

The Central Australian Budgericoot (CAB) cannot live beyond five years of age. We shall discretise time into years, and we shall count the number of CABs in each of the 5 possible age classes at the start of each year.

Only 80% survive the first year after birth. Of those that survive the first year, only 50% live for another year and enter their third year of life. Of those, 40% survive the next year, and of those, 25% make it into their fifth year, but none ever reach their fifth birthday at the end of that year. (This means that only 0.80× 0.50× 0.40× 0.25 = 0.04 = 4%, on average, live beyond four years.)

This gives a survival rates array

p = [0.80 0.50 0.40 0.25 0.00] = [p1 p2 p3 p4 p5].

The sustainability of a species depends not only upon survival rates, but also on the birthrate of females of the species. Suppose that female CABs cannot give birth during their first two years or during their fifth year, should they live that long. On average, a female of this species in her third year can produce 2 female offspring, while in her fourth year on average a female produces 1.5 female offspring. This gives an average fertility array

f = [0 0 2 1.5 0] = [f1 f2 f3 f4 f5].

This information may be assembled into the Leslie matrix for this species:

A =

 0 0 2 1.5 0

0.8 0 0 0 0 0 0.5 0 0 0 0 0 0.4 0 0 0 0 0 0.25 0

 .

The matrix is all zeros except for the fertility vector across the top row, and the survival rates situated below the leading diagonal.

Suppose that an investigator starts monitoring the female CABs in a particular area in a given year. At that time, there are 100 females between birth and their first birthday, another 100 females in their second year of life, another 40 females in their third year, 40 females in their fourth year, and 20 females that have survived until their last possible year. Thus the total female population is 300. The female population can be represented by the initial age population vector y(in year k = 1 of the investigation) whose elements are the numbers of females in each of the age classes (in this case five age classes).

y(1) =

 100 100 40 40 20

 .

In general, the population in age class j in the time period k + 1 is given by

yj(k + 1) = pj−1yj−1(k), where j = 2, 3, . . . , n,

since the population in age class j comes from survivors of the population in age class j − 1 in the previous time period k. The population in the age class 1 (newborns) in time period k + 1 should

2

be considered separately, since it arises only by birth from the population of other age classes in the previous time period. In the case of n age classes,

y1(k + 1) = f1y1(k) + f2y2(k) + . . .+ fnyn(k),

where f is the average fertility array as in the example above. If we define the population vector at time period k as

y(k) =

 y1(k) y2(k)

... yn(k)

 . then the above equations defining population at time period k + 1 can be written as

y(k + 1) = Ay(k),

where matrix A is the Leslie Matrix defined in the example above.

Typically, in a Leslie model, the numbers in the various age classes, and the total population itself, exhibit fluctuations until transient effects disappear. After a sufficiently long time, the population changes at a rate r. If r > 1, the population eventually increases. If r < 1, the population eventually decreases and the species is in danger of extinction. After many time periods, once the initial transient effects are no longer relevant, it can be shown that the proportion of the total population in each of the age classes tends to become constant, irrespective of whether the population is increasing or decreasing.

The Project

1. Without using a computer, calculate y(2) = Ay(1) and y(3) = Ay(2). By referring to the individual steps in these matrix multiplications, explain carefully what these represent.

What is the expected total female population in year 2, and in year 3?

What is meant by y(k) = Ak−1y(1)?

2. The first Matlab section of the project will require one long script M-file leslie.m.

(a) In leslie.m, enter p, f , and y(1), using y1 to represent y(1). Find the length n of f (which is the number of age classes in the female population under review), and then introduce an n× n matrix A of zeros. Find simple ways of inserting the elements of p and f to get the correct Leslie matrix A. Check your answers for y(2) and y(3).

(b) Add the following statements, and fill in a suitable legend:

y=y1;

M=[y];

for i=1:29

y=A*y;

M=[M,y];

end

plot(M’)

hold on

legend( )

xlabel(’time in years’)

ylabel(’number predicted in each age group’)

title(’predicted populations in the five age groups over 30 years’)

hold off

3

In your report, you must include a section that explains exactly what the for loop accom- plishes, and how this different use of the plot command works.

(c) For year 30 (29 years after the study begins), use the Matlab sum function to find the expected total size of the female population, as well as the relative distribution within the n age groups (i.e. the proportion in each age group).

(d) Draw a plot (as above) of the populations within the age groups for years 1 to 100 and comment.

3. (a) Show that y(k) = xi(λi) k−1 is a solution of y(k + 1) = Ay(k), where λi and xi are the i

th

eigenvalue and a corresponding eigenvector, respectively, of the matrix A.

(b) Assume that the real eigenvalues are ranked in the order λ1 > λ2 > · · · > λm. In this case λ1 is called the dominant eigenvalue of the matrix A. When the time period k becomes sufficiently large, that is, when k → ∞, the behaviour of the population vector y(k) is determined by the term with the dominant eigenvalue λ1, while the other terms are much smaller. It can be shown that

y(k) ∼ C1x1λk−11 when k →∞

or in other words

lim k→∞

1

C1λ k−1 1

y(k) = x1.

Use Matlab to find y(100) and y(101), and calculate yj(101)

yj(100) for j = 1, 2, 3, 4, 5. Compare

these five ratios with each other and with λ1 for matrix A.

Find the the proportions of the total population for each of the n age classes for k = 100 and k = 101 and compare.

What do you think is the value of r for this population?

4. In the fertility rate array f , suppose that f4 is changed from 1.5 to 1.0. Repeat 2 parts (b)-(d) above, with suitable comments. Find the value of r in this case.

4

5. The aphid midge, Aphidoletes aphidimiza, is a type of small fly whose larvae are very effective predators of aphids, and are actually used for biological control of aphids. You can read about the important aphid midge at the Cornell University Biological Control site:

http://www.biocontrol.entomology.cornell.edu/predators/Aphidoletes.php

The midge can be introduced to help control aphid infestations. It is an alternative to the use of poison sprays. For this exercise, assume the aphid midge does not survive more than 23 days from the laying of its egg, and that the life table of the aphid midge is the following:

Age Stage Numbers Eggs laid (days) per female

0 egg 1000 0 1 egg 1000 0 2 larva 700 0 3 larva 650 0 4 larva 600 0 5 larva 550 0 6 larva 530 0 7 cocoon 400 0 8 cocoon 400 0 9 cocoon 400 0

10 cocoon 400 0 11 cocoon 400 0 12 cocoon 400 0 13 adult midge 350 5 14 adult midge 340 15 15 adult midge 330 20 16 adult midge 300 20 17 adult midge 260 15 18 adult midge 200 12 19 adult midge 120 8 20 adult midge 40 5 21 adult midge 20 2 22 adult midge 5 0

Hence, there are 23 age classes, and so the Leslie matrix A will be 23 × 23. Because it is impossible to differentiate the sexes at each stage, you should assume the population is equally divided between males and females, which is in any case quite accurate. In this exercise, you will be monitoring the size of the whole population, not just females. Hence, in finding f and A, you will need to consider that only half the population is laying the given number of eggs per individual.

Suppose that an aphid outbreak has occurred, and that 100 midge cocoons, at the 10 day stage, are introduced to the area on day 1 of the trial. Make adjustments to your previous code to accomplish the following:

(a) Create appropriate p, f and y(1) arrays, and then generate the Leslie matrix. Run the trial for a further twenty one days, to generate a 23× 22 matrix M .

(b) Create a plot (similar to that in Question 2), with four graphs on it, representing the total numbers of eggs, larvae, cocoons and adult midges over the 22 days of the trial. This should be accomplished by using the Matlab sum command on sub-matrices of M to produce a new 4× 22 matrix, prior to plotting. Make sure you include a suitable legend.

(c) Suppose the trial continues for years. Find the expected proportions in each of the 23 age classes on days 900 and 950. Find the value of r for aphid midges and eigenvalues of the corresponding Leslie matrix, and comment.

5