Juan Carlos Ponce Campuzano

15-July-2018

Click on the image to make a new pattern.

Finite Blaschke product associated to 50 randomly chosen points in the unit disk.

Domain coloring is a method that allows us to represent complex functions by assigning a color to each point of the complex plane. The method involves basically two main ideas:

- Assign a color to every point in the complex plane.
- Color the domain of $f$ by painting the location $z$ with the color determined by the value $f(z)$.

It is common to use the color wheel because it is easy to
match the HUE values with the **phase** (argument)
of a complex number $z$ which is usually defined in the
interval $[0,2\pi)$, or $(-\pi, \pi]$.

To implement this method in the computer consider a rectangular region of pixels on the screen. This will be a discretized domain $D_h$ for the function $f$. Every pixel $i$ is identified with a complex number $z_i$ where $f$ is evaluated. Then calculate the phase of the value $f(z)$ and its corresponding color. Finally assign the resulting color to that pixel. This procedure is shown in the animation below.

Here you will find a set of tools to visualize and explore complex functions using different color schemes and also a gallery containing a wide range of examples.

If you want to know all the details about the implementation in JavaScript, check the source code available at GitHub. If you find useful these tools or found some issues, please let me know.

You can also support this project with:

∞ Thanks!

With the following tools you just need to enter the real and imaginary components of a complex function $$f(z)=\text{Re}(x, y)+ i \,\text{Im}(x,y).$$

Open the tool by clicking on the image.

Open the tool by clicking on the image.

I used the enhanced phase portrait based on the work of E. Wegert [see 16-19]. The Hue-Saturation-Brightness (HSB) color scheme is used. For plotting the level curves of the modulus I used the following equations:

\begin{eqnarray*}
\text{H}&=&\frac{\pi - \text{atan2}(y, -x)}{2\pi},\\
\text{S}&=&1,\\
\text{B}&=&\frac13\left(\log_{1.6}\left(\sqrt{x^2+y^2}\right)-\text{floor}\left(\log_{1.6}\left(\sqrt{x^2+y^2}\right)\right)\right)+0.7
\end{eqnarray*}

where $x,y$ are the real and imaginary components, respectively. The p5.js function colorMode() is
used for all tools.
Others things to try:

- Change the real and imaginary components.

**Example 1:**$f(z)=z^3-1$

**Re:**pow(x, 3)-3*x*y*y-1

**Im:**3*x*x*y - pow(y, 3)

**Example 2:**$f(z)=\log(z)$

**Re:**log(sqrt(x*x + y*y))

**Im:**atan2(y, x)

**Example 3:**$f(z)=\sin(z)$

**Re:**sin(x)*( ( exp(y) + exp(-y) ) / 2 )

**Im:**cos(x)*( ( exp(y) - exp(-y) ) / 2 )

List of available built-in functions is available here.

- Ablowitz, M. J. & Fokas, A. S. (2003).
*Complex variables: introduction and applications*(2nd ed). Cambridge University Press. - Breda, A. Trocado, A. & Santos, J. (2013). O GeoGebra para além da segunda dimensão.
*Indagatio Didactica*, 5(1). Accessed 12 June 2018 - Davis, J. E. (2017).
*Complex Domain Coloring*, Available online - Crone, L. (s.f)
*Color graphs of complex functions.* - Farris, F. (1998). Review of Visual Complex Analysis. By Tristan Needham.
*The American Mathematical Monthly*, 105(6), 570-576. - Farris, F. A. (n.d.).
*Visualizing complex-valued functions in the plane.* - Farris, F. A. (2017). Domain Coloring and the Argument Principle.
*PRIMUS*27:8-9, 827-844, DOI: 10.1080/10511970.2016.1234526 - Losada Liste, R. (2014). El color dinámico de GeoGebra.
*Gaceta De La Real Sociedad Matematica Española*, 17, 525–547, Madrid. - Lundmark, H. (2004).
*Visualizing complex analytic functions using domain coloring.* - Needham, T. (1997).
*Visual Complex Analysis.*Oxford University Press, Oxford. - Marsden, J. E. & Hoffman, M. J. (1987)
*Basic Complex Analysis.*(2nd ed.) W. H. Freeman and Co, New York. - Poelke, K. & Polthier, K. (2012) Domain coloring of complex functions: An implementation-oriented introduction.
*IEEE Computer Graphics Math & Applications*32(5), pp. 90-97, DOI: 10.1109/MCG.2012.100 - Ponce Campuzano, J. C. (2019) The use of phase portraits to visualize and investigate isolated
singular points of complex functions
*Journal International Journal of Mathematical Education in Science and Technology.*50(7), pp. 999-1010, DOI: 10.1080/0020739X.2019.1656829 - Thaller, B. (1998). Visualization of complex functions,
*Mathematica J.,*Vol. 7, issue 2, - Velleman, D. J. (2015). The Fundamental Theorem of Algebra: A Visual Approach.
*The Mathematical Intelligencer.*37, 12–21. - Wegert, E. (2010). Phase diagrams of meromorphic functions.
*Computational Methods and Function Theory.*10, 639-661. - Wegert, E. (2012).
*Visual Complex Functions: An introduction with phase portraits.*New York: Springer Basel. - Wegert, E. (2016). Visual exploration of complex functions. In T. Qian and L. R. Rodino (eds.),
*Mathematical analysis, probability and applications – Plenary Lectures SPMS*(Vol. 177. pp. 253–279). Switzerland: Springer International Publishing. - Wegert, E. & Semmler, G. (2011). Phase plots of complex functions: a journey in illustration.
*Notices American Mathematical Society,*58, 768-780. - Wikipedia:
*Domain Coloring*