Michael Trott

T R O T T ' S C O R N E R

My favorite subject—Riemann surfaces—is revisited through the eyes (functions) of Mathematica 6. Old friends will appear in a new light(ing) and new acquaintances with untreated surfaces will be made.


This is my first column since Version 6 came out a few months ago. Version 6, after being in the works for many years, provides a wealth of new features that are useful in many numeric and symbolic calculations, advanced programs, visualizations, and elsewhere. With so many exciting new possibilities, it was not easy to decide what to discuss in this column. So instead of delving into a new subject, I think the best way to see some of the new features and resulting capabilities of Version 6 is to compare with some corresponding Version 5 results. That is why today I will come back to a subject discussed in earlier columns and demonstrate how to go quite a bit further with Version 6.

In earlier columns, I started discussing the visualization of Riemann surfaces. In this column, I want to come back to this mathematically (and aesthetically) beautiful subject. So far, we discussed the construction of Riemann surfaces of compositions of elementary functions with finitely many branch points (articles IIa to IId [14]). With the new 3D graphics system and interactive features of Version 6, new possibilities open up for visualizing Riemann surfaces; the main ones are:

  • Specifying vertex normals to obtain smooth-looking surfaces
  • Using opacity to get a better look “inside” a Riemann surface (instead of cutting holes in the polygons of the surface)
  • Using adaptive refinement of the built-in graphics functions to better resolve branch points
  • Using Manipulate to easily view a function as a 3D projection of the hypersurface (where showing and over the complex plane become special cases)
  • Using the Exclusions option to avoid branch cuts in Plot3D, ParametricPlot3D, and others

These features offer a fresh look at the topic of Riemann surfaces (so, if numbered, this would be article IIdII, not yet IIe, which will appear later and deal with special functions).

Starting with this column, I will also introduce a formatting change: Mathematica‘s default StandardForm is an ideal editing and reading environment for mathematical expressions and very small program snippets (one to two lines). Convenient automatic line breaking, two-dimensional fraction and radical formatting, and other features make writing and reading easy. But for multiline program-like code pieces, the formatted results are frequently less readable than manually formatting the code to avoid unexpected line breaks, alignments, and nonuniform line spacings. A new style in Version 6 (available as -8) is the "Code" style. It is the default style for packages (the canonical place to store a program) and can, of course, also be used in notebooks. It does not automatically break lines, but allows for special characters and inherits the new syntax coloring feature to maximize code readability. So, function definitions are given in "Code" style (easily identifiable in this notebook by its light blue background) and example uses of the defined functions will be in style "Input". In addition to an easier visual discrimination between actual definitions and example uses, this also allows for a quick selection of all definitions (using RIGHT) for immediate use without having to run all (sometimes time-consuming) examples to experiment with further Riemann surfaces.

The Updated Riemann Surface Package

We start with an updated version of the construction discussed in my earlier columns. Let us quickly recap the construction idea: Starting with a given function , a set of coupled nonlinear meromorphic differential equations is derived from and this set is solved on patches of the plane. These patches arise from a tensor product decomposition of the complex plane in a cylindrical coordinate system and are separated by branch points. The system of differential equations is solved numerically and the resulting function values are displayed. If at the same time we calculate , it is possible to construct the normals to obtain a smooth-looking surface. (Calculating the normals of the 3D embedding of can be done easily using the Cauchy-Riemann conditions.) An updated version of the package, based on the code from The Mathematica GuideBook for Numerics [5], is available on the Mathematica GuideBooks website (www.mathematicaguidebooks.org/V6/downloads/RiemannSurfacePlot3D.m).

This is the main function defined in the package.

The first example is displayed as over the complex plane.

The function has a few new options in addition to the built-in 3D graphics options.

Because 3D graphics in Version 6 are typically no longer made from individual polygons, but rather from GraphicsComplex objects that contain polygons and their adjacency information, it is possible to avoid the small gaps that were used in Version 5 between the patches. The function StitchPatches “stitches” the GraphicsComplex objects together along their boundaries. While in static images, the small (typically 1ppm or smaller) gaps are usually not visible; when interactively rotating graphics, such gaps can potentially become more pronounced.

Note that we do not have to specify a domain of the plane over which to plot the function. The domain is chosen automatically in such a way to include all finite branch points of the function.

Here is another example of a Riemann surface plotted with RiemannSurfacePlot3D.

In the next example, we display the imaginary part of over the complex plane and color the surface according to the real part.

Using a transparent surface makes it easier to see the inner parts of more complicated Riemann surfaces.

Here are some more examples.

