Math 232 – Computing Assignment 3
Due Date: November 18th, at 11:00pm.
You must upload to Crowdmark both your code (as a .pdf file) (to Code - Computing Assignment
3) and your report (to Report - Computing Assignment 3). The assignment is due at 11:00pm.
If Crowdmark indicates that you submitted late, you will be given 0 on the assignment. You
computing report must be exactly 1 page. There will be a penalty given if your report is longe
than one page.
• Please read the Guidelines for Computing Assignments in Canvas first.
• Keep in mind that Canvas discussions are open forums.
• Acknowledge any collaborations and assistance from colleagues/TAs/instructor.
Programming Preamble:
Matlab: You need to be able to enter column vectors and matrices.
Matlab: You need to be able to multiply a matrix by a vector.
Matlab: You need to be able to draw lines on the same figure.
Matlab: help plot gives you all the information you need to make your plots look good - labelling
the axes, putting on a title etc.
Matlab: Use a for loop (see Matlab documentation) to repeatedly multiply your age distribution
vector x⃗t by your transition matrix A for a specified number of times. This little bit of script could
e modified for this purpose;
y=x1;
for i=1:10
y2=A*y;
XX(:,i)=y2;
y=y2;
end
Here, the matrix XX stores the vectors y2 that are iterates of the vector x1 as its columns, and
these columns can be plotted individually.
Computing Assignment
Required submission: 1 page PDF report and Matlab or Python code (.m or .py respectively,
exported as a .pdf) uploaded to Canvas.
Population Dynamics
This assignment is designed to show you a basic model used to describe and predict population
dynamics. Please read pages XXXXXXXXXXof the secondary textbook (Boyd and Vandenberghe, available
as a .pdf from Canvas).
1
These websites may be useful to refer to while working on this assignment;
Age distribution in Canada;
https:
www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid= XXXXXXXXXX
https:
www.statista.com/statistics/266540/age-distribution-in-canada
Birth rates Canada;
https:
www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid= XXXXXXXXXX
Death rates;
https:
www150.statcan.gc.ca/n1/pu
71-607-x/71-607-x XXXXXXXXXXeng.htm
Projections of population in Canada;
https:
www150.statcan.gc.ca/n1/pu
71-607-x/71-607-x XXXXXXXXXXeng.htm
Let x⃗t, (x⃗t)i = number of people in Canada with age i − 1 in year t (say, on Jan 1 of that year),
i = 1, . . . , 100, where t = 0 denotes the year 2000.
The birth rate is given by a vector b⃗, (⃗b)i, i = 1, . . . , 100.
The death rate is given by a vector d⃗, (d⃗)i, i = 1, . . . , 100.
1. Find age distribution, birth rate, and death rates for Canada (like Figures XXXXXXXXXXin the
ook by Boyd and Vandenberghe are for the US) by utilizing the internet.
2. Formulate a discrete dynamical model as described in those pages from the book by Boyd
and Vandenberghe. In particular, make sure you specify your transition matrix in the cases
elow.
3. From your model, make plots of the age distribution in Canada for the years 2028, 2033, and
2038 (5, 10, and 15 years from now), similar to Figure XXXXXXXXXXplots on one graph, different
colours each). For example, the following piece of code can be modified for this;
plot(XX(:,1),’b-’)
hold on
plot(XX(:,5),’r-’)
hold on
plot(XX(:,9),’k-’)
(with axis and lines suitably labeled)
4. Now make a modification of your model (i.e., the transition matrix A) incorporating immi-
gration. Make a simple assumption of what the average immigration rate is per year based
on data you find on the web (for example, immigration could only affect the population dis-
tributions of people between the ages of 20 and 40). Plot again the predicted population
distribution for Canada for the years 2028, 2033, and 2038 from this new model.
5. What other factors do you think would make this model more realistic or more accurate?
2