HMC Math 181: Dynamical Systems (Spring, 2002)
Homework

### Assignment #11 (due Thu. 5/2):

Section 5.3: 2, 3, 6, 7
Section 5.4: 1e, 3, 4, 5
Section 5.5: 1, 2
11A: Prove the Contraction Mapping Theorem for complete metric spaces (as found in Section 5.3.5 of our text). Recall that a Cauchy sequence is... a little hard to describe in print without LaTeX (but essentially is one where points in the sequence eventually get arbitrarily close together)... anyway, check your notes, or ask me or a class-mate, or look it up in any Analysis text. A metric space (X,d) is complete if every Cauchy sequence in X converges (to a point in X). So take our proof of the Contraction Mapping Theorem on the reals, and modify it as necessary to apply to complete metric spaces.
11B: Do the fractal dance! Implement the computer program described at the beginning of section 5.5.2. In MATLAB, as always. (This will be a warm-up for your final programming project, the description of which will be sent to you within the next few days.)
11C: Now do the twist! Do the funky chicken!
11D: Go play Leap Fractal! The first sequence will give you a better idea of how the A/B/C sequences discussed in class on Thursday move points around in Siepinski's Triangle. The other two are different fractals. You should at least be able to beat the game for fractal one (the triangle) on Master difficulty. (I myself was able to do all puzzles except for Master difficulty on fractal three... that just gave me a headache! So if you can beat it, you can feel all smug and superior!)
NOTE: While you are encouraged to do problems 11C and 11D, there is nothing that you need turn in for them, and you will not be graded on them.

### Assignment #10 (due Tue. 4/23):

Section 5.1: 1, 2, 3, 4afghij
Section 5.2: 1, 2
NOTE: For 5.2.1, use MATLAB and draw at least 64 rows of the triangle. Note that you will have entries as large as "64 choose 32" ~= 1.8x10^18. However, if you compute 64! and 32!, note that 64! ~= 1.3x10^89. While I'm not sure if MATLAB uses 19 places of precision, I know it doesn't use 90. And what gets chopped of? The ones digit that determines parity (odd/even). So you'll need to figure out some way around this. Pascal's identity might help. See me if you want some other ideas.

2nd Midterm: Takehome, Due Thursday, April 18
No homework due 4/16.

### Assignment #9 (due Tue. 4/9):

Section 4.2: 2abe, 3 (see 9A)

9A: Write a MATLAB m-file to draw bifurcation diagrams. You can start with this file, bifur.m, and add to it as necessary. The file's help topic describes its specifications. Here is a sample function file, sinfun.m, that it should run on.
(i) Create a function file to represent the logistic map, and use your "bifur" function to do the first part of Problem #4.2.3 in the text. (Note: even though you have a plot, you should solve the last two parts of 4.2.3 analytically.)
(ii) Use your "bifur" function to plot a bifurcation diagram for the "sinfun" function provided above. Make two plots... one where parameter a ranges over [2, 4.5], and one where a ranges over [-5 5].
(iii) Use your result from (ii) to select a "familiar" looking small region, and plot a very small window in your diagram. Choose a region that demonstrates the self-similarity of this plot.
(iv) Use multiple plots (like that from (iii)) to find the a(i) values of bifurcation for this sine function for i=1,2,3,4,5,infinity. Recall that these are the 1st thru 5th bifurcations, as well as the "chaos wall" where period-doubling stops and chaos begins. Look for a-values in the 0 thru 3 range. Compute (a(4)-a(3))/(a(5)-a(4)) and compare this with the period-doubling constant 4.669.
NOTE: Here's what you should actually print out... the text of your "bifur.m", one plot for (i), two plots for (ii), one plot for (iii), and none for (iv) (just get the values from the computer and write them down). Got it? Only 5 pages total for print-outs.

9B: Write a Haiku inspired by the family of discrete dynamical systems x(k+1) = x(k)^2 + a. For further inspiration, you might look here.

### Assignment #8 (due Tue. 4/2):

Section 4.2: 1abcdhjl
8A: For the 3-dimensional Lorenz model (Section 4.1.4), take sigma=10 and b=8/3 as usual, but vary r. For each of r = 22, 24.5, 100, plot x vs. t, y vs. t, and x vs. z for several initial conditions. While you may want to plot numerous trials, only print and submit two or three representitive plots per r-value. Better yet, if you observe different behavior depending on initial conditions, plot several trajectories on the same axis (using, say, solid, dotted, and dashed lines). For clarity, you may sometimes want to plot only after some time has elapsed. Describe the behaviors you observe.

