The graph I want to calculate and draw is the picture above.
from matplotlib import pyplot as plt
from numpy import *
def f(z):
return (1/z)
#r is radius, p is radian
#below is strange part
for r in linspace(0,1,50):
for p in linspace(0,2*pi,50):
Z1=array([complex(r*cos(p),r*sin(p))])
W1 = f(Z1)
plt.figure(figsize=(8,8))
plt.xlim(-pi/2,pi,2);plt.ylim(-pi/2,pi/2)
for i in range(0,2499):
plt.plot(real(W1[i]), imag(W1[i]), c='b', lw=1.5, ls='-')
plt.axvline(x=0,color='k', lw=1)
plt.axhline(y=0,color='k', lw=1)
plt.show()
code is a circle with a center of (0,0) and a radius of 1.
I am new to Python, so the code is still incomplete,
but something is strange, so please fix it.
Or if there is a better way, please let me know.