import numpy,pylab
def gen(a,b,n):
i=1; xyi=[0.,0.]
while i<=n:
yield xyi; i+=1; xi,yi=xyi[0],xyi[1]
xyi=[1-(.2+.01*a)*xi**2+yi,(0.9991+.0001*b)*xi]
for [a,b] in [[0,0],[-11,-19987]]:
n=300000; xy=gen(a,b,n); xyn=numpy.array([el for el in xy])
pylab.figure(figsize=(10,10)); ax=pylab.gca(); ax.set_facecolor('lightgray')
pylab.scatter(xyn[:,0],xyn[:,1],s=.3,c=[numpy.random.random(3)])
pylab.grid(c='slategray',alpha=.4); pylab.show()
No comments:
Post a Comment