### Assignment #7 (due Tue. 3/26):

Section 4.1: 4, 5, 6
7A: Use the Poincare-Bendixson theorem to rule out closed orbits in the system x'=x-y-x^3 , y'=x+y-y^3. Use the techniques of Section 4.1.2 of our text.
7B: For each of the following one-dimensional systems x'=f(x), plot f(x) for each qualitatively different value (or range) for the parameter a, thereby determining the critical (bifurcation) value of a. Also draw on your plots the one-dimensional "vector field" along the x-axis, and determine the stability of any fixed points. Finally, draw the corresponding bifurcation diagram.
(i) x' = 1+ax+x^2
(ii) x' = x+[ax/(1+x^2)]
(iii) x' = a^2 - x^2
(iv) x' = x(a-e^x)
7C: Consider the system x'=y-ax , y'=-y+x/(1+x).
(i) Sketch the nullclines (say, for one particular a value).
(i) Find and classify the bifurcations that occur as a ranges from -infinity to infinity.
(i) Draw a bifurcation diagram of a vs. x.
7D: Go to the library or look around on the web, and read a little more about Lorenz, chaos and strange attractors.

### Assignment #6 (due Tue. 3/12):

Section 3.3: 1a, 4a
Section 3.4: 1d, 4a-e
Section 4.1: 3
NOTE:
Solve 3(b) using MATLAB by utilizing the built-in "ode45" function. This will plot trajectories of continuous 2D dynaminal systems. Note that, in the example provided in "help ode45", the plot function "plot(t,y(:,1))" plots y(1) vs. time. To get a plot of y through the phase plane, use "plot(y(:,1),y(:,2))" instead. Also note that "ode45" only accepts functions that take arguments "(t,y)", where t is a scalar variable time, and y can be a vector of any length.
6A: Once you get the hang of "ode45", write your own MATLAB m-file called "cdsplot." Here are the specs for your function:
```% CDSPLOT     plots the phase space of x' = f(x)
%    CDSPLOT(CDSFUN,RANGE,DX,TMAX,X0) draws the phase plane of the
%    continuous dynamical system x'=f(x), plotting both a vector
%    field and specified trajectories.  Here, CDSFUN is a handle
%    (or, if you prefer, a string with the name) of a defined f(x),
%    RANGE is a vector [XMIN XMAX YMIN YMAX] (see AXIS), DX is the
%    spacing between vectors in the vector field (so DX=1/3 gives
%    9 vectors per unit square), TMAX is the max time the ODE45
%    subroutine will plot trajectories to, and X0 is an Nx2 array
%    where each row is [x0,y0] and specifies the starting point of
%    one trajectory.  To omit trajectories, let TMAX=0; to omit
%    the vector field, let DX=0.
```
You may actually use this (plus anything else you care to add) as the help header of your M-File. The primary goal of this problem is to improve your MATLAB programming skills. You may cannibalize my VECFIELD.M however you see fit, and your function should make internal calls to QUIVER and ODE45. Test out your code by plotting the phase plane for the van der Pol equation in problem 4.1.3. As always, I'm available for help and hints if you need them. For this problem, submit a single plot and a copy of your source code.
6B: For each of the following, locate the fixed points and calculate the index of each. (You'll probably want to use VECFIELD or CDSPLOT to draw the vector field in a very small neighborhood around each fixed point. However, you needn't submit these printouts... you may simply sketch the vector field along your curve based on your plots... saves paper!).
(i) x'=x^2 , y'=y
(ii) x'=y-x , y'=x^2
(iii) x'=xy , y'=x+y
6C: Use index theory to show that the system x'=x(4-y-x^2) , y'=y(x-1) has no closed orbits.

1st Midterm: Takehome, Due Tuesday, March 5
No homework due 3/5.

### Assignment #5 (due Tue. 2/26):

