>    restart;

Visualizing mappings of the plane

About this worksheet

Author and Date:

Matthias Kawski
Arizona State University
http://math.asu.edu/~kawski
Original version: December 1999, release 5

Content, Purpose and Use

Visualizing complex functions by their actions on finite grids (rectangles

and annular sections). Some commercial products such as f(z) (from

Lascaux Graphics, Tucson AZ) do this, too, without having to type

in long commands -- however, they do not do the careful coloring that

we found to be essential -- allowing one to track which edge is mapped
to which edge (or to the inside in the case of foldovers).

>   

The procedures defined below have proved very valuable in many class

sessions - very often a single example led to quite intense discussions of

"how come", and how large to choose the region so that e.g. first foldovers

occur.
Additional procedures facilitate the input of Moebius transformations.

>   

Updates and log of modifications.

None yet -- please submit the examples that provided the most insight,
easiest: Send e-mail to kawski@math.asu.edu with the formula of the
map w=f(z), and the coordinates for the rectangles used, or the center
and radial/angular ranges of the annuli used. Where suitable provide
comments why you found the images useful.

>   

December 4, 1999:
Added two extra procedures Mrect and Mcirc customized for Moebius
transformations. Thefirst few examples exhibit the need to stay away from
the singularity if we want to see any good images....

>   

July 2002: Checked performance in MAPLE release 8. Added few comments.

Caveats -- READ this section before continuing!

Note, each function call produces 3 images that may be displayed as an animation:
Simply click on the picture and play the animation -- best is either "looping around"
with a small frame-per-second rate, or use the arrow button to go manually around.

>   

Caution:
The worksheet has not yet been tested with assumptions on the variables -- e.g.
when using  u:=Re(sin(x+I*y)) in the current version MAPLE does NOT yet know
that x is considered real -- thus you will not see the expected (?) formulas for u and
v. However, when the plots are generated MAPLE learns that x and y only take
real values and correctly simplifies the real and imaginary part -- though you may
need to help with simplify or evalc before calling Re and Im.

>   

The procedures -- execute this section first!

>    with(plots):

rect:=proc()
local u, v, xrange, yrange, mygrid,
      x0, x1, y0, y1, dx, dy, m, n,
      p1, p2, p3;
u:=args[1];      # The real part of the map
v:=args[2];      # The imaginary part of the map
xrange:=args[3]; # The horizontal range of the rectangle
yrange:=args[4]; # The vertical range of the rectangle
if nargs > 4
   then mygrid:=args[5]   # Optional argument: The grid
   else mygrid:=[6,6]
   fi;
x0:=op(1,xrange);
x1:=op(2,xrange);
y0:=op(1,yrange);
y1:=op(2,yrange);
m:=mygrid[1];
n:=mygrid[2];
dx:=(x1-x0)/m;
dy:=(y1-y0)/n;
p1:=display([
   plot([[x0,y0],[x0,y1]],color=red,thickness=2),
   plot([[x1,y0],[x1,y1]],color=magenta,thickness=2),
   plot([[x0,y0],[x1,y0]],color=green,thickness=2),
   plot([[x0,y1],[x1,y1]],color=blue,thickness=2),
   seq(plot([[x0+k*dx,y0],[x0+k*dx,y1]],
             color=pink,thickness=1),k=1..m-1),
   seq(plot([[x0,y0+k*dy],[x1,y0+k*dy]],
             color=cyan,thickness=1),k=1..n-1)
       ],scaling=constrained);
p2:=display([
   plot([subs(x=x0,y=y0+t*(y1-y0),u),
         subs(x=x0,y=y0+t*(y1-y0),v),t=0..1],
         color=red,thickness=4),
   plot([subs(x=x1,y=y0+t*(y1-y0),u),
         subs(x=x1,y=y0+t*(y1-y0),v),t=0..1],
         color=magenta,thickness=4),
   plot([subs(x=x0+t*(x1-x0),y=y0,u),
         subs(x=x0+t*(x1-x0),y=y0,v),t=0..1],
         color=green,thickness=4),
   plot([subs(x=x0+t*(x1-x0),y=y1,u),
         subs(x=x0+t*(x1-x0),y=y1,v),t=0..1],
         color=blue,thickness=4),
   seq(plot([subs(x=x0+t*(x1-x0),y=y0+k*dy,u),
             subs(x=x0+t*(x1-x0),y=y0+k*dy,v),t=0..1],
             color=cyan,thickness=2),k=1..n-1),
   seq(plot([subs(x=x0+k*dx,y=y0+t*(y1-y0),u),
             subs(x=x0+k*dx,y=y0+t*(y1-y0),v),t=0..1],
             color=pink,thickness=2),k=1..m-1)
   ],scaling=constrained);
