Friday, December 13, 2019

Random Coefficients in Trigonometrics 2


import numpy,pylab,random; r=[-1,0,1]; th=.1+random.random()
a,b,c=random.randint(1,3),random.randint(4,6),random.randint(2,4)
d,e,f=random.randint(9,11),random.randint(14,16),random.randint(1,3)
t=numpy.arange(0,2*numpy.pi+.5,1/10**random.randint(1,3)) 
fx=-d*numpy.cos(t)-f*numpy.cos(b*t)+e*numpy.sin(a*t)
fy=-e*numpy.cos(a*t)+d*numpy.sin(t)-f*numpy.sin(b*t) 
fz=d*numpy.cos(c*t)
fig=pylab.figure(figsize=(12,12)); ax=fig.gca(projection='3d')
for i in r:
    for j in r:
        for k in r:
            col=[random.random() for l in range(3)]
            ax.plot(i*fx,j*fy,k*fz,c=col,linewidth=th)
pylab.title('a=%d; b=%d; c=%d; d=%d; e=%d; f=%d'%(a,b,c,d,e,f))
pylab.axis('off'); pylab.show()

No comments:

Post a Comment