Part E: One-Dimensional Dynamics and Numerical Integration

Exercises

The homework this week asks you to explore various one-dimensional maps and ODEs and the behaviors they produce. Use the simulation and display programs introduced in the Lab for these problems by modifying them appropriately.
  1. Make a collection of one-dimensional (1D) maps by coding up a Python library module OneDMaps.py that includes the logistic, cosine, and tent 1D maps. These are defined xn+1 = f(xn), where:
    1. Logistic map: f(x) = 4 a x (1 - x).
    2. Cosine map: f(x) = a cos(x/(2π)).
    3. Tent map: f(x) = 2 a x, if 0 ≤ x < 1/2; and f(x) = 2 a (1-x), if 1/2 ≤ x ≤ 1.
    Here, they share a control parameter over a common range: a in [0,1]. Define an iteration function for each 1D map: LogisticMap(a,nIts), CosineMap(a,nIts), or TentMap(a,nIts). Their first parameter is the map's control parameter and the second is the number of iterations to perform.
  2. Modify LogisticMap.py from the Lab into a program Iterate1DMaps.py that can plot iterates for any map in the module OneDMaps.py. Do this by introducing a generic function OneDMap() that can be assigned any one of the map functions in OneDMap.py. Produce a PNG plot of the program running each of these 1D maps at a = 0.98. In addition to the program Iterate1DMaps.py and module OneDMaps.py, submit these PNG plots.
  3. Modify LogisticFunction.py from the Lab into a program OneDMapFunction.py that can plot the functional form of any map in the module OneDMaps.py. Implement switching between the alternate maps as you did for the previous program. Produce a PNG plot of the program running each of these 1D maps at a = 0.98. In addition to the program, submit these plots.
  4. Modify LogisticHistogram.py from the Lab into a program OneDHistogram.py that plots the histogram of iterates for any map in the module OneDMaps.py. Implement switching between the alternate maps as you did for the previous program. Produce a PNG plot of the program running each of these 1D maps at a = 0.98. In addition to the program, submit these plots.
  5. Recall the three 1D ODE simulators described in the Lab: Euler1D.py, ImprovedEuler1D.py, and RK1D.py. Combine them into a single program—name it OneDODESimulator.py—in such a way that you can easily switch between the different integration methods and then plot their solution. That is, have the simulator program call one or the other integrator using a generic function Integrator() that is set appropriately to one or the other alternative integrator functions.
  6. Using the previous program, write a new one IntegratorCompare.py that graphically compares the accuracy of the methods for the pitchfork ODE in a single display window. Use three subplots, one for each integrator's solution, placed one above the other, as demonstrated in the Lab. Compare them at the same integration time-step size. How do the solutions differ? How would you convince yourself (or others) that one is more accurate than another?

Table of Contents