María de los Ángeles Sandoval-Romero, Antonio Hernández-Garduño

## Domain Coloring on the Riemann Sphere NB   CDF   PDF

Domain coloring is a technique for constructing a tractable visual object of the graph of a complex function. The package complexVisualize.m improves on existing domain coloring techniques by rendering a global picture on the Riemann sphere (the compactification of the complex plane). Additionally, the package allows dynamic visualization of families of Möbius transformations. In this article we discuss the implementation of the package and illustrate its usage with some examples.

### 1. Introduction

Domain coloring is a technique that uses a color spectrum to compensate for the missing dimension in the graph of a complex function. It was first introduced in [1], with a detailed description of the complexplane case in [2]. A general definition is found in [3]. More precisely, consider a function between two sets (for example, two complex manifolds). Choose a color” function, , where denotes the HueSaturationBrightness standard color space. Next, for any , compute and evaluate the resulting color , assigning this color to the preimage . The final colored domain has all the information (through the color) needed to say where the point gets mapped. Of course, the effectiveness of domain coloring depends on the choice of an adequate color scheme .

Geometrically, the HSB color space is identified with an inverted solid cone. In cylindrical coordinates, HSB is parametrized by , where , , and . Then corresponds to the hue value of the visible spectrum, with , , and corresponding to red, cyan, and violet, respectively. The axis of the cone corresponds to zero saturation (purely a gradient of grays), and the external surface of the cone corresponds to full saturation. The brightness corresponds to the height of the cone, with (the vertex) being black and (the top) corresponding to full brightness.

This shows the HSB color space.

In other words, , with the equivalence given by for all , and identified as a single point, the vertex.

This article considers , where is the Riemann sphere: the complex numbers plus a single point at infinity (the north pole), embedded in , and , the color scheme, a usually injective map from the sphere to the solid inverted cone. Given , we call and the domain and image Riemann spheres, respectively. (The terminology source and target spheres is also used.)

The package complexVisualize.m renders the domain coloring of a complex function on the Riemann sphere. The two main commands defined in the package are complexVisualize and mobiusVisualize. The former renders the domain coloring of a generic ; the latter is optimized for Möbius transformations for the purpose of dynamic rendering. This article describes the packages implementation and illustrates its use with some examples.

In the color schemes that we explicitly consider here, the value of the hue is directly related to the argument of the image of the function, while the saturation and brightness are related to the modulus of the image values. Since a complex-valued function is determined by the argument and modulus of its image, the color scheme gives a complete global picture of the function.

The program also draws the preimage of the grid on the image sphere determined by its longitudes and latitudes. Furthermore, the preimages of three special geodesics are emphasized: the preimages of the equator are red, and the meridians corresponding to the intersections of the and planes with the image sphere are blue and green, respectively. These correspond to the unit circle and the real and imaginary axes on the image sphere.

To use the functions in this article, make sure the \$Path variable points to the file complexVisualize.m (Mathematicas front end menu command FileInstall does this automatically) and load it.

### 2. Domain Coloring

In this section we continue to elaborate on the theory of domain coloring and discuss the main ideas behind the implementation of the package complexVisualize.m. We also take a close look at the implementation of some color schemes.

#### 2.1. Implementation of Domain Coloring

Let us now formalize the concepts behind domain coloring and develop the code that provides its basic implementation.

The code in the next two subsections is self-contained and should be evaluated sequentially. The code in the third subsection requires loading the package complexVisualize.m.

##### Main Ideas and Basic Implementation

Given a complex function , let

satisfy the condition , where is the projection . Recall that is interpreted as the HueSaturationBrightness space. Such a function is referred to as the color scheme. Domain coloring can be understood as the implementation of the composition to assign color to the domain of .

This technique can be extended to the Riemann sphere . Identifying with the plane in , the stereographic projection

is defined by the requirement that , , and are collinear, while . The function induces

