Key concepts are marked in red .
More on Jupyter notebooks: www.jupyter.org
%pylab notebook
import warnings
warnings.filterwarnings('ignore')
$$ x_{t+1} = F(x_t)$$ $$ x_{t+1} = a x_t (1-x_t)$$
def ff(x):
return 4.0*x*(1-x)
xp=np.pi/10
for t in range(100):
x=ff(xp)
print(xp)
x1=xp
x2=x1+0.0001
x=np.array([x1,x2])
listx=[]
listt=[]
for t in range(100):
listx.append(x)
listt.append(t)
x=ff(x)
plot(listt,listx,'-o');
x1=0.34347036018297582682
x2=x1+0.000001
x=np.array([x1,x2])
listx1=[]
listx2=[]
listt=[]
for t in range(50):
listx1.append(x[0])
listx2.append(x[1])
listt.append(t)
x=ff(x)
plot(listt,listx1,'-o')
plot(listt,listx2,'-o')
x1s=np.array(listx1)
x2s=np.array(listx2)
pyplot.yscale('log')
xlabel("t")
ylabel("$|x(t)-x'(t)|$")
plot(listt,abs(x1s-x2s))
$$\Delta x(t) = \Delta x(0) e^{t \ln \lambda}$$
x=np.arange(0,1,1/50000)
for t in range(1000):
x=ff(x)
ylabel("$\rho(x)$")
xlabel("x")
plt.hist(x,normed=True,bins=100,color="red");
x=0.3141592653589
listx=[]
listt=[]
for t in range(50000):
listx.append(x)
x=ff(x)
plt.hist(listx,normed=True,bins=100,color="blue");
$$ \lim_{T\rightarrow\infty} \frac{1}{T} \sum_{t=1}^T h(f^t(x_0) = \int_0^1 h(x) \rho(x) dx $$
$$ \rho(x) = \frac{1}{\pi\sqrt{x(1-x)} }$$
x=np.arange(0,1,1/500000)
for t in range(100):
x=ff(x)
plt.hist(x,normed=True,bins=100,color="red");
y=np.arange(0,1,1/500)
plt.plot(y,1/(np.pi*np.sqrt((y*(1-y)))),"--",linewidth=2,color="black");