February 10, 2013

Conformal Map Viewer

Have you ever wanted a visualization tool for complex functions?

While reading some complex number proofs I wanted one, but online I could only find installable software or Java applets (to be avoided because of security problems). So I wrote a Javascript conformal map viewer, which you can see here (click here to view it as a full page - it is about 1000 lines of javascript on a single page, and it is a nice example of doing canvas rendering with web workers):

The starting function "(z)" is the identity function, and shows how the tool colors the complex plane, with a ring at |z| = 1 and a small circle at |z| < 1/16, and 1/16th unit colored checkers on the rest of the plane. There is also a colored circle shown towards infinity, at |z| > 16. Colors are turquoise in the positive direction, red in the negative, gold-green in the "+i" direction, and they get darker as you go out towards infinity. The tool draws a quick fuzzy preview; wait a minute for it to complete the computation for a clear antialiased rendering. Lots of other functions can be typed into the box. For example, notice that |z|*e^(i*arg(z)) is the same as z.

Try visualizing the complex values in z^2, sin(z), e^z, log(z), sech(z), arctan(z), z^3-1, sin(z^3-1)/z, Jacobi elliptical functions sn(z,0.3), the Gamma function gamma(z), or a polynomial to squeeze a circle into a square 0.926(z+7.3857e-2 z^5+4.5458e-3 z^9).

Or try this: iter(z+z'^2,z,12). Recognize it?

Posted by David at 01:54 AM | Comments (21)

February 16, 2013

Mapping the Earth with Complex Numbers

Conformal maps have their history in 18th century cartographic science, so I have updated my conformal map tool to be able to render the surface of the earth according to the conformal projection of your choice. The lower-right corner of the window has a ⊕ button that renders the earth as seen from space.

Below is the default (polar azumithal) projection. It places the equator on the unit circle, the south pole at infinity, and the prime meridian on the real line towards +1. Because the south pole is at infinity, there is a large distortion of sizes as you go south of the equator. However, the map is conformal, which means that locally, all angles are still accurate.

Here is a zoom-in on Greenwich, London at +0.35 on the polar projection. On the same projection, here is a zoom-in on Adelaide, Australia. Even though the southern hemisphere seems grossly large on the whole-plane rendering, it still looks correct locally.

The Mercator projection is the most well-known conformal projection, and here it can be rendered using e^iz. Other projections such as the classical azimuthal stereographic and the Lagrange projectections are also just other complex-valued functions.

Read about other conformal projections here.

Can you find functions that implement other interesting projections?

Posted by David at 05:39 AM | Comments (2)