defined by , with , provided that the limit exists in . (In the packages documentation, the domain and image of are referred to as source and target, respectively.)

Figure 1. Stereographic projection.

The coordinate realization of the stereographic projection is deduced from Figure 1 as follows. Let and . Let , , and .

By similar triangles,

so

Note that for . Thus,

and hence

So define a function from the plane to the sphere and its inverse.

A color scheme on the Riemann sphere is a function such that , where are spherical coordinates on , and again denotes projection onto . Domain coloring is implemented, essentially, by a parametric plot.

Here colorfunction is, conceptually, given by .

For example, consider the function and color scheme :

where the function corresponds to the command Hue[x]. To start, transform to its vector form.

For example, here is the vector form of .

Choose the color scheme to be .

Therefore this is .

This is the domain coloring of .

Figure 2. Domain coloring associated with theFunction using the chosen colorScheme1; see equations (1).

Remark. The reader may already experiment at this point with different functions or color schemes by running the previous commands with a different definition of theFunction or colorScheme1.
##### The Reference Lines

The information given by the domain coloring can be complemented by displaying the preimages of the standard reference lines.

Table 1. Default colors for reference lines.

These preimages are given, respectively, by , , and , where , and . This defines the projections , , and .

This defines the reference lines.

This shows the domain coloring in Figure 2 complemented with the preimages of the reference lines.

Figure 3. Domain coloring of function and color scheme (1), showing reference lines.

##### The Package complexVisualize

The command complexVisualize, provided by the package complexVisualize.m, automates the domain coloring so far described and adds the following features:

1. The inclusion of the Cartesian , , and axes (colored blue, green, and black).
2. These Cartesian axes serve to orient the reader with respect to the location of 1, , and infinity on the domain Riemann sphere. (We also refer to the Cartesian and axes as the real and imaginary axes, since the inverse stereographic projection sends those axes to the meridians representing the real and imaginary lines on the domain .)

3. The rendering of the pullback of the standard mesh determined by the spherical coordinate parametrization of the target .
4. This pulled-back mesh complements the visual cues given by the pullback of the three reference lines. Its implementation follows the same idea used previously to draw theReferenceLines, that is to say, using the options Mesh and MeshFunctions within the sphere rendering by ParametricPlot3D.

5. Most importantly, a simple and flexible syntax, with the ability to call various options defined by the package.
6. These options (specifying the number or color of mesh lines, for example) let you fine-tune the domain coloring of a given complex function. Standard Mathematica options can also be called.

The command complexVisualize has the following simple syntax.

To illustrate it, consider the working example, the domain coloring of with the same color scheme .

Here is an alternate rendering with a different color scheme.

We omit here the discussion of how the various options are implemented. The interested reader may consult the help documentation for individual options or review their implementation in the package.

An exception must however be granted to the option colorScheme, which deserves a careful discussion; it is clear that different color schemes will emphasize different features of a given complex function.

#### 2.2. Color Scheme

The color scheme is specified with the option colorScheme.

With the setting , the color scheme function is implemented with azimuthColorScheme.

This coloring only keeps track of and not the modulus. Although this seems rather restrictive, it is satisfactory in many examples. Indeed, the argument principle (see [4]) is usually enough to distinguish between zeros and poles without a visual cue coming from .

To keep track of both the argument and the modulus of the function, use the option with , .

This implements the corresponding color scheme function .

The saturation and brightness are given by bump functions.

Figure 4. Saturation and brightness for color scheme azimuthLatitude[a,r].

The net effect is that close to zeros of the function, the coloring tends to darken, while close to poles the coloring tends to whiten. This is because on the target , zero corresponds to (the south pole) and infinity corresponds to (the north pole). The parameters and fine-tune how this effect is achieved. The rational function shown in Section 3.2 gives a nice illustration of the azimuthLatitude color scheme.

A somewhat less sophisticated but attractive method of getting the dark zeros and bright poles effect is to use the color scheme function .

