Chapter 2(b).    Bifurcation Diagram for the Logistic Map.

2.5 Bifurcation Diagram for the Logistic Maps.

Here are a selection of modules that can be used to create a bifurcation diagram for the logistic map:

The first module is the most straightforward. The idea is to define L(x,a)=a x(1-x) as a function of two variables. We define a new function p(a), obtained from taking (Subscript[x, 0]) in (0,1) randomly and iterating L((Subscript[x, 0]),a) for a fixed, 1000 times, and setting p(a) equal to the 100th iterate. p(a) is then plotted. This is continued for values of a in (0,1), distance 1/1000 apart. The resulting plot is the bifurcation diagram, which is shown below for the parameter values 2<a<4 :

Clear[f,L,p,k,A,B]

f[x_]:=x(1-x)

L[x_,a_]:=a*f[x]

p[a_]:=(
k[x_]:=L[x,a];
A=NestList[k,Random[Real, {0,1}], 1000];
Return[A[[100]]])

B=Table[p[j/10000],{j,20000,40000}];

ListPlot[B, PlotStyle->PointSize[0.00001]]

k=1000;r=Range[3,4,1/(k-1)];
rhs[x_?VectorQ]:=r x (1-x);
A=RecurrenceTable[{x[n+1]==rhs[x[n]],x[0]==ConstantArray[1./π,k]},x,{n,10000,20000}];
B=Transpose[Ceiling[A k]];

Co[B_,i_]:=Module[{c,j},{j,c}=Transpose[Tally[B]];
Transpose[{j,ConstantArray[i,Length[j]]}]->Log[N[c]]];

S=SparseArray[Table[Co[B[[i]],i],{i,k}],k];
ArrayPlot[Reverse[S]]

ListPlot[ParallelTable[Thread[{r,Nest[r#(1-#)&,Range[0,1,0.005],1000]}],
{r,0,4,0.005}],PlotStyle->PointSize[0]]

f[x_]:=x*(1-x)

SetAttributes[f,Listable]
data=ParallelTable[
Thread[{r,Nest[r*f[#]&,Range[0,1,0.005],200]}],{r,0,4,.001}];
ListPlot[Flatten[data,1],PlotStyle->Directive[PointSize[0],Opacity[.2],Black],
PlotRange->{{0,4},{0,1}},AspectRatio->1/2, Frame->True]

2.6 The Curves Appearing in the Bifurcation Diagram.

Looking at the bifurcation diagram, we can give the equations of those curves appearing, at least for (Subscript[L, r])(x)=r x(1-x), 0<r<1+√6. For 0<r≤1, the only attracting  periodic point is c=0. For 1≤r≤3, we solve r x(1-x)=x, to find the attracting periodic point c=1-1/r, which we plot for these values of r. For 3≤r≤1+√6, we find the attracting 2-cycle by solving ((Subscript[L, r])^2)(x)=x, and ignoring the fixed points. This gives c=[1+r±√((r^2)-2r-3)]/2r. Plotting the different functions that arise gives:

f[r_]:=0
g[r_]:=Piecewise[{{0, 0<r<1},{1-1/r,1<r<3},{0,3<r<1+Sqrt[6]}}]
h[r_]:=Piecewise[{{0,0<r<3},{(1+r-Sqrt[r^2-2r-3])/(2r),3<r<1+Sqrt[6]}}]
k[r_]:=Piecewise[{{0,0<r<3},{(1+r+Sqrt[r^2-2r-3])/(2r),3<r<1+Sqrt[6]}}]

Plot[{f[r],g[r],h[r],k[r]},{r,0,1+Sqrt[6]}]

Exercises 2.7

1.  Create a bifurcation diagram for  f(x)=a sin(x) using appropriate values of the parameter a, and 0<x<π.

2. Create a bifurcation diagram for the tent map  (Subscript[T, a])(x) with parameter a,0<a<2.