# The Azimuth Project Experiments in flip bifurcation with Sage (Rev #30, changes)

Showing changes from revision #29 to #30: 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(1-x)$

for $0\lt k \le 4$

A non-linear function with parabolic form of height that increases as $k$ increases. So where are the equilibrium points? (Hint: set $f(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 $k$ for the logistic map and if $k$ is less than 4 it maps the the interval $[0,1]$ on the “x-axis” into itself.

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

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

So what happens (at the bank) after $k=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= 4$ and the starting value $x_0$ randomly chosen between $10^{-10}$ and $10^{-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 $f$

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 $k$ 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 $k$. 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 $3\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=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