Created
August 24, 2013 08:52
-
-
Save bensadeghi/6326973 to your computer and use it in GitHub Desktop.
a quick python gist for generating fractals using compositions of sin() and another function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt4.QtGui import QApplication | |
from pylab import * | |
ion() | |
ny = 600 | |
r = 1.25 | |
nx = ny*r | |
iters = 10 | |
grid = pi*2/3 | |
ay = flipud(linspace(-grid, grid, ny)) | |
ax = linspace(-grid*r, grid*r, nx) | |
z = complex128(tile(ax,(ny,1)) + transpose(tile(ay, (nx,1))*1j)) | |
u = exp(2*pi*1j*rand(1)) | |
subplot(121) | |
im_abs = imshow(abs(z)) | |
subplot(122) | |
im_angle = imshow(angle(z)) | |
for n in range(iters): | |
z = sin(u*z) | |
im_abs.set_data(abs(z)) | |
im_angle.set_data(angle(z)) | |
title(n+1) | |
draw() | |
QApplication.processEvents() | |
print("done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment