The Azimuth Project
Experiments in flip bifurcation with Sage (changes)

Showing changes from revision #30 to #31: Added | Removed | Changed

Contents

Idea

This page explores the flip bifurcation - which sometimes can result in periodic doubling towards chaos - with Sage. We will see when the doubling occurs and illustrate some simple models and tools of trade, and how it can be used in different domains of relevance for the Azimuth Project.

Here is the equation for the logistic map

f(x)=kx(1x)f(x) = kx(1-x)

for 0<k40\lt k \le 4

A non-linear function with parabolic form of height that increases as kk increases. So where are the equilibrium points? (Hint: set f(x)=0f(x)=0). And are they stable ?

Details

It occurs in many discrete models and is the bifurcation example that is usually explored in popular expositions of chaos and usually by using the discrete version of the logistic map. It occurs in atmosphere,ocean models, simple population growth models and also unemployment models in economy.

The equilibrium points are 0 and 1. Let us assume that we use the factor kk for the logistic map and if kk is less than 4 it maps the the interval [0,1][0,1] on the “x-axis” into itself.

The fix points of this map are given by x n+1=kx n(x n1)x_{n+1} = k x_{n} (x_{n}-1) which is the trivial fix point at x f1=0x_{f1} = 0 and x f2=11/kx_{f2} = 1-1/k is the other. The (for higher dimensions use the Jacobian) derivative is k(12x)k(1-2x) and inserting the fix points we get kk and 2k2-k. So the trivial 0 is stable at k<1k\lt1 and becomes unstable for k>1k\gt1. the second is stable at 1<k<31\lt k\lt3.

The diagonal represent values where x n+1=x nx_{n+1} = x_{n} or where the fix points are. Here we can see that the logistic map stays under the diagonal for k<1k\lt1 and when the logistic map crosses the diagonal we see that the second fix point appears. Here is a larger plot of the map withk{0,1,2,3,4}k\in \left \{ 0,1,2,3,4\right \}:

So what happens (at the bank) after k=3k=3 ? That is a paraphrase of professor May’s statement. One characteristic that people always remember is the “butterfly effect”, or that small changes in the input values can result in large changes in the output.

Here we iterate the logistc map with k=4k= 4 and the starting value x 0x_0 randomly chosen between 10 1010^{-10} and 10 910^{-9}, or 0.0000000001 and 0.000000001 if you prefer decimal notation. The x-axis is time steps and the y-axis shows the value of ff

So that seems to be the case as we see the completely different outcomes when we vary the start value with minuscule values. But why?

Because the map is behaving chaotically and shows aperiodic patterns. Yes and how this help to understand? In order to get a grip on things we need to slow down and look at the logistic map from two perspectives, see how changes in the value of kk affects the map and also fast that occurs. But isn’t it just a random process ?

No it is deterministic, but let us just animate the actual value over time, while varying kk. Just remember that the behavior flips between values as we see in the plots above. Here we skip the lines to emphazize another important point: how doubling occurs:

So initially we get one line of points but after some time we see that there are two lines. So we see a period two bifurcation being born and after an even shorter amount of time we see the period four. Or you might see even 8 or 16 !

In this animation we look at how the number of period doubling bifurcations varies as for 3lek43\lek\le4. So k is onthe x-axis and the function value of the flip bifurcation is on the y axis:

So the period-2 occurs at k=3k=3 and the period-4 for k slightly less than 3.5. Of course we can calculate when they occur, but You can do that for yourself for period-N now !

I want to see if there is a period-3 somewhere - just visually. If we plot the whole bifurcation plot we might see that or zoom into the animation above. Why do you want that is it because you like number theory? Ha-ha-ha no but there is a theorem by Sarkovskii that says if you can find a period-3 cycle in a one-dimensional maps then the map has cycles for all numbers, which means that it is chaotic.

Draft Code


# default for animations in Sage is to repeat  forever
# if u want a specific number of repeats just add
# change the eg bpa.show(delay=200,iterations=3)

# this show the butterfly effect
lp = [list_plot(trajectory(LogisticMap(),4.0,60,1e-9*random()),plotjoined =True,thickness=0.4) for i in range(9)]
graphics_array(lp,3,3).show() 

# animation of periodic doubling
lp = [list_plot(trajectory(LogisticMap(),k,200,0.5)) for k in srange(2.0,4.0,0.1)]
a = animate(lp, figsize=[4,4],xmin=0.0,xmax=100.,ymin=0.0, ymax=1.0)
a.show(delay=200) 

# animates slices of the bifurcation plot 
bpa = animate([bifurcation_plot(LogisticMap(),r-0.005,r) for r in srange(3.0,4.0,0.05)], figsize=[4,4],xmin=1.0,xmax=4,ymin=0.0, ymax=1.0)
bpa.show(delay=100) 

# the function and orbit trajectory() is written in Cython and will be included later 


References