Math 240 Home

Complex Function Grapher

This applet graphs complex functions where the domain is the base plane, the modulus is graphed on the vertical and the color represents the arguments. See the help text for more details.

Help Text

Graphing a complex function is difficult because you need 2 (real) dimensions for the domain and 2 (real) dimensions for the range - a total of 4 dimensions. In this applet, the domain of a complex function is graphed on the base plane. The range is graphed using polar coordinates. The modulus (magnitude) of the complex function is graphed on the vertical axis. The argument (angle) is graphed by using different colors - light blue for positive real, dark blue (shading to purple) for positive imaginary, red for negative real, and yellow-green for negative imaginary as shown at the right. This allows four dimensions to be represented in three spatial dimensions, which are then projected onto a two dimensional screen using a simple orthogonal projection.

Enter complex functions into the f(z) = text box using standard calculator notation. Note that complex functions are usually written as functions of z, and the applet requires you enter the function in terms of a variable z. You can use implied multiplication between numbers and z, but not between an alphabetic constant and z, i.e. it is okay to write 2z but you must enter i*z, not iz. Functions must have parentheses, i.e. sin(z) not sin z. The parser understands the following operations, functions, and constants: +, -, *, /, ^, sqrt(), sin(), cos(), tan(), exp(), ln(), log() (synonymous with ln), sinh(), cosh(), abs(), mod() (synonymous with abs), arg(), conj(), e, pi, i.

To adjust the domain of the graph, right-click (or shift-click if you have a one-button mouse) on the graph. The domain editor only accepts numerical input, i.e. 3.14 not pi.


In class we looked at the graphs of the exp(pi*z), cos(pi*z), and cosh(pi*z) and observed that you could identify the periodicity of exp(z) along the imaginary axis and also that the graphs of cos(z) and cosh(z) are the same, just rotated 90°. This week we will use the connections between complex exponentials and pairs of sines and cosines to solve homogeneous linear constant coefficient equations. In this particular studio however, we will look at a couple of other ideas about complex functions and their graphs, which will be useful to you in the future (I hope :)

In the ordinary two-dimensional graph of y2 = x, we don't have y as a function of x since the graph fails the vertical line test, that is a given value of x, say x = 4, will give rise to two different values of y, both y = 2 and y = -2. We deal with this by defining the square root function to always give the positive square root. We can also speak of the two branches of the square root function, the positive square root and the negative square root, which together make up the graph of y2 = x. Of course, as a real-valued function, the square root function is only defined for x >= 0. But the point of complex numbers is that you can now take square roots of negative numbers, indeed of any number. In the next two problems we'll try to develop a sense of the two branches of sqrt(z) for the complex plane.

  1. Graph sqrt(z) and -sqrt(z). Observe the "branch cut" along the negative real axis. Explain why can't we define a branch of square root which is continuous over the whole plane? Hint: The complex numbers e trace out a circle around the origin of radius 1 starting and ending at -1 as θ varies from -π to π. What are the values of sqrt(e) at the beginning and end of the circle?

  2. We could build a single graph of the real variables y2 = x by stitching the two branches of the square root functions together. How could you stitch the two branches of the square root functions together to get a single graph for the complex case? Hint: The stitching will give you a figure that would have to intersect itself in three dimensions, but since complex graphs are actually 4 dimensional there is the extra room needed to stitch things together.
  3. The last topic we will consider are some tricks for finding zeros and poles of complex functions. These tricks can later be used to recognize whether certain systems are stable or unstable. They can also lead to a proof of the fundamental theorem of algebra (this is a math class - you should expect us to talk some about theorems and proofs :)

    Look at the following functions in the complex function grapher. The Top View will be most useful, but looking at a couple of the examples that have poles using the Side View will help you understand why we use the word "poles" for these points.

  4. How can you recognize the zeros and poles of the functions from just looking at the colors you see in the Top View?

  5. How can you distinguish a single root from a double root or a single pole from a double pole?

  6. How can you distinguish the zeros from the poles by looking at the colors you see in the Top View?

  7. Once you learn to recognize zeros and poles, you can look for patterns in how the colors work.

  8. Fill in the following table. First use the default window, with both the Real and Imaginary ranging from -2 to 2. Count how many roots and poles are shown in the graph. Don't count roots or poles that lie outside the graphed region, but do count roots and poles with multiplicity. Also count how many times you cycle through the rainbow as you move around the edge of the graph window. When counting the rainbows around the edge of the graph, count rainbows that move counterclockwise as you go from red to yellow to green to blue to violet as positive and rainbows that go clockwise as negative. Once you have finished that, right-click on the graph (or shift-click if you have a Mac with a one-button mouse), and change the domain to range from -5 to 5 for both the real and imaginary axes.
     Domain from -2 to 2 Domain from -5 to 5
    Function# Roots# Poles Rainbows
    at the edge
    # Roots # PolesRainbows
    at the edge

  9. Look at the values you found in the table above. Can you find a pattern for the rainbows around the edge in terms of the # of roots and the # of poles? This pattern is called the principle of the argument

We can use the principle of the argument to justify the fundamental theorem of algebra, which says any polynomial of degree n has n roots (counted with multiplicity) in the complex plane. Suppose we have a polynomial. For very large values of z, the leading term of the polynomial will dominate the other terms and the graph of the polynomial will look like the graph of its leading term for a large domain. As an example of this, look at the graph of z^3+3*z^2-5*z+2 and the graph of z^3. At the default domain from -2 to 2, the graphs of these two polynomials look quite different. But for a domain from -10 to 10 they look more similar and for a domain from -200 to 200 they look nearly identical. Because of this, we can conclude that if we take a large enough window, the number of rainbows around the edge for a polynomial of degree n is the same as the number of rainbows around the edge for z^n, that is to say, n rainbows.

Now from the principle of the argument, that means the # roots - # poles of the polynomial is n. But a polynomial has no poles (since it has no denominator), so the polynomial must have exactly n roots (including complex roots and counting multiplicity). And this is exactly the Fundamental Theorem of Algebra. In Math 630, you can learn how to prove these patterns must always hold, but just by experimentation I hope you can see these patterns hold, and then understand why these patterns imply the Fundamental Theorem of Algebra is true. In the next chapter we will discover that knowing where the poles of the "Laplace transform" of the solution of a differential equation tells us a great deal about the stability of the system being modeled, and techniques like this can help us determine where poles are located in the complex plane.

Please report any problems with this page to
©2010 Andrew G. Bennett