Class 1 - Logistic, Predator Prey and SIR Maps

This notebook shows how to visualize orbits of discrete one, two and three dimensional systems.

Logistic map (1 D)

Entering and plotting a function:

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

Plot[f[x],  {x,  0, 1}]

Iterating a function:

Simplify[f[f[f[x]]]]

or better:

Nest[f,  x,  3]

Producing and plotting an orbit:

Remove the ; at the end of q1 and q2 to see what these command do.

x =  .3; n = 0;

q1 = Table[{n, x, x = f[x], n = n + 1}, {100}];

q2 = q1[[Range[1, 100], Range[1, 2]]];

q3 = ListPlot[q2, PlotStyle -> PointSize[0.02]];

q4 = ListPlot[q2, PlotJoined -> True];

Show[q3,  q4]

Predator Prey Map (2 D)

How to enter a map : R^2→ R^2

α = 
      1.2;  β =   .12;  γ =  .9;  δ =  .09;
F[x_,  
        y_] := {α x - β x y,  γ y + δ x y}

The fixed point where no population is extinct is:

{(α - 1)/β,  (1 - γ)/δ}

Clear[x, y]

F[x, y]

Producing the orbit

{x,  y} = {1,  .5};

nmax = 100;
q1 = 
        Table[{n,  {x,  y},  {x,  y} = F[x,  y]},  {n, 0, 
            nmax}];

Viewing the orbit as 2 graphs x(n), y(n) over n

q2x = 
        Table[{n,  q1[[n + 1, 2,  1]]},  {n,  0,  
            nmax}];
q2y = 
        Table[{n,  q1[[n + 1, 2,  2]]},  {n,  0,  
            nmax}];

q3x = 
        ListPlot[q2x, 
          PlotStyle -> PointSize[0.02]];
q3y = 
        ListPlot[q2y, 
          PlotStyle ->  {RGBColor[0, 0, 1],  
              PointSize[0.02]}];

    
Show[q3x, q3y]

Viewing the orbit in the plane

q4 = 
        Table[{q1[[n + 1, 2, 1]],  q1[[n + 1, 2, 2]]}, {n, 0, 
            nmax}];

q5 =  
        ListPlot[q4, 
          PlotStyle ->   {RGBColor[0, 0, 1],  
              PointSize[0.01]}];

whitefly vs. black wasp:

F[x_,  
        y_] := {1.01 x -  .008 x*y,   .9 y +  .04 x *
            y (1.01 -  .065 y)}

Instability of orbit in 1D

f1[x_] := 3.79  x (1 - x);

x =  .3; y =  .30001; n = 0;

q5 = 
        Table[{n, Abs[x - y], x = f1[x], y = f1[y], 
            n = n + 1}, {400}];

q6 = q5[[Range[1, 100], Range[1, 2]]];

q7 = ListPlot[q6, PlotStyle -> PointSize[0.02]];

From the above plot it apperas that the orbit O(.3) is unstable. To see this in another way we are going to plot one orbit versus the other.

q8 = q5[[Range[1, 400], Range[3, 4]]];

ListPlot[q8, PlotStyle -> PointSize[0.02], 
        PlotRange -> {{0, 1}, {0, 1}}];

When the point is close to the line y=x, the two states are close to each other. In this graph we loose the "history" of the evolution of the system.

Bacteria Map

F[a_,  b_,  c_,  d_,  p_, 
          x_] := (1 - a) x  +  (b x)/(c +  
                d  x^p);
a =  .7;   b =  12; c = 1;  d = 1;  p = 5;

F[a,  b,  c,  d,  p, X]

x = 1.5;   n = 0;

q1 = Table[{n, x, x = F[x], n = n + 1}, {60}];

q2 = q1[[Range[1, 60], Range[1, 2]]];

q3 = ListPlot[q2, PlotStyle -> PointSize[0.02]];

q4 = ListPlot[q2, PlotJoined -> True];

Show[q3, q4];