# How to plot a complex function?

We cannot plot graph of a complex function $$f:\mathbb {C\to C}$$ as it requires $$4$$ dimensions.But we can show how the mapping transforms the domain plane into image plane.We can draw grid lines parallel and perpendicular to $$x$$-axis and see how the grid lines are modified.But often it becomes tedious task to plot these kind of diagrams.Is there any systematic procedure to draw such figures without help of any software?

For example , $$z^2,z^3,\sin(z),\log(z),\exp(z)$$ etc.

I want a method to visualize any given function.Is there a way out?  • Without help of any software?
– lhf
May 3, 2021 at 14:28
• @lhf yes,without software would be better,but I won't mind if you suggest me some software other than wolframalpha. May 3, 2021 at 14:30
• Very hard to do by hand. See also math.stackexchange.com/a/40308/589 and math.stackexchange.com/questions/3236021/…
– lhf
May 3, 2021 at 14:33
• Not an answer, but possibly of interest. May 3, 2021 at 14:46
• The grid lines keep one of the coordinates fixed, and the other coordinate acts as the parameter of a parametric equation, which you can eliminate. E.g. $$z\to z^2\leftrightarrow\begin{cases}x=u^2-V^2,\\y=2uV\end{cases}\leftrightarrow x=\frac{y^2}{4V^2}-V^2,$$ a family of parabolas.
– user974557
Oct 26, 2021 at 12:14

Some years ago, I have written a simple script in Python that can do it ... May be it can help you ? This just needs a (free) python distribution :

import matplotlib.pyplot as plt
import numpy as np

def func(z):
return z**2

def plot_conformal_map(f, xmin, xmax, ymin, ymax, nb_grid, nb_points):
xv, yv = np.meshgrid(np.linspace(xmin, xmax, nb_grid), np.linspace(ymin, ymax, nb_points))
xv = np.transpose(xv)
yv = np.transpose(yv)

zv = func(xv + 1j*yv)
uv = np.real(zv)
vv = np.imag(zv)

xh, yh = np.meshgrid(np.linspace(xmin, xmax, nb_points), np.linspace(ymin, ymax, nb_grid))

zh = func(xh + 1j*yh)
uh = np.real(zh)
vh = np.imag(zh)

ax = plt.subplot(121)
for i in range(len(yv)):
ax.plot(xv[i], yv[i], 'b-', lw=1)
ax.plot(xh[i], yh[i], 'r-', lw=1)

ax2 = plt.subplot(122)
for i in range(len(vv)):
ax2.plot(uv[i], vv[i], 'b-', lw=1)
ax2.plot(uh[i], vh[i], 'r-', lw=1)

plt.show()

nb_grid = 9
nb_points = 30

xmin, xmax, ymin, ymax = -1, 1, -1, 1

plot_conformal_map(func, xmin, xmax, ymin, ymax, nb_grid, nb_points)


And the output : https://imgur.com/a/Zp939Pc

• This is a mathematics site, not a programming or software implementation site. May 3, 2021 at 15:11
• You can delete my answer if needed but the author seems to be ok with any suggestion of software. Python is commonly used to plot functions. Sorry if it is not the answer expected. May 3, 2021 at 15:29
• Comment to asker: "Without the help of software?" Response from asker: "yes,without software would be better" Not everyone in math is fluent in python. May 3, 2021 at 15:32
• @ZosoLedZep it's ok.It helped a lot. May 3, 2021 at 15:41

Another popular way for plotting complex functions is domain coloring, which associates brightness with the modules of $$f(z)$$ and hue with its argument.

I recently write cplot, a Python package which makes creating these plots easy. For example, for the natural log: import cplot
import numpy as np

plt = cplot.plot(np.log, (-2.0, +2.0, 400), (-2.0, +2.0, 400))
plt.show()


cplot's gallery has many more cool examples.