Dinosaur Tracks at Moenkopi

Sunday, October 18, 2009

Directions: From Flagstaff Take State Highway 89 North, then turn right on 160 toward Tuba City. The location of the villiage of Moenkopi, and the Dinosaur Tracks site are about a mile on the left. This is 5 miles West of Tuba City, not East, on 160. Caution, some maps have not correctly located this villiage. It is on the north side of 160.




Dinosau Eggs




Biggest Foot print found in Moekopi


Dinosau Trial













Chaos, Lyapunov, and entropy increase-MATLAB CODE

Saturday, October 10, 2009

Chaos, Lyapunov, and entropy increase.


Chaotic dynamical systems have sensitive dependence on initial conditions. Thisiscommonly described as the ‘butterfly effect’ (due to Lorenz of the Lorenz attractor): the effects of the flap of a butterfly’s wings in Brazil build up with time until months later a tornado in Texas could be launched. In this exercise, we will see this sensitive dependence for a particular system (the logistic map)and measure the sensitivity by defining the Lyapunov exponents. The logistic map takes the interval (0, 1) into itself:

f(x)=4μx(1 − x),

where the time evolution is given by iterating the
map:
x0,x1,x2,... = x0,f(x0),f(f(x0)),....

In particular, for μ = 1 it precisely folds the unit interval in half, and stretches it (non-uniformly)to cover the original domain. The mathematics community lumps together continuous dynamical evolution laws and discrete mappings as both being dynamical systems.

The general stretching and folding exhibited by our map is often seen in driven physical systems without conservation laws.In this exercise, we will focus on values of μ near one, where the motion is mostly chaotic. Chaos is sometimes defined as motion where the final position depends sensitively on the initial conditions. Two trajectories, starting a distance "delta" apart, will typically drift apart in time as "delta*eλt", where "λ" is the Lyapunov exponent for the chaotic dynamics. Start with μ =0.9 and two nearby points x0 and "y0 = x0 + delta" somewhere between zero and one. Investigate the two trajectories x0,f(x0),f(f(x0)),...,f[n] (x0) and
y0,f(y0),... . How fast do they separate? Why do they stop separating? Estimate the Lyapunov exponent. (Hint: "delta" can be a few times the precision of the machine. so long as you are not near the maximum value of f at x0 =0.5.) Many Hamiltonian systems are also chaotic. Two configurations of classical atoms or billiard balls, with initial positions and velocities that are almost identical, will rapidly diverge as the collisions magnify small initial deviations in angle and velocity into large ones. It is this chaotic stretching, folding, and kneading of phase space
that is at the root of our explanation that entropy increases






MATLAB CODE


close all, clear all, clc
avalues=0.6:0.0001:1;

N=1000;
a=avalues;
x0 = [];
for i=1:length(avalues)
x0=[x0 rand(1)];
% x0=0.1;
end
x(1,:)=x0;
for n=1:.3*N
x(n+1,:)=4*a.*x(n,:).*(1-x(n,:));
end

figure
for n=.3*N:N
x(n+1,:)=4*a.*x(n,:).*(1-x(n,:));
plot(a,x(n+1,:),'.','MarkerSize',4.5) %plot x versus a
hold on

end
zoom
title('F(x) versus a' )
xlabel('a')
ylabel('F(x)')



clear all


muvalues=0.001:0.00000005:1;
muvalues=.9;
N=120;
mu=muvalues;
x0 = [];
y0=[];
e=1e-8;


k=.8;
x(1)=k;
y(1)=k+e;

figure

for n=1:N-1
x(n+1)=4*mu.*x(n).*(1-x(n));

y(n+1)=4*mu.*y(n).*(1-y(n));
plot(x(n),x(n+1),'.') %plot x(n+1) versus x(n)
hold on

end
title('x(n+1) versus x(n) ')
xlabel('x(n)')
ylabel('x(n+1)')

figure
hist(x,100)
title('Histogram of F(x)')


figure
l=1:N;
z=x-y;

plot(l,(x),'.-r'); %plot F(x) and F(y) versus N
hold on
plot(l,y,'-xk');
zoom
title(['F(x) and F(y) versus N (No.of steps)'])
xlabel('N')
ylabel(['F(x)-Red, F(y)-Black','e-initial difference- ',num2str(e)])



figure
plot(l,(abs((z/1))),'.-k') %plot F(x)-F(y) versus N
zoom
title(['[F(x)-F(y)] versus N (No of Steps)','e-initial difference- ',num2str(e)])
xlabel('N')
ylabel('F(x)-F(y)')

figure
g=(((log(abs(z)/1)))); %plot log [F(x)-F(y)]
p=polyfit(l,g,1);
y3=p(1)*l+p(2);
lamda=p(1)

plot(l,g,'.-','MarkerSize',0.5)
hold on
plot(l,y3,'r')

title(lamda)
title(['Log(abs((F(x)-F(y)))) versus N (No of Steps), ',' Lyapunov exponent- ',num2str(lamda)])
xlabel('N')
ylabel('Log(abs( (F(x)-F(y))) ) ')

Random walk-MatLab Code

One can efficiently generate and analyze random
walks on the computer.

