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开发者_JAVA技巧=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
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)
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)
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)
Fig. (4)
Now consider the starting point x[1]=18/25
.
CobwebDiagram[18/25, 200]
Fig. (5)
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)
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)
Fig. (8)
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)
CobwebDiagram[2/3, 200]
Fig. (10)
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.
To make questions easier to be answered for Mathematica versed folks, here is the Mathematica rendition on the code above:
CobwebDiagram[xstart_, steps_] := Module[{path, x, t},
path = RecurrenceTable[{x[t] ==
Piecewise[{{3/2 x[t - 1], 0 <= x[t - 1] <= 2/3}},
3 (1 - x[t - 1])], x[1] == xstart}, x, {t, 1, steps}];
Plot[Piecewise[{{3/2 x, 0 <= x < 2/3}}, 3 (1 - x)], {x, 0, 1},
Epilog -> {Red,
Line[Riffle[Partition[path, 2, 1], {#, #} & /@ Rest[path]]]}]]
Somehow, I thought this to be a homework question when I first saw it and the OP's response to Yoda's answer verifies this. It's not necessarily wrong to ask homework questions but it should certainly be clearly marked as such. There are some reasonable homework policies at this link on meta: https://meta.stackexchange.com/questions/18242/what-is-the-policy-here-on-homework
Taking into account the policy "no homework solutions; nudges welcome", there is one comment I'd add to the solutions discussion I've provided so far. Examine the graphs of the iterates of f. By this I mean the graphs of f(f(x)), f(f(f(x))), etc. For example, the third iterate of f(x)=x^2 is f(f(f(x)))=x^8. The points of intersection between the graph of the nth iterate of f and the line y=x include the periodic orbits of order n (and a bit more). Examining these pictures, it should become clear that there are lots of repulsive orbits.
The correct way to fully classify the dynamics is to use symbolic dynamics, which your class might or might not have covered.
I can't tell what part of the CobwebDiagram comes early, and which comes later. I haven't found a color function that really works, but an improvement may exist along these lines:
Clear[cobWebDiagram, f, x]
f[x_] = Piecewise[{{3/2 x, 0 <= x <= 2/3}, {3 (1 - x), True}}];
colorName = RandomChoice@ColorData["Gradients"]
color = ColorData@colorName
cobWebDiagram[f_, xstart_, steps_, low_, hi_, color_] :=
Module[{path, x, t, range = color[[3]], scale1},
path = Partition[NestList[f, .75 + eps, steps], 2, 1];
scale1 = Rescale[#, {1, Length@path}, range] &;
scale2 = Rescale[#, {1, Length@path}, {0, .005}] &;
Show[Plot[f@x, {x, low, hi}],
Graphics@
Table[{color@scale1@k, Thickness@scale2@k,
Arrow@path[[{k, k + 1}]]}, {k, -1 + Length@path}]]]
eps = 10^-16;
cobWebDiagram[f, .75 + eps, 100, 0, 1, color]
You can experiment with colors using RandomChoice, above, or a decent choice might be
colorName="CMYKColors"
精彩评论