Domain coloring

Domain coloring

Visualizing complex functions

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.







Introduction

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:

  1. Assign a color to every point in the complex plane.
  2. 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]$.


Color-Wheel
Color wheel correspondence with values from $0$ to $2\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.


Procedure

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!







Basic Tools: Real and Imaginary components

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.

HSB

HSB enhanced scheme

Plots the level curves of the modulus and phase of $f(z)$.

HSBReIm

HSB enhanced scheme

Plots the level curves of the modulus, imaginary and real components of $f(z)$.

RGB

RGB enhanced scheme

Plots the level curves of the modulus and phase of $f(z)$.





Advanced Tools: General complex functions

Open the tool by clicking on the image.

HSB

HSB enhanced scheme

Plots the level curves of the modulus and phase.

HSBReIm

HSB enhanced scheme

Plots the level curves of the modulus, imaginary and real components.

HSBsmooth

HSB smooth enhanced scheme

Plots the modulus using a Gradient method.


RGBfull

HSB enhanced scheme

Plots the level curves of the modulus and phase.

BW-full

Black & White enhanced scheme

Plots phase, modulus, real and imaginary components.

Discrete

Discrete enhanced color scheme

Plots the modulus of and a discrete phase.


RGBfull

HSL enhanced scheme

Plots the level curves of the modulus and phase.

BW-full

HSLuv scheme

Plots the level curves of the modulus and phase.





WebGL-based complex function plotter


(z-1)/(z^2+z+1)

Conformal mapping

(z-1)/(z^2+z+1)

Domain coloring







Extra details about the basic tools

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:




References

  1. Ablowitz, M. J. & Fokas, A. S. (2003). Complex variables: introduction and applications (2nd ed). Cambridge University Press.
  2. Breda, A. Trocado, A. & Santos, J. (2013). O GeoGebra para além da segunda dimensão. Indagatio Didactica, 5(1). Accessed 12 June 2018
  3. Davis, J. E. (2017). Complex Domain Coloring, Available online
  4. Crone, L. (s.f) Color graphs of complex functions.
  5. Farris, F. (1998). Review of Visual Complex Analysis. By Tristan Needham. The American Mathematical Monthly, 105(6), 570-576.
  6. Farris, F. A. (n.d.). Visualizing complex-valued functions in the plane.
  7. Farris, F. A. (2017). Domain Coloring and the Argument Principle. PRIMUS 27:8-9, 827-844, DOI: 10.1080/10511970.2016.1234526
  8. Losada Liste, R. (2014). El color dinámico de GeoGebra. Gaceta De La Real Sociedad Matematica Española, 17, 525–547, Madrid.
  9. Lundmark, H. (2004). Visualizing complex analytic functions using domain coloring.
  10. Needham, T. (1997). Visual Complex Analysis. Oxford University Press, Oxford.
  11. Marsden, J. E. & Hoffman, M. J. (1987) Basic Complex Analysis. (2nd ed.) W. H. Freeman and Co, New York.
  12. 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
  13. 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
  14. Thaller, B. (1998). Visualization of complex functions, Mathematica J., Vol. 7, issue 2,
  15. Velleman, D. J. (2015). The Fundamental Theorem of Algebra: A Visual Approach. The Mathematical Intelligencer. 37, 12–21.
  16. Wegert, E. (2010). Phase diagrams of meromorphic functions. Computational Methods and Function Theory. 10, 639-661.
  17. Wegert, E. (2012). Visual Complex Functions: An introduction with phase portraits. New York: Springer Basel.
  18. 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.
  19. Wegert, E. & Semmler, G. (2011). Phase plots of complex functions: a journey in illustration. Notices American Mathematical Society, 58, 768-780.
  20. Wikipedia: Domain Coloring

Creative Commons License