Section 3.1: 5, 6, 7, 8b
Section 3.2: 1dei, 2deh, 3ce, 5ce, 6cefg, 7bcd
5A: Download the new and improved vecfield.m into your MATLAB directory and read it's help topic. Now create your own MATLAB functions in M-Files to compute the functions from problems 5c and 5e. Use vecfield.m and quiver to plot vector fields for each of these two systems. Each function should have one overview plot, and one close-up plot for each of the system's fixed points, similar to Figures 3.6-3.8 in the text. Print these out and attach them to your homework. (You needn't attach any MATLAB diary or printouts of your M-Files.) Remember, type "help axis" for hints on improving your pictures.

### Assignment #4 (due Tue. 2/19):

Section 2.3: 2, 3, 4, 5, 6, 7, 8, 9
NOTES:
3. You can enter these matrices into the MATLAB workspace by copying m181hw4.m into your MATLAB directory and typing "m181hw4" at the command line. Now you don't have to enter them manually! (Aren't I thoughtful?)
4. This is going to require some MATLAB M-file programming on your part. However, I've created a file that'll help... randp.m. "randp(P)" randomly generates a value 1 through n from the discrete probability distribution defined by the vector P (type "help randp" for more info). For example, if A is a transition matrix, "randp(A(:,3))" generates a transition from state 3 according to column 3 of A. For this problem, write a function called "iterate" (use can use randp.m as a function file template) that iterates a Markov chain as described. Your function should accept arguments x0 (starting state; #4 specifies x0=1), A (transition matrix), and k (the number of iterations), and then output a vector S that counts the number of visits to each state. Hence your function would be called with a line like "S=iterate(1,A,10000)". Use the "diary on" command to record your S values, but keep the diary file content to a minimum. E-mail this output to grader Mike.
5. Just find the eigenvectors of P. I've transposed the book's matrices in m181hw4.m so that columns sum to 1, and things work like I did them in class.
6. Classify each Markov chain as regular, periodic, absorbing, or some combination thereof.
9. Okay, I lied, there is no #9 in this section. But do the following... in class, we noted that in matrix A of a regular Markov chain, eigenvalue 1 couldn't have geometric multiplicity > 1 (i.e more than one Jordan block). I got to thinking about it, and in fact, it can't even have algebraic multiplicity > 1. Suppose that eigenvalue 1 has a single Jordan block of size > 1. Use our analysis of nondiagonalizable matrices to explain why this causes problems as "time gets large" (i.e can't happen in a Markov chain).

### Assignment #3 (due Tue. 2/12):

Section 2.2: 2, 3, 11, 12, 13, 14, 15
3A: For problems 11, 12 and 13 above, use MATLAB to plot a vector field (as in Figures 2.15-2.20 in the text) for each system (with and without b). Happily, I've done most of your work for you... the M-file vecfield_old.m does most of your thinking. Copy this file into your working MATLAB directory, type "help vecfield", and follow the example provided (you can even "cut and paste" from there to the command line!). For each plot, print it out and manually "follow the lines"... trace out the approximate path of the system for one or two starting points on your plot. Attach these printouts to this homework. (MATLAB saved my plot as a 100K jpg, which is why you're not saving them as graphics and mailing them to grader Mike.)
NOTE: The idea of this problem is to (a) experience plotting with MATLAB, and (b) start working with M-files. While I've done most of the work for you, you should still try to read and understand the code in VECFIELD.M... the more you learn now, the easier your life will be later.

### Assignment #2 (due Thu. 2/7):

Section 2.1: 6
Section 2.2: 4, 5, 7, 9, 10, 16, 17, 18, 19, 20
2A: Do problem #10 in Section 1.1. You will be required to use MATLAB to solve it. (This problem is primarily to get you to find MATLAB, run it, and do something simple with it. If you have any problems, see me early so we can get them resolved.)

NOTE: For 16-20, you may use MATLAB to find eigenvalues and/or iterate the system. In general, you may always use MATLAB (or another package) to handle tedious calculations unless I specify otherwise. For this assignment, you needn't turn in any MATLAB work... just write, "MATLAB says eigenvalues are 2 & 4" (or whatever). If you do want to turn in MATLAB work, it is preferred that you e-mail it to your grader (Michael_Gratton@hmc.edu) instead of printing it.

### Assignment #1 (due Tue. 1/29):

Section 1.1: 1, 8, 9, (10)
Section 1.2: 2, 8, 11d, 13bc