I'm trying to make a bifurcation diagram for the following iterated map:
x_n+1 = x_n * e^(r(1-x_n)).
First I defined the map:
def newmap(x,r):
return x*math.exp(r*(1-x))
Then I tried this:
def bifurcation_diagram(rmin=0, rmax=4, r_N=2000, N_min=4000, N = 1000):
rspace = np.linspace(rmin, rmax, r_N)
x = 0
rset = []
xset = []
for r in rspace:
for i in range(N_min + N):
x = newmap(x,r)
if i > N_min:
rset.append(r)
xset.append(x)
plt.figure(figsize=(16,7))
plt.xlim((rmin,rmax))
plt.ylim((0,5))
plt.scatter(rset,xset,s=0.3,c='C0',linewidth=0)
plt.xlabel(r'r', fontsize=20)
plt.ylabel(r'$x_{end}$', fontsize=29, rotation=0)
plt.show()
When I try bifurcation_diagram() I get a blank plot.
I'm not sure where I'm going wrong here.