This is invoked with the setting . The saturation and brightness curves associated with this color scheme are shown in Figure 5, and its usage is illustrated in Section 3.2.

Figure 5. Saturation and brightness for color scheme metallic.

### 3. Examples

This section lists domain coloring examples, which illustrate the concepts discussed so far.

#### 3.1. The Identity

Here is the domain coloring of the identity function .

This seemingly trivial example familiarizes us with the essence of domain coloring: is represented by the hue, and as () the color darkens (brightens), assuming you use . The real and imaginary axes are clearly shown in blue and green, respectively. The unit circle is the equator, shown in red.

Additionally, the , , and axes are always drawn by complexVisualize in blue, green, and black, respectively. Their purpose is to keep track of the Riemann sphere in its role as the domain of the function, with , , and located, respectively, at the intersection of the , , and axes with the sphere.

#### 3.2. A Rational Function

The domain coloring of the rational function

serves to illustrate the global information that we get working on the Riemann sphere, as well as the nature of the zeros and poles.

Here is a rational function.

This example shows an important result in complex analysis, the argument principle [4]: the number of total hue variations and orientation show the nature (type and order) of isolated singularities. The brightness and saturation complement this information, with total brightness with zero saturation corresponding to a pole, and zero brightness corresponding to a zero. See Section 2.2 for a description of the color scheme azimuthLatitude used in this example.

#### 3.3. Another Rational Function

Next we illustrate the domain coloring of the rational function

using an alternate color scheme that we have called metallic, whose definition is also discussed in Section 2.2. The subtler variations in saturation and brightness still give a visual cue to the location of the zeros and poles.

#### 3.4. A Polynomial Function

Next, let us look at a polynomial like .

This example illustrates the relevance of having a compact domain, the Riemann sphere, to deal with isolated singularities. Indeed, whenever a function has no essential singularities, the number of zeros and poles, counted with multiplicity, coincide. This is of course a consequence of the fact that the Euler characteristic of the sphere is , so its genus is zero.

#### 3.5. Transcendental Functions

Essential singularities have a visual interpretation closely related with the great Picard theorem [4]. Indeed, at an essential singularity we expect to observe an infinite variation of color.

Here are the circular and hyperbolic cosines.

Apart from observing the essential singularities at infinity, the relation becomes evident as a rotation of the coloring around the axis. Other identities between circular and hyperbolic trigonometric functions can be visualized in a similar fashion.

To give one more example of a transcendental function, let us look at the baroque coloring that we get with the function

### 4. Dynamic Visualization

Given a family of complex functions, an attractive possibility is the use of Mathematicas dynamic graphical capabilities provided by the Manipulate command to observe how the domain coloring changes as we move around the given function family.

One class of complex functions that lends itself to dynamic visualization is the class of Möbius transformations. There have been important efforts to construct optimal computational models that characterize the geometry of the Möbius group, one of the most popular being [5]. Our approach here is to construct a Manipulate in which the reference curves (i.e., the preimages of the real and imaginary axes, as well as the preimage of the unit circle) are drawn while parameters are dynamically varied. Once variation of the parameters stops, the rest of the elements of domain coloring are rendered.

The Möbius transformations constitute the set of all linear rational functions on the extended complex plane, which is identified with the set of all conformal automorphisms on the Riemann sphere [6], also called the Möbius group:

It is well known [7] that

where is the general (special) linear group with complex entries and denotes its center.

#### 4.1. A Useful Characterization

A Möbius transformation is completely characterized by the preimages of , , and , which we will refer to as , , and , respectively. Indeed, it is easy to see that in terms of these parameters

Thus, dynamic visualization of Möbius transformations can be implemented by assigning a 2D controller to each of the parameters , , . Note that a point on the rectangle gets mapped to through the use of cylindrical coordinates:

