from pylab import plot,show,axis,subplot import cmath from numpy import * def cplxcircm(radius,center): """Returns an array z where every z[i] is a point on the circle's circumference on the complex plane""" teta = linspace(0,pi*2,150) z = [] for a in teta: # rotating of radius+0j of a radians and translation zc = (radius+0j)*cmath.exp(complex(0,a)) - center z.append(zc) return array( z, dtype=complex ) def jukowsi(z,L): return z+L/z # asimmetric Jukowski transformation # let's try the transformation on three different circles subplot(131) z = cplxcircm(1,complex(0.5,0)) #1st circle w = jukowsi(z,1) # applying the trasformation plot(real(z),imag(z),'b',real(w),imag(w),'r') axis('equal') subplot(132) z = cplxcircm(0.8,complex(0.4,0.3)) w = jukowsi(z,0.188) plot(real(z),imag(z),'b',real(w),imag(w),'r') axis('equal') subplot(133) z = cplxcircm(1.1,complex(0.1,0.0)) w = jukowsi(z,1) plot(real(z),imag(z),'b',real(w),imag(w),'r') axis('equal') show()The script shows the following figure. Every subplot shows two curves on the complex plane (x real values, y imaginary values), the blue curve is the starting curve and the red is the transformation.
Monday, July 18, 2011
Jukowsi Transformation
The following code applies the Jukowsi transformation to various circles on the complex plane.
Subscribe to:
Post Comments (Atom)
When I run the script I don't get any output, the script just runs for a second then exits
ReplyDeleteHi Gekitsuu, you need to call the method show() at the end of the program. I fixed the code in this page too.
ReplyDelete(radius+0j)*cmath.exp(complex(0,a))
ReplyDeletecan be written as
cmath.rect(radius,a)
in Python 2.6