display([display([p1,p2]),p1,p2],scaling=constrained,insequence=true);
end:

circ:=proc()
local u, v, ctr, rrange, trange, mygrid,
      x0, y0, r0, r1, t0, t1, dr, dt, m, n,
      p1, p2, p3;
u:=args[1];      # The real part of the map
v:=args[2];      # The imaginary part of the map
ctr:=args[3];    # (x,y)-coords of center of annular region
x0:=ctr[1];
y0:=ctr[2];
rrange:=args[4]; # The range of the radial variable
trange:=args[5]; # The range of the angular variable
if nargs > 5
   then mygrid:=args[6]   # Optional argument: The grid
   else mygrid:=[6,6]
   fi;
r0:=op(1,rrange);
r1:=op(2,rrange);
t0:=op(1,trange);
t1:=op(2,trange);
m:=mygrid[1];
n:=mygrid[2];
dr:=(r1-r0)/m;
dt:=(t1-t0)/n;
p1:=display([
   plot([x0+r0*cos(t),y0+r0*sin(t),t=t0..t1],color=red,thickness=2),
   plot([x0+r1*cos(t),y0+r1*sin(t),t=t0..t1],color=magenta,thickness=2),
   plot([x0+r*cos(t0),y0+r*sin(t0),r=r0..r1],color=green,thickness=2),
   plot([x0+r*cos(t1),y0+r*sin(t1),r=r0..r1],color=blue,thickness=2),
   seq(plot([x0+(r0+k*dr)*cos(t),y0+(r0+k*dr)*sin(t),t=t0..t1],
            color=pink,thickness=2),k=1..m-1),
   seq(plot([x0+r*cos(t0+k*dt),y0+r*sin(t0+k*dt),r=r0..r1],
            color=cyan,thickness=2),k=1..n-1)
   ],scaling=constrained);
p2:=display([
   plot([subs(x=x0+r*cos(t0),y=y0+r*sin(t0),u),
         subs(x=x0+r*cos(t0),y=y0+r*sin(t0),v),r=r0..r1],
         color=green,thickness=4),
   plot([subs(x=x0+r*cos(t1),y=y0+r*sin(t1),u),
         subs(x=x0+r*cos(t1),y=y0+r*sin(t1),v),r=r0..r1],
         color=blue,thickness=4),
   plot([subs(x=x0+r0*cos(t),y=y0+r0*sin(t),u),
         subs(x=x0+r0*cos(t),y=y0+r0*sin(t),v),t=t0..t1],
         color=red,thickness=4),
   plot([subs(x=x0+r1*cos(t),y=y0+r1*sin(t),u),
         subs(x=x0+r1*cos(t),y=y0+r1*sin(t),v),t=t0..t1],
         color=magenta,thickness=4),
   seq(plot([subs(x=x0+r*cos(t0+k*dt),y=y0+r*sin(t0+k*dt),u),
             subs(x=x0+r*cos(t0+k*dt),y=y0+r*sin(t0+k*dt),v),r=r0..r1],
             color=cyan,thickness=2),k=1..n-1),
   seq(plot([subs(x=x0+(r0+k*dr)*cos(t),y=y0+(r0+k*dr)*sin(t),u),
             subs(x=x0+(r0+k*dr)*cos(t),y=y0+(r0+k*dr)*sin(t),v),t=t0..t1],
             color=pink,thickness=2),k=1..m-1)
   ],scaling=constrained);
display([display([p1,p2]),p1,p2],scaling=constrained,insequence=true);
end:

Warning, the name changecoords has been redefined

Procedures for Moebius transformations -- execute first!

>    with(plots):
Mrect:=proc()
local a, b, c, d, u, v, xrange, yrange, mygrid,
      x0, x1, y0, y1, dx, dy, m, n,
      p1, p2, p3;
a:=args[1];      # The paramters of the
b:=args[2];      # Moebius transformation
c:=args[3];      # w=(a*z+b)/(c*z+d)
d:=args[4];      # w=(a*z+b)/(c*z+d)
        # The real and imaginary parts of the map