Since a Möbius transformation, viewed as conformal automorphisms in , sends circles to circles, the preimages of the reference curves (the real axis, the imaginary axis, and the unit circle) are circles on . We call them reference circles. Using the Manipulate option ControlActive, a fast-rendering version of complexVisualize can be implemented, in which only the reference circles are drawn. To this effect, it suffices to characterize each reference circle by three points.

Table 2. Reference curves determined by three preimage points.

Here . Each reference circle is drawn by the elementary geometric construction described in the following. The simplicity of the construction translates in an instantaneous rendering, which allows a dynamic visualization with the command Manipulate.

#### 4.2. Drawing the Three Reference Circles

We now describe the implementation of the geometric construction that quickly renders the three reference circles associated with a given Möbius transformation.

##### Drawing a Circle through Three Points on

Given three points , , on the unit sphere, the circle passing through them is given by

where is the position vector of the center of the circle

and

with , and where denotes the normalization operator .

Here is the corresponding code.

The function circleThroughThreePoints fails when , , and are collinear. This, however, is guaranteed not to occur, because the command is only applied to three distinct points on the sphere, which are thus never collinear.

##### Drawing the Three Reference Circles on : Implementation

Given a Möbius transformation , this recovers its coefficients.

This gives its five preimages , , , , .

Since ComplexInfinity is an acceptable point in , we switch off the warning in the declaration of fivePreImages.

These five preimages need to be located on the Riemann sphere , and this is achieved by stereoInv, the inverse of the stereographic projection.

According to Table 2, given , each reference circle is in correspondence with each triple in the list.

This finishes all the necessary ingredients needed to draw the reference circles associated with a given Möbius transformation. Let us implement the procedure with an example.

##### Drawing the Three Reference Circles on : Example

Let us write the code that renders the reference circles for the Möbius transformation

This defines the function.

Here are the preimages under of , , , , and , regarded as points on the Riemann sphere .

Hence, using the color code in Table 1, here is how the three reference circles are rendered.

Finally, here are the three reference circles rendered on the Riemann sphere .

#### 4.3. The Command mobiusVisualize

The procedure discussed is implemented with the command mobiusVisualize, which is also part of the package complexVisualize.m.

The main option for this command is fastRender. With , mobiusVisualize simply invokes complexVisualize to do the rendering. With the (default) setting , the procedure described in the previous two subsections is invoked in order to draw the reference circles.

For example, here is the Möbius transformation defined in (2).

The command mobiusVisualize can be customized like complexVisualize through options, both the ones defined in the package and most of the standard ParametricPlot3D options. The interested reader can consult all the details in the package.

The point of having the ability to switch off the coloring (through the option fastRender) is that we can now implement a fast dynamic Manipulate to visualize families of Möbius transformations.

#### 4.4. Dynamic Visualization of Möbius Transformations

The command cylC handles the 2D controllers representing complex parameters on .

Here is a Manipulate allowing dynamic visualization of the group .

The wrapper ControlActive in the option assignment to fastRender enables an instantaneous redrawing of the reference circles as the parameters are varied.

This example can be regarded as a first step in an exploration of how Manipulate and mobiusVisualize can be used together to dynamically visualize the generators and subgroups of .

#### 4.5. Generators of

To further illustrate the dynamic visualization of Möbius transformations using a Manipulate, consider the generators of the group of : translations, complex multiplication, and complex inversion.

##### Translations

This shows all pure translations , with . Experiment by varying the value of the parameter .

##### Complex Multiplication

This shows complex multiplication , with .

On the complex plane, complex multiplication is a homothety followed by a rotation, both with respect to the origin. The preceding Manipulate shows how rotations with respect to the origin become rotations around the axis. The effect of a homothety also becomes visually evident as a transformation in .

##### Inversion

The complex inverse function is . A homotopy continuously relating the identity with inversion is given by

so that and .

The following animation shows this homotopy.

It becomes evident that on , the geometry of a complex inversion is simply a rotation around the real axis. Note that the simplicity of this homotopy is lost when we try to visualize it purely in the complex plane.

