Friday, December 13, 2019

"Pattern" Drawing by Functions 3


import numpy,pylab; pi=numpy.pi 
def randi(nmin,nmax): return numpy.random.randint(nmin,nmax)
def x(a,b,t,k): return k*(numpy.cos(t)+numpy.cos(a*t)/2+numpy.sin((a+b)*t)/3)
def y(a,b,t,k): return k*(numpy.sin(t)+numpy.sin(a*t)/2+numpy.cos((a+b)*t)/3)
A,B=randi(5,11),randi(12,36); T=numpy.arange(0,2*pi,1/10**4)
pylab.figure(figsize=(10,10)); ax=pylab.gca(); ax.set_facecolor('ghostwhite')
for k in range(12):
    pylab.scatter(x(A,B,T,k),y(A,B,T,k),s=.1**3,c=[numpy.random.random(3)])
pylab.title('a=%d; b=%d'%(A,B)); pylab.grid(); pylab.show()

No comments:

Post a Comment