- Define the following matrices and vectors.
,
1
1 0 x = , y = , z = 4.
0 1
2
Calculate the following:
- A + B,
- 3x 2y,
- Ax,
- A(y x),
- Cx,
- Cy + z,
- AB, (h) BA.
Save the answers in eight separate .dat files, named A1.dat, A2.dat, , A8.dat. Are the answers in (g) and (h) the same?
- Now try to calculate both AD and DA. One is a valid matrix multiplication and the other will give you an error. Save the one that is valid in dat.
Next, access and save the following elements:
- The second column of D,
- Both columns of the last two rows of C,
- The first two columns of the second row of D.
Save the answers in three separate .dat files, named A10.dat, A11.dat and A12.dat.
- The following four expressions are exactly equal to zero:
,
However, computers store floating-point numbers with a binary representation and only finitely many digits, so most decimal representations have a small truncation error. This error is usually too small to be noticeable, but it accumulates if you add up many copies of that number. As a result, x1, x2, x3, and x4 might not be exactly zero if you compute them with a computer. To verify this effect, use Matlab to compute x1, x2, x3, and x4 and save them in A13.dat A16.dat, respectively. Can you explain the differences in these values?
- The Logistic Map is a function that is often used to model population growth. It is defined by
,
where P(t) represents the population at year t as a proportion of the maximum population. Therefore, P(t) = 1 means the population is at its maximum value and P(t) = 0.5 means that the population is half of the maximum value. The parameter r is the growth rate. Using this equation, if we know the population for some year P(t), we can plug it into the right-hand side of the equation to find the population for the next year, P(t + 1). For example, lets say that t = 0 represents the current year and we know the current population P(0). Then we can calculate the population after 1 year, P(1), using
,
Once we know the population after 1 year, we can calculate the population after 2 years using
,
Let r = 3 and let the current population be P(0) = 0.4. Find the population after 100 years, P(100), and save it in A17.dat
Bonus (for fun): The Logistic map is famous for exhibiting some strange and interesting behavior. In particular, it exhibits chaos for some values of r (we will see more chaotic systems later in the course). If you would like to explore it further, try the following:
- Make a vector that contains all of the values from P(0) to P(100). That is, make the vector:
Then plot the population versus time t.
- Now do the same with r = 3.5 and r = 4. Compare the behavior in each case.
Reviews
There are no reviews yet.