### Conclusion

The package complexVisualize.m is a robust and flexible tool for generating global domain coloring for holomorphic, meromorphic, and conformal functions of one complex variable, which makes it a valuable exploratory and didactic tool. We have described the main ideas behind its implementation and examples of its use.

You can experiment with further applications. Some ideas for classroom demonstrations are: (a) a sequential rendering of the Taylor expansion of a transcendental function in increasing degree; (b) exploration of the subgroups of Möbius transformations; and (c) exploration of different color schemes.

With the colorScheme option it is possible to implement any color rule with an appropriate function between the HSB space and the Riemann sphere. This allows the program to generalize color schemes that have appeared in the literature in the planar case.

Being on the Riemann sphere, the global character of domain coloring gives a visual interpretation of various fundamental complex analysis results. Here we have shown only a few.

When working with automorphisms on the Riemann sphere, it is possible to construct Manipulate animations of families of domain colorings. This dynamic visualization allows geometrical interpretations of the fundamental properties and results of these transformations to be given in an accessible and comprehensive manner.

There are many possibilities for extending the reach of the visualizations considered here. Probably the most obvious line of exploration is a deeper analysis of multifunctions on general Riemann surfaces, for which [3] is a good starting point.

### Acknowledgments

The authors wish to thank Prof. Ricardo Berlanga Z. for encouragement and useful insight on the subject matter of this paper. The first author acknowledges the support of IxtliUNAM under project IX100310.

### References

 [1] F. A. Farris. “Visualizing Complex‐Valued Functions in the Plane.” (Jun 15, 2015) www.maa.org/visualizing-complex-valued-functions-in-the-plane. [2] H. Lundmark. “Visualizing Complex Analytic Functions Using Domain Coloring.” (Jun 15, 2015) users.mai.liu.se/hanlu09/complex/domain_coloring.html. [3] K. Poelke and K. Polthier, “Lifted Domain Coloring,” EuroVis’09, Proceedings of the 11th Eurographics / IEEE-VGTC Conference on Visualization, Berlin, Germany, June 10–12, 2009, Computer Graphics Forum, 28(3), 2009 pp. 735–742. doi:10.1111/j.1467-8659.2009.01479.x. [4] L. V. Ahlfors, Complex Analysis: An Introduction to the Theory of Analytic Functions of One Complex Variable (International Series in Pure and Applied Mathematics), New York: McGraw‐Hill, 1953. [5] D. Arnold and J. Rogness. “Möbius Transformations Revealed.” (Jun 15, 2015) www.ima.umn.edu/~arnold/moebius. [6] J. Milnor, Dynamics in One Complex Variable, 3rd ed., Princeton: Princeton University Press, 2006. [7] G. Toth, Finite Möbius Groups, Minimal Immersions of Spheres, and Moduli, New York: Springer‐Verlag, 2002. A. Sandoval-Romero and A. Hernández-Garduño, “Domain Coloring on the Riemann Sphere,” The Mathematica Journal, 2015. dx.doi.org/doi:10.3888/tmj.17-9.

• complexVisualize.m

Ángeles Sandoval-Romero is a full professor at Universidad Nacional Autónoma de Mexico, Facultad de Ciencias, Department of Mathematics. She obtained her Ph.D. in mathematics from UNAM in 2006 with a dissertation on scattering theory applied to a system of nonlinear partial differential equations. Her research interests include geometric complex analysis, differential equations, and their applications.

Antonio Hernández-Garduño is a professor in the Mathematics Department of Universidad Autónoma Metropolitana (campus Iztapalapa) in Mexico City. He obtained his Ph.D. from Caltech in 2002 with a dissertation on the bifurcation of relative equilibria in mechanical systems. His research interests include geometric mechanics, vortex dynamics, celestial mechanics, and computer-based math education.

Ángeles Sandoval-Romero
Departamento de Matemáticas