Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # this draws a julia set
- # feel free to use, modify, fly and do anything you want
- import numpy
- screenx=800
- screeny=600
- # This defines the set
- c=complex(-0.123,0.745)
- real_min, real_max=-2.0,2.0
- imag_min, imag_max=-2.0,2.0
- real_range=numpy.arange(real_min,real_max,(real_max-real_min)/screenx)
- imag_range=numpy.arange(imag_min,imag_max,(imag_max-imag_min)/screeny)
- fout=open('julia.ppm','w')
- fout.write('P2\n'+str(screenx)+' '+str(screeny)+'\n255\n')
- for im in imag_range:
- for re in real_range:
- z=complex(re,im)
- n=255
- while abs(z)<10 and n>=5:
- z=z*z+c
- n-=5
- fout.write(str(n)+' ')
- fout.write('\n')
- fout.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement