logistic period doub

Upload: augusto-cabrera

Post on 07-Aug-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/21/2019 Logistic Period Doub

    1/3

    NAVIGATIONAL LINKS:

    Course Web Site

    Computer Exercises

    RELATED EXERCISES:

    Logistic Map

    Chaos and Lyapunov

    Exponents

    Invariant Measures

    Fractal Dimensions

    Period Doubling Routes

    to Chaos

    ILES

    Lecture on Chaos and

    Lyapunov Exponents /

    Invariant Measure

    Python:

    Logistic iteration hints

    Logistic iteration answer and demo

    INKS

    Python nanotutorials

    Starting up a new Python

    project under Linux

    Python setup info

    Course Web Page

    Robert M. May,

    "Simple mathem atical

    mod els with very

    complicated dynamics"

    , Nature 261, 459-467

    (1976).

    Physics 7682 / Computing & Information Sciences 6229 - Fall 2012

    INSTRUCTOR: ERICH MUELLER

    MONDAYS & FRIDAYS 1:30-3:30, ROCKEFELLER B3 (DIRECTIONS)

    http://www.physics.cornell.edu/~myers/teaching/ComputationalMethods/

    BackgroundWe have five exercises on discrete maps. This one develops the main tools, and should be done

    before the other four.

    Often models of nature have a discrete deterministic structure. A classic example is in population

    dynamics, where one hypothesises that the number of rabbits in year is simply a function of

    the number in the previous year:

    If is linear one has the logistic equation, and the number of rabits grows exponentially. This

    is a reasonable model if there are infite resources no preditors. The next most sophisticated model

    would be to add a nonlinear term representing either the finite resources or the role of preditors.

    This gives the logistic map

    which is a map of the interval onto itself. There is one parameter , which will change the

    behavior of the map. For example, at , this function precisely folds the unit interval in half

    and stretches it (nonuniformly) to cover the original domain. It turns out that this simple map

    displays some complicated behavior.

    Learning Goals

    Science: You will learn about Chaos and discrete maps.

    Computation: You will learn about iterative algorithms.

    Procedure

    xn

    =f( ).xn+1 xn

    f(x)

    f(x) = 4x(1 x),

    (0, 1) = 1

  • 8/21/2019 Logistic Period Doub

    2/3

    1. Create a new directory

    2. Download Logistic iteration hints,and rename it IterateLogistic.py.

    3. Open this file in a text editor (kate or emacs -- we recommend against us ing kedit) or

    load it into the IPython dashboard (started with ipython notebook --pylab inline. In

    this file, you will notice Python code that has already been written, but it mostly consists

    of hints to help you flesh out the code, i.e., comments (lines that begin with #) and

    documentation strings (material enclosed in triple quotes """ that document what each

    module, class, and function is about and can be queried with the Python help()

    function). You will also notice the keyword pass embedded within each function body:

    pass is a legal Python expression that means "do nothing". The first thing you will do

    when you start to define a function is to remove the pass statement and replace it with

    new code.

    4. Open a terminal window, move to the correct directory and start ipython, or click on the

    notebook in the dashboard. You will find it convenient to start python with the --pylab

    flag -- ie type ipython --pylab or ipython notebook --pylab.

    5. define a function f(x,mu) which when called with and returns .

    6. Use pylab commands to plot f as a function of x for different values of mu.

    7. Write a function Iterate(g, x0, N, mu)which is passed a function g, an initial point x0

    and integer N and a parameter mu which returns g(g(...(g(x0,mu),mu)...). That is it

    iterates the function Ntimes, starting at x=x0.

    8. Test this function with f. Are there any other functions you can write to test it more

    easily?

    9. Write a function IterateList(g, x0, N, mu)which acts just like iterate, but returns a

    list of the sequential values of x. (A more verbose description is in the hints file.)

    10. Play a bit with this function.

    Type ylim((0,1)) then plot(IterateList(f,0.5,100,0.1)). This should

    make a graph of the iterates of x, starting with x0=0.5, using mu=0.1. As

    you can see, the bunnies don't do so well for small mu.

    Try different values of mu. You should find that mu=0.25 is special. How does

    the behavior of the iterates change when mu>0.25?

    How does the behavior change when mu>0.75?

    To explore this structure in more detail, see

    Period Doubling Routes to Chaos

    this structure can be compactly encoded in a "bifurcation diagram"

    11. Write a function BifurcationDiagram(g, x0, nTransient, nCycle, muArray,

    showPlot)which takes as arguments:

    g -- a function

    x0 -- the starting value for the iterates

    nTransients -- an integer

    nCycle -- another integer

    muArray -- a list of mu values

    showPlot -- True/False

    For each value of mu in muArray, this function should iterate g, starting a x0. It throwsaway the first nTransient iteratates. It then stores the next nCycle iterates. It then

    makes a plot where the x-axis is the values of mu, and the y-axis are the values of x.

    12. Try the following parameters:

    BifurcationDiagram(f, 0.1, 500, 500, scipy.linspace(0., 1.00001, 200))

    BifurcationDiagram(f, 0.1, 500, 500, scipy.linspace(0.85, 1.00001, 300))

    BifurcationDiagram(f, 0.1, 500, 500, scipy.linspace(0.96, 0.97, 400))

    13. To explore this structure in more detail see Fractal Dimensions

    James P. Sethna, Christopher R. Myers, Erich J. Mueller.

    Last modified: July 2012

    x 4x(1 x)

  • 8/21/2019 Logistic Period Doub

    3/3

    Statistical Mechanics: Entropy, Order Para meters, and C omplexity, now a vai lable at

    Oxford University Press (USA, Europe).