RiemannSurfacePlot3D stores some intermediate time-consuming results for the function it has just plotted. As a result, once a function is plotted, calls to RiemannSurfacePlot3D with an identical first argument and mostly identical option settings, but a potentially different second argument, are generally quite fast.

Here is a demonstration that allows moving smoothly from the real to the imaginary part.

By parametrizing the three Cartesian coordinates as a linear form of , , , and , we can implement an even more general view of the surface. We do this through a Manipulate object that makes it easy to change any of the 12 parameters that define the actual function value that is plotted.

We give two examples: the first algebraic and the second inverse trigonometric.

Here is the inverse trigonometric function.

For details of the construction, see the package. Within the new package editor of Version 6, it is quite convenient and straightforward to experiment. Input cells are kept in the package and are easily evaluated; comments and examples can be easily embedded, but are invisible when the package is loaded. When developing or investigating package code with the package editor, we do not have to worry about contexts or saving outputs.

RiemannSurfacePlot3D fails for functions with infinitely many branch points. Here is an example.

The construction given next deals with functions having infinitely many branch points.

The New ContourPlot3D

ContourPlot3D, a package function in Version 5, is now a much faster built-in kernel function. This function comes in handy sometimes for polynomials dealing with Riemann surfaces. Here is a simple example that uses ContourPlot3D to display the real part of the functions defined implicitly through a bivariate polynomial.

Eliminating yields a (more complicated) trivariate polynomial that can be plotted.

Using the Exclusions Options

Now we will use new features of Plot3D and ParametricPlot3D to construct a Riemann surface. Using these 3D plotting functions on a function that has branch cuts, we now automatically get cuts along the branch cuts.

Modulo the mesh, in Version 5, we would have gotten a graphic similar to the following, much less appealing (but still correct) image.