(a)
Write a routine to generate an N-step random walk in d dimensions, with each step uniformly distributed in the range (−1/2, 1/2) in each dimension. (Generate the steps first as an N × d array, then do a cumulative sum.) Plot xt versus t for a few 10 000-step random walks. Plot x versus y for a few two-dimensional random walks, with N = 10, 1000, and 100 000.(Try to keep the aspect ratio of the XY plot equal to one.) Does multiplying the number of steps by one hundred roughly increase the net distance by ten?


(b)
Write a routine to calculate the endpoints of W random walks with N steps each in d dimensions. Do a scatter plot of the endpoints of 10 000 random walks with N = 1 and 10, superimposed on the same plot. Notice that the longer random walks are distributed in a circularly symmetric pattern, even though the single step random walk N =1 has a square probability distribution


(c)
Calculate the RMS step-size a for onedimensional steps uniformly distributed in (−1/2, 1/2). Write a routine that plots a histogram of the endpoints of W one-dimensional random walks with N steps and 50 bins, along with the prediction of eqn 2.35 for x in (−3σ, 3σ). Do a histogram with W = 10 000 and N = 1, 2, 3, and 5. How quickly does the Gaussian distribution become a good approximation to the random walk?



MATLAB CODE



N=3; % no of trials


k=100; %no of walks

t3=get(handles.dim,'string');
d=2; %dimension
s=0.5; %step size




z=(2*s).*(rand(d,N))-s;


vec=[zeros(1,d); cumsum(z')];

%x=[zeros(1,d); cumsum(z(2,N))]
colorstr=['b' 'r' 'g' 'y'];
for i=1:k
z=(2*s).*(rand(d,N))-s;
if N==1
for j=1:d
D(i,j)=cumsum(z(j,N));
%G(j)=cumsum(z(j,N));
K(i)=i;
end


else

vec=[zeros(1,d); cumsum(z')];


X(i)=vec(N+1,1);
if d>1
Y(i)=vec(N+1,2);
end
K(i)=i;
%plot(x(N+1,1),x(N+1,2),'.')

end


end

if N==1


% L=[0 ,0;1 ,D(k,1) ]
figure
% plot(L(:,1),L(:,2),'.-r')

plot(cumsum(z(1,:)'),'.-')
title(['Xt versus t, ','( Number of Steps- ',int2str(N),')'])
xlabel('t')
ylabel('Xt-X position')


figure

if d>1
plot(D(:,1),D(:,2),'.b')
else
plot(D(:,1)','.b')
end
axis([-2*s 2*s -2*s 2*s])
title(['X versus Y, ','( Number of Steps- ',int2str(N),')'])
xlabel('X position')
ylabel('Y position')


else

figure

%M=[0 ,0;K' ,X' ] ;
%plot(M(:,1),M(:,2),'.-b')
plot(cumsum(z(1,:)'),'.-')
title(['Xt versus t, ','( Number of Steps- ',int2str(N),')'])
xlabel('t-Number of walks')
ylabel('Xt-X position')
grid on

figure
plot(cumsum(z(1,:)'),cumsum(z(2,:)'),'.-b')
title(['X versus Y, ','( Number of Steps- ',int2str(N),')'])
xlabel('X position')
ylabel('Y position')
grid on;
end


% PART(B)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
N=10;
k=10000;
for i=1:k
z=(2*s).*(rand(d,N))-s;

vec=[zeros(1,d); cumsum(z')];

X(i)=vec(N+1,1);
if d>1
Y(i)=vec(N+1,2);
end
K(i)=i;
%plot(x(N+1,1),x(N+1,2),'.')

end



figure
if d>1
plot(Y,X,'.g')
else
plot(X,'.g')
end
title(['X versus Y, ','( Number of Steps- ',int2str(N),')'])
xlabel('X position')
ylabel('Y position')
hold on
grid on

N=1;
k=10000;
for i=1:k
z=(2*s).*(rand(d,N))-s;

for j=1:d
D(i,j)=cumsum(z(j,N));
%G(j)=cumsum(z(j,N));
K(i)=i;
end


end



plot(D(:,1),D(:,2),'.b')
%%axis([-2*s 2*s -2*s 2*s])
title(['X versus Y, ','( Number of Steps- ',int2str(N),')'])
xlabel('X position')
ylabel('Y position')


%PART C>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
N=1;
k=10000;
d=1;
for i=1:k
N=1;
z=(2*s).*(rand(d,N))-s;
H1(i)=z;


N=2;
z=(2*s).*(rand(d,N))-s;
t=cumsum(z');
H2(i)=t(N);

N=3;
z=(2*s).*(rand(d,N))-s;
t=cumsum(z');
H3(i)=t(N);


N=5;
z=(2*s).*(rand(d,N))-s;
t=cumsum(z');
H4(i)=t(N);

end
figure
h1=subplot(4,1,1);
hist(H1,50);



[mu,s]=normfit(H1)
normal=normpdf(H1,mu,s);


h2=subplot(4,1,2);
hist(H2,50);

h3=subplot(4,1,3);
hist(H3,50);

h4=subplot(4,1,4);
hist(H4,50);