""" From "A SURVEY OF COMPUTATIONAL PHYSICS", Python eBook Version by RH Landau, MJ Paez, and CC Bordeianu Copyright Princeton University Press, Princeton, 2012; Book Copyright R Landau, Oregon State Unv, MJ Paez, Univ Antioquia, C Bordeianu, Univ Bucharest, 2012. Support by National Science Foundation , Oregon State Univ, Microsoft Corp""" # Bugs.py creates bifurcation diagram for Logistic Map #from visual.graph import * from pylab import * m_min = 1.0; m_max = 4.0; step = 0.025 lasty = int(1000 * 0.5) # to eliminate later some points count = 0 # to plot later every two iterations for m in arange(m_min, m_max, step): y = 0.5 for i in range(1,401,1): # to avoid transients y = m*y*(1-y) for i in range(201, 402, 1): # to avoid transients y = m*y*(1 - y) inty = int(10000 * y) if inty != lasty and count%2==0: plot(m,y,".b",markersize=1)# no repeats lasty = inty count += 1 show()