(* Number of iterations *)

nmax=100;

x[0]=0.4;

f[x_]:=1-2*x^2;

Do[x[n+1]=f[x[n]],{n,0,nmax}];

Show[ListPlot[Table[{n,x[n]},{n,1,nmax}]],Plot[{-1,-0.8,-0.6,-0.4,-0.2,0,0.2,
0.4,0.6,0.8,1},{x,1,nmax}]];

(* Number of bins, must be even *)

nb=10;

Do[bi[l]=0,{l,1,nb}];

(* interval in x *)

del=2/nb


(* I convert x[n] into a number bewteen 0 and 1 by adding 1 and then
dividing by 2; this number is then converted into a number between
0 and nb by mutiplying by nb*)

Do[bnumb=Floor[nb*(1+x[n])/2]+1; bi[bnumb]=bi[bnumb]+1,{n,0,nmax}];


uu=ListPlot[Table[{(2*l/nb)-1,bi[l]},{l,1,nb}], PlotJoined->True,
Frame->True, PlotRange->All];

(*Display["histquad.ps",uu,"EPS",ImageSize->500,ImageOffset->{50,150}];*)



aa=ListPlot[Table[{(2*l/nb)-1,bi[l]/(nmax*del)},{l,1,nb}], PlotJoined->True,
Frame->True, PlotRange->All];


bb=Plot[1/(Pi*(1-x^2)^0.5),{x,-0.999,0.999},PlotPoints->nb, PlotRange->All];

cc=Show[aa,bb];

Display["invmeasquad.ps",cc,"EPS",ImageSize->500,ImageOffset->{50,150}];

bi[1]