u:=Re(evalc((a*(x+I*y)+b)/(c*(x+I*y)+d)));
v:=Im(evalc((a*(x+I*y)+b)/(c*(x+I*y)+d)));
xrange:=args[5]; # The horizontal range of the rectangle
yrange:=args[6]; # The vertical range of the rectangle
if nargs > 6
   then mygrid:=args[7]   # Optional argument: The grid
   else mygrid:=[6,6]
   fi;
x0:=op(1,xrange);
x1:=op(2,xrange);
y0:=op(1,yrange);
y1:=op(2,yrange);
m:=mygrid[1];
n:=mygrid[2];
dx:=(x1-x0)/m;
dy:=(y1-y0)/n;
p1:=display([
   plot([[x0,y0],[x0,y1]],color=red,thickness=2),
   plot([[x1,y0],[x1,y1]],color=magenta,thickness=2),
   plot([[x0,y0],[x1,y0]],color=green,thickness=2),
   plot([[x0,y1],[x1,y1]],color=blue,thickness=2),
   seq(plot([[x0+k*dx,y0],[x0+k*dx,y1]],
             color=pink,thickness=1),k=1..m-1),
   seq(plot([[x0,y0+k*dy],[x1,y0+k*dy]],
             color=cyan,thickness=1),k=1..n-1)
       ],scaling=constrained);
p2:=display([
   plot([subs(x=x0,y=y0+t*(y1-y0),u),
         subs(x=x0,y=y0+t*(y1-y0),v),t=0..1],
         color=red,thickness=4),
   plot([subs(x=x1,y=y0+t*(y1-y0),u),
         subs(x=x1,y=y0+t*(y1-y0),v),t=0..1],
         color=magenta,thickness=4),
   plot([subs(x=x0+t*(x1-x0),y=y0,u),
         subs(x=x0+t*(x1-x0),y=y0,v),t=0..1],
         color=green,thickness=4),
   plot([subs(x=x0+t*(x1-x0),y=y1,u),
         subs(x=x0+t*(x1-x0),y=y1,v),t=0..1],
         color=blue,thickness=4),
   seq(plot([subs(x=x0+t*(x1-x0),y=y0+k*dy,u),
             subs(x=x0+t*(x1-x0),y=y0+k*dy,v),t=0..1],
             color=cyan,thickness=2),k=1..n-1),
   seq(plot([subs(x=x0+k*dx,y=y0+t*(y1-y0),u),
             subs(x=x0+k*dx,y=y0+t*(y1-y0),v),t=0..1],
             color=pink,thickness=2),k=1..m-1)
   ],scaling=constrained);
display([display([p1,p2]),p1,p2],scaling=constrained,insequence=true);
end:

Mcirc:=proc()
local a, b, c, d, u, v, ctr, rrange, trange, mygrid,
      x0, y0, r0, r1, t0, t1, dr, dt, m, n,
      p1, p2, p3;
a:=args[1];      # The paramters of the
b:=args[2];      # Moebius transformation
c:=args[3];      # w=(a*z+b)/(c*z+d)
d:=args[4];      # w=(a*z+b)/(c*z+d)
        # The real and imaginary parts of the map
u:=Re(evalc((a*(x+I*y)+b)/(c*(x+I*y)+d)));
v:=Im(evalc((a*(x+I*y)+b)/(c*(x+I*y)+d)));
ctr:=args[5];    # (x,y)-coords of center of annular region
x0:=ctr[1];
y0:=ctr[2];
rrange:=args[6]; # The range of the radial variable
trange:=args[7]; # The range of the angular variable
if nargs > 7
   then mygrid:=args[8]   # Optional argument: The grid
   else mygrid:=[6,6]
   fi;
r0:=op(1,rrange);
r1:=op(2,rrange);
t0:=op(1,trange);
t1:=op(2,trange);
m:=mygrid[1];
n:=mygrid[2];
dr:=(r1-r0)/m;
dt:=(t1-t0)/n;
p1:=display([
   plot([x0+r0*cos(t),y0+r0*sin(t),t=t0..t1],color=red,thickness=2),
   plot([x0+r1*cos(t),y0+r1*sin(t),t=t0..t1],color=magenta,thickness=2),
   plot([x0+r*cos(t0),y0+r*sin(t0),r=r0..r1],color=green,thickness=2),
   plot([x0+r*cos(t1),y0+r*sin(t1),r=r0..r1],color=blue,thickness=2),
   seq(plot([x0+(r0+k*dr)*cos(t),y0+(r0+k*dr)*sin(t),t=t0..t1],
            color=pink,thickness=2),k=1..m-1),
   seq(plot([x0+r*cos(t0+k*dt),y0+r*sin(t0+k*dt),r=r0..r1],
            color=cyan,thickness=2),k=1..n-1)
   ],scaling=constrained);
