%Script file to run Experiment 3.6, The Computer May Lie. % We'll take 10 different initial seeds for each of % three functions: F(x)=x^2-2, G(x)=x^2+c for c<-2 % (Here, we'll take c=-3) % and the doubling function D(x) (double1). xF=4*rand(1,10)-2; %10 random numbers between -2 and 2 xG=rand(1,10); xD=rand(1,10); %Initialize the orbits: yF(1,:)=xF; yG(1,:)=xG; yD(1,:)=xD; %Get the next 100 points on the orbit: for i=2:100 yF(i,:)=xF.^2-2; xF=yF(i,:); yG(i,:)=xG.^2-3; xG=yG(i,:); yD(i,:)=double1(xD); xD=yD(i,:); end %Another check: Try a rational orbit. 1/9 is on a 6-cycle %for double1 x0=1/9; for i=1:100 y(i)=double1(x0); x0=y(i); end format long y'