# Visualizing Complex Functions with Conformal Mapping

For the thoroughly modern calculus student, an introduction to Complex Variables is all the more daunting because we don’t have the kind of geometric intuition-building machinery available to us for functions $f: C \rightarrow C$ as we did for real-valued functions in calculus.  Not that attempts haven’t been made….  In the coming weeks, I want to work on several techniques in Maxima.  Here’s a first approach:  conformal maps.  The code drawgridC below is limited in its versatility, but couldn’t be simpler to call.  Here are some examples,

/* plot the traces of complex valued function _f
along grid lines in the square
-1 <= Real(z) <= 1, -1<=Ima(z)<=1
blue - images of _f along horizontal lines
red - images of _f along vertical lines */
drawgridC(_f):=block(
[fx,fy,fxt,fyt,pl,j,ngrid],
fx:realpart(rectform(subst(z=x+%i*y,_f))),
fy:imagpart(rectform(subst(z=x+%i*y,_f))),
pl:[],
ngrid:19,
for j:0 thru ngrid do(
fxt:subst([x=-1+j*2/ngrid,y=t],fx),
fyt:subst([x=-1+j*2/ngrid,y=t],fy),
pl:cons([parametric(fxt,fyt,t,-1,1)] , pl)
),
pl:cons([color=red],pl),
for j:0 thru ngrid do(
fxt:subst([y=-1+j*2/ngrid,x=t],fx),
fyt:subst([y=-1+j*2/ngrid,x=t],fy),
pl:cons([parametric(fxt,fyt,t,-1,1)] , pl)
),
pl:cons([color=blue],pl),
pl:cons([xlabel="",ylabel=""],pl),
pl:cons([nticks=200],pl),
apply(wxdraw2d,pl)
);

## 5 thoughts on “Visualizing Complex Functions with Conformal Mapping”

1. William Hawkins says:

I just want to get drawgridC() running without further ado! Is there some flag I need to reset or some package I need to load to get this to run? And how do I copy Maxima code without painstaking copying line by line?

Like

1. ejbarth says:

Hi William,

several ways to get going with that right away:

1. Copy all the code from the post, paste the whole thing to an input cell in wxMaxima, hit shift-return.
Now you can use drawgridC until you end that maxima session

2. Copy all the code from the post and paste into your favorite text editor. Save the result into a file named drawgridC.mac, in a directory on your computer where you can find it easily.
Then in wxMaxima choose File —> Load Package… and navigate to drawgridC.mac
after that, you can use drawgridC until the end of that maxima session.

Please let me know if that helps!
eb

Like

2. ComPhys says:

Thank you very much for these functions. I was wondering if you knew of a way to animate the mapping for a range of inputs? (e.g. 1/z^n for n=1,2,3)

Like