%Illustrates the arc sine law as the invariant density of L4
% But you can also choose mu to be something other than 4
%close all
%clc
%colormap(cool)
m=input('Please enter the number of iterates: ');
N=input('Please enter the number of intervals: ');
mu=input('Please enter the parameter mu for the logistic function: ');
r=(m+1)/N;
d=1/(2*N);
x=zeros(m+1,1);
x(1)=rand;
for j=1:m
	x(j+1)=logistic(x(j),mu);
end
colormap(cool)
hist(x,linspace(d,1-d,N));
hold on
if mu == 4
  z=linspace(.001,.999,400);
  w=r./(pi*(z.*(1-z)).^(1/2));
  plot(z,w,'r')
end