p2:=display([
   plot([subs(x=x0+r*cos(t0),y=y0+r*sin(t0),u),
         subs(x=x0+r*cos(t0),y=y0+r*sin(t0),v),r=r0..r1],
         color=green,thickness=4),
   plot([subs(x=x0+r*cos(t1),y=y0+r*sin(t1),u),
         subs(x=x0+r*cos(t1),y=y0+r*sin(t1),v),r=r0..r1],
         color=blue,thickness=4),
   plot([subs(x=x0+r0*cos(t),y=y0+r0*sin(t),u),
         subs(x=x0+r0*cos(t),y=y0+r0*sin(t),v),t=t0..t1],
         color=red,thickness=4),
   plot([subs(x=x0+r1*cos(t),y=y0+r1*sin(t),u),
         subs(x=x0+r1*cos(t),y=y0+r1*sin(t),v),t=t0..t1],
         color=magenta,thickness=4),
   seq(plot([subs(x=x0+r*cos(t0+k*dt),y=y0+r*sin(t0+k*dt),u),
             subs(x=x0+r*cos(t0+k*dt),y=y0+r*sin(t0+k*dt),v),r=r0..r1],
             color=cyan,thickness=2),k=1..n-1),
   seq(plot([subs(x=x0+(r0+k*dr)*cos(t),y=y0+(r0+k*dr)*sin(t),u),
             subs(x=x0+(r0+k*dr)*cos(t),y=y0+(r0+k*dr)*sin(t),v),t=t0..t1],
             color=pink,thickness=2),k=1..m-1)
   ],scaling=constrained);
display([display([p1,p2]),p1,p2],scaling=constrained,insequence=true);
end:

The analytic map : z  -->  w = z^2

>   

>    circ(x^2-y^2,2*x*y,[0,0],1..2,Pi/2..Pi,[12,12]);

[Maple Plot]

>    circ(x^2-y^2,2*x*y,[2,3],1..2,0..3/2*Pi,[12,12]);

[Maple Plot]

>   

>   

>    rect(x^2-y^2,2*x*y,1..2,-2..2,[12,12]);

[Maple Plot]

The exponential map : z --> w = exp(z)

>    rect(exp(x)*cos(y),exp(x)*sin(y),1..2,0..3*Pi/2,[6,12]);

[Maple Plot]

The trigonometric function : z --> w = sin(z)

>    w:=sin(x+I*y);
u:=Re(w);
v:=Im(w);
rect(u,v,Pi/2..Pi,1..2,[6,12]);

w := sin(x+y*I)

u := Re(sin(x+y*I))

v := Im(sin(x+y*I))

[Maple Plot]

The inversion : z --> w = 1 / z

>    w:=1/(x+I*y);
u:=Re(w);
v:=Im(w);
rect(u,v,1..3/2,-3/2..1/2,[8,8]);

w := 1/(x+y*I)

u := Re(1/(x+y*I))

v := Im(1/(x+y*I))

[Maple Plot]

>   

First experiments with Moebius transformations

>    Mcirc(2*I,4,0,1,[0,0],1..2,Pi/2..Pi,[12,12]);

[Maple Plot]

>    Mrect(2*I,4,0,1,Pi/2..Pi,1..2,[6,12]);

[Maple Plot]

>    Mcirc(1,1,-1,1,[0,0],1/2..1,Pi/2..Pi,[9,9]);

[Maple Plot]

>    Mcirc(1,1,-1,1,[0,0],1/5..1,Pi/2..Pi,[9,9]);

[Maple Plot]

>    Mcirc(1,1,-1,1,[0,0],1/5..1,Pi/6..Pi/2,[9,9]);

[Maple Plot]

>    Mcirc(1,1,-1,1,[0,0],1/5..2/3,-Pi/2..0,[9,9]);

[Maple Plot]

>    Mcirc(1,1,-1,1,[0,0],0..2/3,-Pi/2..Pi/2,[9,9]);

[Maple Plot]

>    Mcirc(1,1,-1,1,[0,0],0..2/3,0..2*Pi,[9,9]);

[Maple Plot]

>   

>