# Miniproject 1
## Overview
In this miniproject you will learn about *Markov chains* and use them to make predictions about long term trends in population growth and US voter activity.
**Prerequisites**: You'll need to know how to multiply a matrix times a vector, both by hand and using SymPy.
**Initial deadline**: *Sunday, February 5 at 11:59pm ET.*. This is the deadline for all *first* drafts of your solution. If you turn in a good-faith effort at a complete and correct solution by this date, you may continue to revise and resubmit as needed with no additional deadlines, until the final deadline of 11:59pm ET Sunday April 16. However, no *first* drafts will be accepted after the initial deadline.
## Background
Complete the following before beginning this miniproject. These are not to be turned in! But you won't get far on the assignment without doing them.
- Read Section 1.3.1 (Markov chains: An application of matrix-vector multiplication) on pages 26--28 in the textbook and work through the examples shown.
- If needed, [watch the tutorial video where I walk through Example 1.3.3](https://gvsu.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=97c3c6f8-d68e-461c-ac95-af72010dec46). This also shows how to use SymPy to do some of the math.
- Practice with SymPy by using it to work Exercises 1-4 on page 29.
## Assignment
1. (Exercise 26) Suppose that for a large population that stays relatively constant (that is, there are no population explosions or mass migrations), people are classified as living in urban, suburban, or rural settings. Moreover, assume that the probabilities of the various possible transitions are given by the following rule:
| Future location / current location | U (%) | S (%) | R (%) |
| ---------------------------------- | ----- | ----- | ----- |
| Urban | 92 | 3 | 2 |
| Suburban | 7 | 96 | 10 |
| Rural | 1 | 1 | 88 |
(a) In plain English, what does the "10" in the table above mean?
(b) Let $U_n$, $S_n$, and $R_n$ represent the populations of people in urban, suburban, and rural areas respectively in year $n$ Write an equation that expresses $U_{n+1}$ in terms of $U_n$, $S_n$, and $R_n$. Then do the same for $S_{n+1}$ and $R_{n+1}$.
(c) Take the three equations from part (b) and convert them into a transition matrix $M$. Is this a stochastic matrix? Explain.
(d) Assume that the entire population is 250 million people, initially distributed into 100 million urban, 100 million suburban, and 50 million rural. With this assumption, predict the population distribution after 5, 10, and 25 years.
(e) As the number of years grows larger and larger, what appears to be happening to the population distribution?
2. Three major political parties in the United States are the Democratic, Republican, and Libertarian parties. Let $D_k$, $R_k$, and $L_k$ represent the percentage of voters voting for the Democratic, Republican, and Libertarian parties in election $k$. Over time, people sometimes switch their party affiliation when they vote. The
diagram below shows a possible system of voter affiliation change:
![](https://i.imgur.com/tXvhRF2.png)
In this model, 70% of voters stay with the same party from one election to the next. But, for example, 15% of voters who vote Republican in one election will switch to vote Libertarian in the next.
(a) Write expressions for $D_{k+1}$, $R_{k+1}$, and $L_{k+1}$ in terms of $D_k$, $R_k$, and $L_k$ and briefly explain your reasoning.
(b) If we write $\mathbf{x}_k = \begin{bmatrix} D_k \\ R_k \\ L_k \end{bmatrix}$, find the matrix $A$ such that $\mathbf{x}_{k+1} = A \mathbf{x}_k$.
(c) Explain why $A$ is a stochastic matrix.
(d) Suppose that, initially, 45% of voters vote Democratic, 43% vote Republican, and the remainder vote Libertarian. Form the vector $\mathbf{x}_0$. Then, find $\mathbf{x}_1$, the percentage of voters who vote for the three parties in the next election. Summarize your results in a single sentence.
(e) Find $\mathbf{x}_4$, $\mathbf{x}_{8}$, and $\mathbf{x}_{12}$. Over time, what percentage of the vote should each party expect to get in an election? Explain your reasoning.
## Submission and Grading
### Formatting and special items for grading
Please review the section on Miniprojects in the document [Standards For Student Work in MTH 302](https://github.com/RobertTalbert/linalg-diffeq/blob/main/course-docs/standards-for-student-work.md#standards-for-miniprojects) before attempting to write up your submission. Note that *all* Miniprojects:
- **Must be typewritten**. If any portion of the submission has handwritten work or drawings, it will be marked *Incomplete* and returned without further comment.
- **Must represent a good-faith effort at a complete, correct, clearly communicated, and professionally presented solution.** Omissions, partial work, work that is poorly organized or sloppily presented, or work that has numerous errors will be marked *Incomplete* and returned without further comment.
- **Must include clear verbal explanations of your work when indicated, not just math or code**. You can tell when verbal explanations are required because the problems say something like "Explain your reasoning".
Your work here is being evaluated *partially* on whether your math and code are correct; but just as much on whether your reasoning is correct and clearly expressed. Make sure to pay close attention to both.
Miniproject 1 in particular **must be done in a Jupyter notebook using SymPy to carry out all mathematical calculations**. [A sample notebook, demonstrating the solution to a Calculus problem, can be found here](https://github.com/RobertTalbert/linalg-diffeq/blob/main/tutorials/Example_of_solution_in_a_notebook.ipynb). Study this first before writing up your work.
It's likely that writing up your Miniproject work in a Jupyter notebook will become standard practice for later Miniprojects.
### How to submit
You will submit your work on Blackboard in the *Miniproject 1* folder under *Assignments > Miniprojects*. But you will *not* upload a PDF for Miniprojects. Instead you will **share a link that allows me (Talbert) to comment on your work**. [As explained in one of the Jupyter and Colab tutorials](https://gvsu.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=ef5c0e24-5c1d-437f-be05-af730108b6d8), the process goes like this:
1. In the notebook, click "Share" in the upper right.
2. **Do not share with me by entering my email.** Instead, go to *General Access*, and in the pulldown menu select "Anyone with the link", then set the permissions to "Commenter".
3. Then click "Copy Link".
4. **On Blackboard**, go to the *Assignments* area, then *Miniprojects*. Select Miniproject 1.
5. Under **Assignment Submission**, where it says *Text Submission*, click "Write Submission".
6. **Paste the link to your notebook in the text area that appears.**
7. Then click "Submit" to submit your work.
I will then evaluate your work using the link. Specific comments will be left on the notebook itself. General comments will be left on Blackboard.

:::info Welcome to MTH 201! I'm Dr. Robert Talbert, Professor of Mathematics, and I am grateful that you are signed up for the course and am looking forward to working with you this semester. ::: What's MTH 201 all about? MTH 201 is a first course in Calculus, which is all about modeling and understanding change. Change is maybe the most important facet of the world around us, and we care about it more than we realize. For example, we care a lot about the number of Covid-19 cases in our community, but we might care even more about how fast the number of cases is changing (either up or down). In MTH 201, you'll learn the mathematical language of change and apply it to models that you build to draw conclusions, make predictions, and give meaningful answers to real problems. MTH 201 goes beyond just computation. In MTH 201, you'll build skills with understanding complex concepts, communicating those concepts and the meaning of your results to appropriate audiences, using professional tools to help you in your work, and practice working with others to improve your learning (and theirs). These are valuable skills no matter where you go next. Success in this course doesn't come easy, and you can expect to be pushed and stretched intellectually. But the struggle you experience is normal and healthy, a sign of growth and that you are doing things the right way. And you will receive tireless support from me and your classmates in the process. Above all, my top priority is to support you in your work and help you succeed.

11/11/2023Initial due date: Sunday, April 9 at 11:59pm ET Overview Our final miniproject reaches back into linear algebra to look at diagonalizable matrices and their uses in solving systems of differential equations. Prerequisites: You'll need to be able to solve basic systems of differential equations and find the eigenvalues and eigenvectors for a small matrix. You'll also need a basic comfort level with concepts of linear independence and matrix arithmetic from earlier in the course. Background This entire problem comes from Section 3.9.1 in your textbook. Here is a rephrased version of the introduction to that section.

3/29/2023Initial due date: Sunday, April 9 at 11:59pm ET Overview This miniproject will teach you about the Runge-Kutta method, a standard numerical solution technique for differential equations. Prerequisites: A strong grasp of Euler's Method for single DE's is needed. You will also need to be comfortable using a spreadsheet. Miniproject 6 (Euler's Method for systems) is also recommended. Background A description of the Runge-Kutta method along with an example is given in this tutorial. Read it carefully and make sure you can work along with the example before proceeding.

3/29/2023Initial due date: Sunday, April 9 at 11:59pm ET Overview This miniproject introduces a version of Euler's Method as a numerical solution technique for systems. Prerequisites: You will need to be comfortable with using Euler's method for single differential equations. You'll also benefit from some familiarity with spreadsheets or Python in order to automate the calculations. Background This tutorial gives you the background you need for this assignment. Please read it and make sure you understand the concepts and the example: https://github.com/RobertTalbert/linalg-diffeq/blob/main/assignments/Euler's_Method_for_Systems.ipynb

3/22/2023
Published on ** HackMD**

or

By clicking below, you agree to our terms of service.

Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet

Wallet
(
)

Connect another wallet
New to HackMD? Sign up