## Sunday, October 20, 2013

### Conformal Maps

Most people are familiar with basic functions like $$y=x^2$$, and recognize its graph as the standard parabola. One thing we often don't consider is that this function is also a geometric transformation. That is, it takes the straight line segment [-1,1], for instance, and turns it a particular curve in the plane (that "starts" at (-1,1), passes through (0,0), and "ends" at (1,1)). All functions do this, in fact, some making more interesting--looking curves than others, especially if one considers parametric or polar functions.

Ultimately, though, we take a one-dimensional object (an interval of the $$x$$-axis) and transform it into another one dimensional object, a curve in the plane. One dimensional objects are so ... one dimensional. To make things more interesting, we should consider two dimensional regions of the $$x$$-$$y$$ plane, and think of ways to transform them.

There are infinitely many ways of doing this. One way is to pick two functions $$f$$ and $$g$$ and send the point $$(x,y)$$ to the point $$(f(x),g(y))$$. I thought of animating this for functions like $$f(x) = \sin x$$ and $$g(x) = x^2$$, but in general, this process makes a mess. (We'd love to see some people do this, though. If you do, share!)

A much, much better way of transforming the plane is through a linear transformation. It is pretty simple: pick 4 numbers $$a$$, $$b$$, $$c$$ and $$d$$ and map the point $$(x,y)$$ to the point $$(ax+by,cx+dy)$$.  This kind of transformation always sends straight lines to straight lines and circles go to ellipses. Relative distances are also preserved: if the point $$Q$$ is 2/3 from $$P$$ to $$R$$, then $$Q$$ gets mapped to a point 2/3 from where $$P$$ and $$R$$ get mapped to.

These linear transformations are the underpinnings of computer graphics. For instance, letting $$a=\cos\theta$$, $$b=-\sin\theta$$, $$c=\sin\theta$$ and $$d=\cos \theta$$, we can rotate the point $$(x,y)$$ around the origin counterclockwise by the angle $$\theta$$.  Below, we rotate the rectangle with corners (-1,0) and (1,1) around the orgin by 90$$^\circ$$. On the left is the original rectangle, on the right is its transformation. Note how the shape and distances are all preserved.

Linear transformation on points $$(x,y,z)$$ in space allow one to rotate a 3D world, move through it, and show it all on a flat screen (Wolfenstein 3D, anyone?). The GPU's on computers are really, really, really good at performing these transformation fast.

Usually linear transformations do not preserve angles. That is, if two lines meet at a 15$$^\circ$$ angle, the transformed lines probably do not meet at the same angle. This is ok for some applications, like projecting a 3D world onto your phone's screen. A map that does preserve angles is called a conformal map.

To perform such a transformation, we need to view the $$x$$-$$y$$ plane in a different way. We start with imaginary numbers. We first learned that $$\sqrt{4} = 2$$ and $$\sqrt{-4}$$ didn't exist. Later, some of us learned to give the expression $$\sqrt{-1}$$ the name $$i$$ and call it an imaginary number, as though it only existed in our minds. That allows us to get numbers like $$\sqrt{-4} = 2i$$. With the basic principle that $$i^2=-1$$, we can create complex numbers like $$2+3i$$ and multiply them:
$(2+3i)(1+2i) = -4+5i.$

A complex function acts on these complex numbers. For instance, $$f(z) = z^2$$ (we often use $$z$$ for complex numbers) does the following:

$f(3) = 9,\quad f(3i) = -9\quad \text{and} \quad f(1+2i) = -3+4i, \quad \text{etc.}$

We can visualize complex  numbers with the complex plane. Identify the complex number $$2+3i$$ with the point (2,3) in the $$x$$-$$y$$ plane. Each point in the plane represents a complex number. Tons of cool stuff comes out of this.

A great result is that we can now transform this complex plane by applying a complex function to every point (i.e., every complex number) in the plane.

We now reward to reader who has read this far with some more eye candy. In each of the following, we transform the same rectangle as before (now with vertices at $$(-1,0)\sim -1$$ and $$(1,1) \sim 1+i$$) by a complex function. As you look at these, note how angles are preserved. In the rectangle, we have lots of right angles as the vertical and horizontal lines meet. In the transformed shapes, all the new curves intersect each other at right angles. (You should find that amazing. I do.)

Our introductory image was $$f(z) = e^z$$:

We also have $$f(z) = 2 \sqrt{z + 1} +\frac{\ln(\sqrt{z + 1} - 1)}{\sqrt{z + 1} + 1}$$

$$f(z) = \sqrt{z}$$:

$$f(z) = \sin z$$:

A really cool thing is that rotations are just multiplications by complex numbers. To rotate and scale, multiply by any complex number; to just rotate, multiply by a complex number of the form $$\cos \theta + i\sin \theta$$.  A 90$$^\circ$$ rotation is just a multiplication by $$i$$, as seen before:

$$f(z) = iz$$:

A basic shift up is done by adding $$i$$ to every number/point:

$$f(z) = i+z$$:

One final one for fun:

$$f(z) = (1+i+z)^2$$:

What good is any of this? Two quick answers:

1. What good is this?!?! Are you kidding me? This is awesome. We just took a rectangle, deformed it in weird ways, but preserved angles. Who would have thought this was possible?!?

2. There are many problems in physics/engineering that depend on complex (no pun intended) geometry - for instance, fluid flow around corners or obstacles. The right conformal map can transform the complicated geometry into a simpler geometry, where the problem is "easy" to solve. This solution can be transformed back into a solution in the original geometry using the inverse conformal map.

While we are pleased that #2 is possible, we here are more impressed by answer #1.

A final note: this post was inspired by a reader comment. We probably misunderstood the comment, but we rotated a shape by moving points in a straight line and wondered if the reverse was possible - can we move a shape in a straight line by rotating its points? A comment suggested using an inversion (or see this), which got us thinking about conformal maps. So thanks for the comments - we like them and they give us ideas.

Oh - and someday, we'll post the code for our images. These .gif's were produced mostly on a Friday afternoon when we should have been grading papers or writing Chapter 13 of our Calc III book. Our code is generally ugly -  we write stuff in whatever way seems easiest at the time, and only figure out how to make it look nice and readable much later. So ... later we'll post some code because we do want to share.