We can also obtain descriptions of the excluded cuts using the function VisualizationDiscontinuities from the context Visualization`.

This neat feature of plotting functions that recognize branch cuts can be used to construct Riemann surfaces by finding parametrizations of all sheets and then plotting them. Instead of the steep vertical walls in earlier versions of Mathematica, we now get small cuts between the sheet patches. The analytic continuation of the logarithm and the power function are straightforward to define through adding multiples of and multiplication by .

For the logarithm, with its infinitely many sheets, we restrict ourselves to (typically) three sheets.

This list can be easily extended to elliptic integrals, Bessel functions, polylogarithms, and others.

The function makeSheetList generates a list of the analytically continued sheets of a multivalued function by forming the outer product of all sheets of all the multivalued functions that occur.

Here is an example. The function results in six parametrized sheets: three from the outer logarithm combined with two from the inner square root.

Here is a quick view on the branch cut structure of these six functions.

And here are the real and imaginary parts of the six sheets shown as 3D plots.

Emphasizing the cuts and making the surface transparent gives an even better looking graphic.

As a second example, we use . This time we have five sheets, all arising from the topmost fifth root.

Here is a plot of the real part over the complex plane.

The function RiemannSheetParametricPlot3D combines the sheet generation and plotting results. All sheets are included in the first argument of ParametricPlot3D, instead of making multiple calls to it. This has the advantage of getting better visual results because the optimal plot range will be calculated by taking all sheets into account.

Here are two examples of this function in action: one algebraic and the other a transcendental function containing .

Using RiemannSheetParametricPlot3D, we can now plot the Riemann surface of the function that failed earlier. We emphasize the vertical connection along the branch cuts through red polygons.

And here are four considerably more complicated examples. Because of the infinite number of branch points, the function RiemannSurfacePlot3D cannot handle them.

We generalize RiemannSheetParametricPlot3D to allow for a matrix as its second argument.

In effect, the next graphic shows over the , plane.

To summarize: Using analytically continued sheets and Plot3D/ParametricPlot3D with the Exclusions option lets you plot Riemann surfaces of compositions of elementary functions. This includes cases where the branch points cannot be calculated in closed form or the case of countably many branch points. Two potential disadvantages of this approach are that calculating the exclusions can be potentially very time consuming and the gaps arising from cutting out thin strips along potential branch cuts cannot be made arbitrarily small with reasonable computational effort.

Higher-Order Polynomial Roots

This is not unexpected. The internal function VisualizationDiscontinuities yields no exclusions for the Root object.

The reason is the quite large computational effort needed to determine the cuts for parametrized roots. While the branch points are relatively easy to determine as the common root of the function and its derivative through one resultant calculation, calculating the cuts is more expensive.

Expanding the first of the roots, we see the existence of three second-order branch points.

A discontinuity of a Root object occurs due to a switch in the root numbering. This in turn results from coinciding real parts of different roots. At the point where two roots have a common real part, the real part must have a double root. So carrying out the two resultant calculations gives a sufficient set of algebraic curves along which the roots will exhibit discontinuities.

Even for just a fourth root, evaluating rootExclusions is quite time consuming and the resulting polynomial is large and complex.

Here is a quick overview of the last polynomial.

Once the set of exclusions has been calculated, we can use it as the setting for the Exclusions option.

Life in Four Dimensions

Up to now, we have seen and over the complex plane (we plotted a more general graphic earlier). The most complete information of a function is the set of pairs of complex numbers or the quadruple of real numbers . Imagining the hypersurface in (isomorphic to ), we are naturally led to Banchoff’s tetraview [6] of a complex-valued function. In this section, we implement such a construction. Starting with a plot of the real and imaginary parts of a complex-valued function over the complex plane, we extract the underlying graphic complex, and re-evaluate the function at the , values. (Using the already discretized surface in the form of a GraphicsComplex gives us the advantage of adaptive subdivision.) Because we will use the values of the derivatives of with respect to for calculating the normals, we store the values of the derivatives at the (complex) vertex points in the option setting for VertexNormals.

We define a function RiemannSheetParametricPlots4D that generates a GraphicsComplex with vertex values in . (Here we use the suboption TimeConstraint in the Exclusions option to allow the calculation of more complicated exclusion sets for more complicated functions.) The sheets are generated using the function analyticallyContinue.

Here is an example. The abbreviated output shows that the actual 4D GraphicsComplex is quite large.

In the absence of a direct 4D viewer in Version 6 (or any support for Graphics4D, for that matter—hopefully Version 7 will have at least some), we must project into a 3D subspace to view the surface as a Graphics3D object. For a given projection matrix, this is straightforward for the vertices and not too difficult for the normals. Fortunately, having the information of the embedded hypersurface in 4D allows a projection with normals in 3D using the Cauchy-Riemann conditions, which will result in a smooth-looking surface. Because we will use the final function interactively, we use Compile to carry out the calculation of the 3D vertex coordinates and the 3D normals as efficiently as possible.

The function to3DGraphicsComplex carries out the projection from 4D to 3D.

Putting the last two functions together, we have TetraviewPlot. We give it the option ColorFunction4D, which operates on the unscaled 4D coordinates to easily color a surface.

Here are a few examples of the function TetraviewPlot.

The next example colors the surface of )) according to values of .

A convenient and natural way to parametrize the projection matrix is to use the six rotation angles between the four coordinate planes in .

In the definition for RiemannSheetParametricPlots4D, we used the line

to cache the result of the most time-consuming step inside TetraviewPlot. This allows us to implement a demonstration that interactively changes the 3D subspace selected.

This demonstration gives us a feeling for the 2D hypersurface. Branch point neighborhoods in correspond to flat regions in , and vice versa. As a result, the initial small gaps along the cuts of widen as we look at the 4D surface from different directions.

This ends our short visit into the world of Riemann surface visualizations with Mathematica 6. We will be coming back to this subject in future columns.


[1] M. Trott, “Trott’s Corner: Visualization of Riemann Surfaces IIa: Compositions of Elementary Transcendental Functions,” The Mathematica Journal, 7(4), 2000 pp. 465-496.
[2] M. Trott, “Trott’s Corner: Visualization of Riemann Surfaces IIb: Compositions of Elementary Transcendental Functions,” The Mathematica Journal, 8(1), 2001 pp. 50-62.
[3] M. Trott, “Trott’s Corner: Visualization of Riemann Surfaces IIc: Compositions of Elementary Transcendental Functions,” The Mathematica Journal, 8(3), 2002 pp. 409-432.
[4] M. Trott, “Trott’s Corner: Visualization of Riemann Surfaces IId: Compositions of Elementary Transcendental Functions,” The Mathematica Journal, 8(4), 2002 pp. 532-562.
[5] M. Trott, The Mathematica GuideBook for Numerics, New York: Springer-Verlag, 2006.
[6] T. F. Banchoff, “Computer Graphics in Geometric Research,” in Recent Trends in Mathematics: Conference in Reinhardsbrunn (Reinhardsbrunn 1982), (H. Kurke, J. Mecke, H. Triebel, and R. Thiele, eds.), Teubner-Texte Math., 50, Leipzig: Teubner, 1983 pp. 316-327.
M. Trott, “The Return of the Riemann Surface,” The Mathematica Journal, 2011. dx.doi.org/10.3888/tmj.10.4-1.

Michael Trott
Senior Member, Technical Staff
Wolfram Research, Inc.