The graphs of complex-valued functions or functions of the type are in general two-dimensional manifolds in the space . The article presents a method for the visualization of such a graph. The graph is first projected to three-dimensional space with parallel projection and the image—the surface in three-dimensional space—is rendered on the screen in the usual way. The visualization can be improved in two ways: the graph can be rotated in four-dimensional space or the direction line of the projection can be changed, which means that the observer flies around the graph in four dimensions. The animation and manipulation capabilities of *Mathematica* are appropriate tools for the purpose.

### Introduction

Complex-valued functions , that is, functions of the form , can be visualized by putting a rectangular or a polar grid in the - plane and plotting the image of the grid in the - plane. The type of grid used depends on the function. More generally, the method can be used for any function , .

The standard package `Graphics`ComplexMap`` had tools for visualizing complex-valued functions in this way. The new two-parameter form of now provides the functionality of `Graphics`ComplexMap``. As an example we consider the function .

We can say that the map “folds” the - plane in some way and the result—the image—is flattened out on the - plane. As you can guess from the plot, the image somehow overlaps itself on the left and the right.

Actually, the graph of this type of function is a two-dimensional manifold (a surface) in four-dimensional space with , , , and as the axes. To get a better visualization, the surface should not be flattened out in two dimensions. One way to do this is to take a third axis and lift the surface up from the plane.

The following two examples show the same function with and as the third (vertical) axis.

The plots look very different although the same part of the surface is considered. The difference becomes clear if we take a larger part of the surface.

In the second plot with as the vertical axis, the surface overlaps itself so many times that we cannot see its characteristic features. The first plot with as the vertical axis shows the well-known visualization of as a Riemann surface.

Many good plots of this type and analysis of the corresponding surfaces and functions can be found in [1-4] by Michael Trott and [5] by Corless and Jeffrey.

The two plots can be considered from another point of view. They are both images of the graph of the function in a parallel projection . In the first case, the projection direction is parallel to the axis and the image (the range of the projection mapping) is the three-dimensional subspace spanned by the three other axes. In the second case, the projection direction is parallel to the axis. Both projection mappings are orthogonal, that is, the image space (or the range of the mapping) is the orthogonal complement of the projection direction.

This opens a new way to show the graph of a function , . The graph is a two-dimensional manifold in the space and any projection mapping can be used to form its image in . This is (in general) an ordinary surface and usual methods can be used to plot it. The projection mapping can be a parallel projection or a perspective projection. The parallel projection may have any direction. The parallel projection may be orthogonal or oblique. (Of course, `ParametricPlot3D` also uses some projection methods to plot a two-dimensional graphic of a three-dimensional object on a computer screen. Thus, to display an object from four-dimensional space, two consecutive projection mappings are used.)

In the following, we first develop some tools and then use them to create images and animations of some geometric objects from four-dimensional space.

### Tools

A parallel projection in three-dimensional space can be defined by giving the direction of the projection (say, a column vector with three components) and the normal vector of the two-dimensional image plane (a column vector with three components). The placement of the plane is not important because the image projected on the plane does not change when the plane is moved without changing its direction. Therefore, we may assume that the origin is in the plane. Then, the matrix of the projection mapping is given by , where is the identity matrix.

If is the coordinate vector of the point Q, then gives the (three-dimensional) coordinate vector for the image point . To get coordinates in the two-dimensional plane, a basis must be chosen and the coordinates transformed appropriately. (See [6] for examples.)

The approach can be generalized to the four-dimensional case and we give the following code to compute the matrix of a parallel projection. Here `s` is the direction of the projection line and `b` stands for the basis vectors of the three-dimensional image space.

We need a special type of rotation to generate animations in four-dimensional space. Here, a two-dimensional subspace is invariant and the rotation acts in the orthogonal complement of this subspace. If the vectors `a` and `b` span the invariant subspace and `w` is the angle of rotation, the matrix of the rotation mapping can be generated as follows.

We may also need orthonormal bases for orthogonal complements of given vectors. The following function gives an orthonormal basis where the first vectors span the same subspace as the vectors in `b`.

The graph of the function in four-dimensional --- space is represented by a net of polygons that is generated by the following function.

