The Logistic Map

Math 242 Modern Computational Mathematics

Define the logistic map

The logistic map is the recurrence (Subscript[x, n+1])=r (Subscript[x, n])(1-(Subscript[x, n])), where 0<=r<=4 is a parameter. For any starting value 0<=(Subscript[x, 0])<=1, this recurrence defines a sequence of real numbers (Subscript[x, 0]),(Subscript[x, 1]),(Subscript[x, 2]),….

To compute logistic map trajectories, first define a function (Subscript[f, r])(x)=r x(1-x). Then (Subscript[x, n+1])=(Subscript[f, r])((Subscript[x, n])).

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

Iterate (Subscript[f, 2.5]) starting at (Subscript[x, 0])=0.5, for 20 iterations:

NestList[f[2.5],0.5,20]

Explore: iterate (Subscript[f, r])(x) for various parameters 0<=r<=4 and various starting values 0<=(Subscript[x, 0])<=1. What do you observe? What do you wonder?

NestList[f[1],0.5,100]

NestList[f[2],0.3,100]

NestList[f[Pi],0.3,100]

NestList[f[Pi],N[(Pi-1)/Pi],2]

f[Pi][(Pi-1)/Pi]

traj=NestList[f[3],0.68,10000];

ListPlot[traj]

traj=NestList[f[3.92],0.462,1000];
ListPlot[traj]

Cobweb plots

The following module makes a cobweb plot. The basic usage is cobwebPlot[ function, starting value, number of iterates ]. Optional parameters xmin and xmax specify the domain to be plotted.

cobwebPlot[f_,start_,numIter_,xmin_:0,xmax_:1]:=Module[{cob={{start,0}},prev=start,next,g1,g2},
(* build the list of points to plot *)
Do[
next=f[prev];
AppendTo[cob,{prev,next}];
AppendTo[cob,{next,next}];
prev=next,
numIter];

(* display the plot *)
g1=Graphics[{Purple,Opacity[0.3],Line[cob]}];
g2=Plot[{x,f[x]},{x,xmin,xmax},PlotStyle->{Blue,Black}];
Show[{g1,g2},Frame->True]
]

Draw some cobweb plots:

cobwebPlot[f[1.5],0.2,20]
NestList[f[1.5],0.2,20]

Manipulate[cobwebPlot[f[r],x,200],{r,0,4},{x,0,1}]

NestList[f[3.11],0.3,100]

Detect a 4-cycle:

traj=NestList[f[3.45],0.3,1000];
tail=traj[[-20;;]]
Round[tail,0.001]
DeleteDuplicates[Round[tail,0.001]]