Search code examples
matlabwolfram-mathematicafixed-point-iteration

Finding fixed points / attractors / repellors of a Tent map


I need to find fixed points and attractors of a Tent map function given by the definition below:

    xt =  (3/2) * xt-1      when 0 <= x <= (2/3)

    and

    xt = 3* (1-xt-1)        when (2/3) <= x <= 1

I am using the MATLAB code below to generate a cobweb diagram (shown below the code) to see if I can get some insight in to this particular tent map function. As you can see I am starting out by setting t=1 (and x(1) = 0.2001), but there are infinitely many possible places to start at. How can you determine fixed points/attractors if you don't test each and every starting point?

clear
close all

% Initial condition 0.2001, must be symbolic.
nmax=200;
t=sym(zeros(1,nmax));t1=sym(zeros(1,nmax));t2=sym(zeros(1,nmax));
t(1)=sym(2001/10000);
mu=2;
halfm=(2/3) *nmax;
axis([0 1 0 1]);
for n=2:nmax
    if (double(t(n-1)))>0 && (double(t(n-1)))<=2/3         % 0 <= x <= (2/3)
            t(n)=sym((3/2)*t(n-1));                        % x(t) = (3/2) * x(t-1)
        else
            if (double(t(n-1)))<1                          % else (2/3) <= x <= 1
                t(n)=sym(3*(1-t(n-1)));                    % x(t) = 3* (1-x(t-1))
            end
    end
end



for n=1:halfm
    t1(2*n-1)=t(n);
    t1(2*n)=t(n);
end


t2(1)=0;t2(2)=double(t(2));
for n=2:halfm
    t2(2*n-1)=double(t(n));
    t2(2*n)=double(t(n+1));
end

hold on
fsize=20;
plot(double(t1),double(t2),'r');


x=[0 (2/3) 1];y=[0 mu/2 0];
plot(x,y,'b');

The following cobweb diagram is for t(1) = 0.2001 enter image description here


Solution

  • These are just some insights from poking around the problem. I'll continue with using Mathematica for now as it is more convenient (and judging by your code above, you should be able to manage this in MATLAB, if not, I'll try and convert it). However, if you do have Mathematica, and can test these out that would be great.

    Fixed point: A fixed point of a function f(x) is a point that's the solution of f(x)=x; in other words, the point where the function maps it to itself.

    Solving for your function, you get x=0 and x=3/4 as fixed points.

    In:= Solve[Min[3/2 x, 3 - 3 x] - x == 0, x]
    
    Out= {{x -> 0}, {x -> 3/4}}
    

    Indeed, a trajectory that starts at these points will stay at these points forever. You can also interactively observe the effects as you change the starting point and the number of iterations using

    Manipulate[
     CobwebDiagram[xstart, steps], {xstart, 0, 1, 1/1000}, {steps, 1, 200,
       1}] 
    

    Nature of the fixed points

    Let's look at the nature of the fixed points. If it's an attractor, points in an arbitrarily small epsilon sized neighborhood of the fixed point stay in a similar sized neighborhood (need not necessarily be the exact same size), and if it's a repellor, it gets repelled and diverges to a completely arbitrary point outside the neighborhood (my definitions are pretty loose here, but guess will do).

    So trying the following

    eps = 10^-16;
    CobwebDiagram[0.75 + eps, 200]
    

    we get

    Fig. (1)

    enter image description here

    which certainly doesn't look like it is converging to the fixed point. Indeed, if you look at the evolution of x[t], you'll see that it diverges

    Clear[f]
    f[1] = 0.75 + eps;
    f[t_] := f[t] = 
       Piecewise[{{3/2 f[t - 1], 0 <= f[t - 1] <= 2/3}}, 3 (1 - f[t - 1])];
    ListLinePlot[Table[f[n], {n, 1, 200}]]
    

    Fig. (2)

    enter image description here

    The result is similar if you perturb it in the other direction, i.e., f[1]=0.75-eps.

    For the other fixed point (this time, it can be perturbed only in one direction as the function is defined for x>=0), you'll see that the behaviour is the same, and hence the two fixed points appear to be divergent.

    Fig. (3)

    enter image description here

    Fig. (4)

    enter image description here

    Now consider the starting point x[1]=18/25.

    CobwebDiagram[18/25, 200] 
    

    Fig. (5)

    enter image description here

    Whoa!! That looks like a limit cycle!

    Limit cycle: A limit cycle is a closed trajectory of the system from which there is no possibility of reaching a point not on the trajectory, even as t->Infinity. So, when you look at the x[t], you see something like

    Fig. (6)

    enter image description here

    which is just 3 points repeated (the image compression creates a Moiré pattern, but really, if you plot it for a small # of steps, you'll see 3 points. I'm just too sleepy to go back and replot it). The three points are 12/25, 18/25 and 21/25. Starting with any of these three points will take you to the same limit cycle.

    Now if trajectories sufficiently close to the limit cycle converge to it, it is an attracting/stable limit cycle, else it's a repelling/unstable limit cycle. So perturbing by eps in either direction as before, we see that the trajectory diverges (I'm only showing +ve direction below).

    Fig. (7)

    enter image description here

    Fig. (8)

    enter image description here

    Interestingly, starting with x[1]=19/25 maps it to 18/25 in the next step, which then continues on indefinitely in the limit cycle trajectory. It is easy to see why this happens, as the line from 19/25 on to y=x is just the continuation of the line from 12/25 to y=x (i.e., from the first piece of the function). By the same logic, there should be points corresponding to 18/25 and 21/25, but I'm not going to find them now. In light of this, I'm not exactly sure here as to whether the limit cycle here is truly attracting or repelling (as per the strict definition of limit cycle, there needs to be only one other trajectory that spirals into it, and we've found three! Perhaps someone who knows more on this can weigh in on this).

    Some more thoughts

    The starting point 1/2 is also interesting, because it takes you to 3/4 in the next step, which is a fixed point and hence stays there forever. Similarly, the point 2/3 takes you to the other fixed point at 0.

    CobwebDiagram[1/2, 200]
    

    Fig. (9)

    enter image description here

    CobwebDiagram[2/3, 200]
    

    Fig. (10)

    enter image description here

    The behaviour of the oscillations also tell you something about the system. If you look at the trajectory in Figs. (2,4), the system takes longer to spiral into chaos for the fixed point 0 case, than the other. Also, in both the plots, when the trajectories get close to 0, it takes longer for it to recover than at 3/4, where it just flutters around rapidly. These look similar to relaxation oscillations (think of a capacitor charging slowly and being discharged instantaneously by shorting).

    That's all I can think of for now. Lastly, I believe the exact nature of the fixed points must be analyzed in the general setting of Lyapunov stability, but I'm not going to embark upon this. I hope this answer has given you a few options to look into.