Here `w` is the four-dimensional expression of the function with `x` and `y` as variables. For example, or , where

or

The following test may also be needed.

### Simple Example

First, we consider the function . We use polar coordinates to get beautiful pictures.

We generate a parallel projection to view an animation. The projection direction is parallel to the vector . The three other vectors form the basis of the image space (which is the orthogonal complement of the projection direction).

In the animation we rotate the graph of the function in four-dimensional space. The rotation fixes the - plane (i.e., the vectors and are invariant).

Next to the graph of the function we also plot the four axes of the four-dimensional space. The following gives the necessary definition.

In the animation we may rotate the graph or we fly around it, that is, rotate the projection mapping. Rotating the graph gives the following animation.

Here is an animation of the flight around the graph.

We get a more interesting animation if the rotation happens in the - plane.

This frame shows that the surface does not intersect itself, so there is no real intersection in four dimensions, either.

### Function

We may analyze the function in a similar manner. In this case, it is better to use rectangular coordinates.

### Toward a Better Animation

With the function `Manipulate` we can create animations in which the user may easily control the view.

We will use four-dimensional spherical coordinates for defining the necessary parallel projection mappings. The viewing direction—or the direction of the projecting line—is then

where `th1`, `th2`, and `ph` are the three angles of spherical coordinates. The three-dimensional image space is the orthogonal complement of this direction. It is spanned by the following orthonormal vectors:

The projection mapping is

and with `Manipulate` we get an animation in which the user may change the viewing direction in four dimensions—that is, fly freely around the graph.

### Final Remarks

The tools developed in this article present one way to understand the nature of complex functions or functions . These methods apply not only to the graphs of these functions, but to any geometric object in four-dimensional space. For example, the properties of the Klein bottle can be studied given a four-dimensional parametric representation.

From the technical viewpoint, another approach could also be used: instead of first projecting the objects to the space and then to the two-dimensional computer screen, only one projection mapping could be used.

The methods and material presented here were developed in a Finnish project MatTaFi, matta.hut.fi/mattafi. The aim of the project is to study and produce computer-based materials for basic courses of mathematics at the university level.

### References

[1] | M. Trott, “Visualization of Riemann Surfaces of Algebraic Functions,” Mathematica in Education and Research, 6(4), 1997 pp. 15-36. |

[2] | M. Trott, “Visualization of Riemann Surfaces IIa, Compositions of Elementary Transcendental Functions,” The Mathematica Journal, 7(4), 2000 pp. 465-496. |

[3] | M. Trott, “Visualization of Riemann Surfaces IIb, Compositions of Elementary Transcendental Functions,” The Mathematica Journal, 8(1), 2001 pp. 50-62. |

[4] | M. Trott, “Visualization of Riemann Surfaces IId, Compositions of Elementary Transcendental Functions,” The Mathematica Journal, 8(4), 2002 pp. 532-562. |

[5] | R. M. Corless and D. J. Jeffrey, “Graphing Elementary Riemann Surfaces,” ACM SIGSAM Bulletin: Communications in Computer Algebra, 32(1), 1998 pp. 11-17. |

[6] | I. D. Faux and M. J. Pratt, Computational Geometry for Design and Manufacture (Mathematics and Its Applications), New York: John Wiley & Sons, 1979. |

[7] | B. Thaller, “Visualization of Complex Functions,” The Mathematica Journal, 7(2), 1998 pp. 163-181. |

Simo Kivelä, “On the Visualization of Riemann Surfaces,” The Mathematica Journal, 2010. dx.doi.org/doi:10.3888/tmj.11.3-6. |

### About the Author

Simo K. Kivelä is an emeritus lecturer of mathematics. He has used mathematical software like muMath, Matlab, and *Mathematica* in several courses, beginning in the 1970s. He has also been the supervisor of projects where information and communication technologies are used in teaching and studying mathematics. He has continued this work as a part-time researcher after retirement.

**Simo Kivelä**

*Helsinki University of Technology,
Institute of Mathematics,
P.O. Box 1100,
FI-02015 HUT, Finland
*

*simo.kivela@tkk.fi*