MATLAB Tutor
Part 15: Graphical representations of complex functions
In this part we examine various graphical tools for representing complex functions of a complex variable. Our test function will be
f(z) = z2.
Since both the domain and the range of such a function have dimension two -- as a real space -- the graph will be an object in real 4-space. Thus, it cannot be represented directly. We will have to use other devices.
-
We begin by thinking of the function
f(z) = z2 as a map of one copy of the complex plane into another.
Enter the following command to define a vertical line in the complex plane,
then plot the segment of the line connecting the points
z1=-0.5-I to z2=-0.5+I. Enter
p = -0.5
t = -1: 0.05: 1;
h = p + t*i;
figure(1)
plot(h,'b')
axis( [-2,2, -2,2] )
axis square; grid on
To see where the squaring function maps this short vertical line
segment, let's show the mapped line segment
in the figure 2 window. Enter:
figure(2)
plot(h.^2,'r')
axis( [-2,2, -2,2] )
axis square; grid on
Experiment by making new graphs using various values
of p between -1 and 1 in the definition of the vertical line.
- Alter the code to see how the
squaring function maps short horizontal segments.
- We provide a special m-file called
"compmap.m" for every CCP module that needs to do complex mappings.
The graphics command "comp" shows what happens to a mesh of short
horizontal and vertical line segments under a complex function.
If you downloaded the package of m-files in Part 11 of this tutorial, this function
is available to you, provided the file compmap.m is in your working directory or on
MATLAB's path. If you have not yet downloaded the package, go back to Part
11 and do it now.
-
Now, enter the following to see the mesh of line segments themselves. (The mapping
function is just the identity.) Enter:
compmap('z', -1, 1, -2, 2)
Now enter the following command to see the image of the mesh of
vertical and horizontal line segments under the squaring function. Enter:
compmap('z^2', -1, 1, -2, 2)
See if you can identify where each line segment is mapped. Why are there fewer curves than there were line segments?
- Another representation option is to reduce the number of dimensions to three by plotting z=|f(x + y*I)| against (x,y).
The command "surf" plots the surface.
Enter the following:
[X,Y] = meshgrid(-1 : 0.05: 1);
Z=abs( (X + i*Y).^2 );
surf(X, Y, Z)
- For still another representation,
we'll concentrate on how the squaring function maps pieces of the unit circle.
First we define a function
parametrizing the unit circle. Then we plot a segment of the circle. Enter:
theta = pi/4
clear t w;
t = 0: theta/50: theta;
w = cos(t) + sin(t)*i;
figure(1)
plot(w,'b')
axis( [-1,1, -1,1] )
axis square; grid on
To see where the squaring function maps this circular segment, let's show the
mapped circular segment in the figure 2 window. Enter:
figure(2)
plot(w.^2,'r')
axis( [-1,1, -1,1] )
axis square; grid on
Now increase theta. As you see, eventually the image starts to draw over itself.
To indicate more clearly what is going on, we'll increase the vertical component as
the curve is drawn out and plot in three dimensions using "plot3". Enter:
p = pi
clear t z
t = 0: p/50: p;
z = (cos(t) + sin(t)*i).^2;
plot3( real(z), imag(z), t/4, 'r' )
axis( [-1,1, -1,1, 0,pi/2] ); grid on
Now increase p from pi to 2 pi and study the resulting plots.
- Give a word description of the square function.
- Use your description to explain why every nonzero complex number has exactly two square roots. Give a geometric method of finding them, i.e., if you have located a non-zero complex number in the plane, where should you look for the square roots?