Part E: Plotting (continued) and Visualization
Exercises
The dynamics homework assigned from NDAC this week asks you to
explore a number of one-dimensional maps and the behaviors they produce.
If appropriate, modify the programs presented in lab (and available from
the course's Python Programming webpage). Whether you're modifying
an existing program or are asked to write a new one, give the working
Python code the names listed below for each problem.
- NDAC Problem 10.2.6 (Cosine map): Program name should be CosineMap.py.
- NDAC Problem 10.2.8 (Cubic map): Program name should be CubicMap.py.
- NDAC Problem 10.4.4 (Superstable period-3 orbit):
Program name should be SuperstableP3.py.
- NDAC Problem 10.4.5 (Band-merging and crisis of periodic windows):
Program name should be BandMerge.py.
- NDAC Problem 10.5.5 (Tent map):
Program name should be TentMap.py.
- A one-dimensional map bifurcation tool:
-
Make a collection of one-dimensional map functions that can be used
by any of the programs. Do this by making a Python library module
OneDMaps.py that includes all of the one-dimensional map functions
we've seen so far: logistic, cubic, cosine, exponential, tent, and cusp maps.
-
The specification of each map in OneDMaps.py should give additional
information that is helpful to a parent program that uses the library. In
particular, define a function that returns an example initial condition. That
is, define a function LogisticMapInitialCondition() that a parent
program can call to get an interesting initial condition—such as one
that leads to a chaotic orbit. Do the same for a default initial parameter
value: e.g., LogisticMapInitialParameter(). Include two more
functions that return valid minimum and maximum x values. These
will be helpful, for example, for graphics display or scaling in the parent
program. For the Logistic map these values would be 0.0 and
1.0, but for other maps they could be different. Finally, include a
function LogisticMapNameString() that returns the map's name
“Logistic Map, f(x) = r x (1 - x)”. This string can be used to
label the plot. Of course, each map will require its own unique functions.
-
Starting from an existing bifurcation diagram program, write a
Python program OneDMapBifn.py that loads this
library, just like any Python module.
-
Modify it so that where it called the logistic map function, it instead
calls a generic OneDMap() function with the appropriate number
of parameters.
-
When the program first starts up, have it print a list of available maps. Have
it then ask the user which map to use and which parameter range to explore.
(Use raw_input() and not input().)
The program should use the map's specified default initial condition.
-
The program should plot the bifurcation diagram with correct and informative
labels.
Table of Contents