Chaps12.mw

Maple Text Commands for Chapter 12 -  

NONLINEAR DISCRETE DYNAMICAL SYSTEMS 

 

Figure 12.7(b): Graphical iteration of the tent map. 

>

restart:imax:=200:mu:=2:# Initialize
halfmax:=imax/2:
T:=array(0..10000):TT:=array(0..10000):
T[0]:=0.2001:
for i from 0 to imax do # Define the tent map
if T[i]>=0 and T[i]<=0.5 then
T[i+1]:=mu*T[i]:
elif
T[i]>0 and T[i]<=1 then
T[i+1]:=mu*(1-T[i]):end if:end do:
TT[0]:=[T[0],0]:TT[1]:=[T[0],T[1]]:
for i from 1 to halfmax do # Find the co-ordinates
TT[2*i]:=[T[i],T[i]]:
TT[2*i+1]:=[T[i],T[i+1]]:end do:
l := [TT[n]$n=0..imax]:  # List the co-ordinates
with(plots):
M:=plot(l, x=0..1,y=0..1, style=line,color=red):
N:=plot(x,x=0..1,color=black):
P:=plot(mu*x,x=0..0.5,color=black):
Q:=plot(mu*(1-x),x=0.5..1,color=black):
display({M,N,P,Q},labels=[`x`,`T`]);

 

Plot_2d

 

Finding points of period four for the logistic map whenmu = 3.5. 

>

with(plots):
mu:=3.5:
f:=x->mu*x*(1-x):
f4:=f(f(f(f(x)))):
plot({f4,x},x=0..1,scaling=CONSTRAINED,labels=[`x`,`f^4`],tickmarks=[2,2]);

 

Plot_2d

 

Computing the Lyapunov exponent for the logistic map. 

>

x=array(0..50000):x[0]:=0.1:mu:=4:imax:=50000:
for i from 0 to imax do
x[i+1]:=evalf(mu*x[i]*(1-x[i])):end do:
L:=0:
for i from 1 to imax do
L:=L+ln(abs(mu*(1-2*x[i]))):end do:
L/imax;

 

.6931207402

(1)

 

Figure 12.15: Bifurcation diagram of the logistic map. 

>

restart:with(plots):mu:='mu':
imax:=80:jmax:=800:step:=0.005:
ll:=array(0..10000):xx:=array(0..10000,0..10000):
for j from 0 to jmax do
xx[j,0]:=0.5:
for i from 0 to imax do
xx[j,i+1]:=(step*j)*xx[j,i]*(1-xx[j,i]):end do:
ll[j]:=[[(step*j),xx[j,n]]$n=60..imax]:end do:
LL:=[seq(ll[j],j=0..jmax)]:
plot(LL,x=0..4,y=-0.1..1,style=point,symbol=point,tickmarks=[2,2],labels=[`mu`,`x`],font=[TIMES,ROMAN,15],color=blue);

 

Plot_2d

 

Figure 12.22(b): Iteration of the Henon map. 

>

x:=array(0..10000):y:=array(0..10000):
a:=1.2:b:=0.4:imax:=5000:
x[0]:=0.1:y[0]:=0:
for i from 0 to imax do
x[i+1]:=1+y[i]-a*(x[i])^2:
y[i+1]:=b*x[i]:end do:
with(plots):
points:=[[x[n],y[n]]$n=300..imax]:
pointplot(points,style=point,symbol=point,color=blue,axes=BOXED);

 

Plot_2d

 

Exercise 8(c): Compute the Lyapunov exponents of the Henon map. 

>

restart:Digits:=70:
itermax:=500:
a:=1.2:b:=0.4:x:=0:y:=0:
vec1:=<1,0>:vec2:=<0,1>:
for i from 1 to itermax do
x1:=1-a*x^2+y:y1:=b*x:
x:=x1:y:=y1:
J:=Matrix([[-2*a*x,1],[b,0]]):
vec1:=J.vec1:
vec2:=J.vec2:
dotprod1:=vec1.vec1:
dotprod2:=vec1.vec2:
vec2:=vec2-(dotprod2/dotprod1)*vec1:
lengthv1:=sqrt(dotprod1):
area:=abs(vec1[1]*vec2[2]-vec1[2]*vec2[1]):
h1:=evalf(log(lengthv1)/i):
h2:=evalf(log(area)/i-h1):
#print('h1'=h1,'h2'=h2):
end do:
printf(“h1=%g”,h1);printf(“, h2=%g”,h2);

 

h1=0.352832, h2=-1.26912

(2)

 

End of Chapter 12 Commands