from ds import DS from matplotlib.pyplot import plot, show, xlabel q = DS(h=None, x=0.1) r = 2.5 while r < 4: q.h = lambda x: r * x * (1 - x) t = q.trajectory(1000)[950:] plot([r] * len(t), t, 'k.', ms=0.4) r = r + 0.005 xlabel(r'$r$', fontsize=16) show()
# Filename: testds.py # Author: John Stachurski # Date: December 2008 # Corresponds to: Listing 4.3 from ds import DS # Import from listing 4.2 def quadmap(x): return 4 * x * (1 - x) q = DS(h=quadmap, x=0.1) # Create an instance q of DS T1 = q.trajectory(100) # T1 holds trajectory from 0.1 q.x = 0.2 # Reset current state to 0.2 T2 = q.trajectory(100) # T2 holds trajectory from 0.2