## Drawing by Numbers

An easy attempt to make a model of color space is Philipp Otto Runge’s color sphere from 1810. The equator is colored by hue, brightness ranges from black at the north pole to white at the south pole.

Having such a color sphere suggests yet another way to visualize complex valued functions: Color a point z in the domain of the function by Runge’s color of the function value of that point, interpreted as a point on the Riemann sphere.

For instance, up above is the coloring of the function f(z)=z^2 in the unit square. The white region at the center is caused by the zero, and that every color appears twice is of course a consequence of f being of degree 2. Let’s make it slowly more interesting. Here is the Möbius transformation f(z)=(z-1)/(z+1). Zero and poles are clearly visible.

Locally, holomorphic functions are just as good or as bad as polynomials, so we shouldn’t expect anything more complicated to happen.

For me, the real excitement of complex analysis starts with essential singularities. There are the mind boggling theorems of Casorati-Weierstrass (images of neighborhoods of essential singularities are dense) and, much stronger and much harder to prove, Picard (images of neighborhoods of essential singularities miss at most two points).

Above is the coloring of f(z)= e^(i/z) in a thin rectangle centered at 0. We do see every color occurring infinitely often (more or less), but the image is still rather tame. After all, the exponential function is the simplest transcendental function. Things get truly wild if we look at the boundary behavior of gap series like

This series converges in the unit disk but cannot be homomorphically extended beyond.

Unfortunately I don’t know enough about gap series to explain everything we can see here. Most puzzling are the circular arcs of increased brightness.

## The Twisted Color Wheel

Colors are curious. Physics tells us that, like sound, they are just waves. But while we can hear sound waves of wave lengths between 17mm and 17m, the wave lengths of visible light range between 390 and 700 nm. That’s sad. Wouldn’t it be cool if we could see colors resonate by being able to see both red (700nm) and ultraviolet (350 nm). Of course matters are more complicated because we perceive colors differently, using three specific color sensors. Imagine being only able to hear three different sound frequencies.

A side effect of our biological limitation is that a color wheel makes sense to us, i.e. a continuous arrangement of the colors around a circle so that antipodal points represent complementary colors. This gave me the idea that one could color a Möbius strip continuously by hue so that points in the “front” and “back” are colored by complementary colors. Here is a 7-fold twisted rectangle as a ruled surface,

and here a minimal surface version based on a torus knot:

Finally, a Klein bottle, the immersion being obtained by rotating and revolving a figure 8 curve:

## Terraforming

Unfortunately, the days are over when you could just ask the Magratheans to build you a planet to order. Let’s deal with what we have and deform it a little, continuing my little series of visualizing conformal maps. Here is what we have:

The easiest we can do is to shrink and expand the hemispheres, counteracting centuries of imperialism. Mathematically, this is just a multiplication like say f(z)= z/2.

Curiously, translations like f(z)=z+1 have a much more dramatic effect, they move the north pole (which corresponds to 0) and keep the south pole (infinity).

If we want to move both poles simultaneously and keep the equator where it is, we need Möbius transformations.

This is about as general as it gets with degree 1 maps. Here is a degree 2 map, f(z)=z+1/z:

Both polar caps have been folded into one. From a quadratic map we would expect intersecting parameter lines. This doesn’t happen here because the map I have chosen is rather symmetric. To indicate what usually happens, below is the image of a hemisphere under the innocent map f(z)=(z+1)^2:

## Beach Balls

Following Jack’s suggestion, let’s try to visualize holomorphic maps from the Riemann sphere to itself. As a reference, here is the Riemann sphere with polar coordinates, and on the right hand side its cylindrical projection.

The preimage of this under a quadratic polynomial looks like this:

And here a rational function function of degree 4:

One can get quick images using uv-mapping, but there are some rendering artifacts I don’t know how to get rid of yet. Degree 5:

Finally, the Gamma function, which has an essential singularity at infinity.

Martha says their gypsum printer can print these in color. We’ll see, I hope.

## Spring Cleaning II

This is a continuation of my previous post about this game. Because it is impartial and the rules are simple, one can write a computer program that computes for a given position of dirt pieces the size of the equivalent Nim heap (which is also called its Grundy number or its nimber). Because this is computationally prohibitive, one does this for simple shapes, discovers patterns, and proves these. We did this for rectangles the last time. To warm up, we do it for L-shapes today. Here is. (5,3)-L:

The nimber of this position is 1, which means in particular that there is a winning move for the first player. You can for instance do vertical swipe in the second column, leaving the second player with two disconnected row/column of three dirt pieces each. From then on, we play symmetrically and win.

For the general (alb)-L, the nimbers are as follows:

 a\b 2 3 4 5 6 2 0 4 4 0 3 3 4 1 0 1 0 4 3 0 3 0 3 5 0 1 0 1 0 6 3 0 3 0 3

In other words, the nimber of an L with legs at least 3 dirt pieces long behaves quite simple.
This is good, because if a player can easily memorize the nimbers of simple positions, and these nimbers are small, then the player can usually easily win against players who lack this knowledge.

But maybe all this talk about nimbers is just vain traditional mathematics, and there is an alternative way to understand this game and win easily, without any theory, just by being smart and tough?

Let’s look at at another type of Spring Cleaning positions which I call zigzags. Below are the zigzags Z(1) through Z(7),

and here is the table of the first few nimbers:

 n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 nimber 0 0 1 2 0 1 2 3 1 2 3 4 0 3 4

Any pattern emerging? No? There is a solution: Whenever you have a sequence of integers you are clueless about, you had to the Online Encyclopedia of Integer Sequences, the best thing the internet has produced ever, and type it in.

It turns out that the sequence at hand is known as the sequence of nimbers of another impartial game which is called Couples are Forever. The rules are simple: The game is is being played with several piles of tokens. Both players take turns splitting any one pile of size at least three tokens into two piles. The game ends when no piles with more than two tokens are left. This impartial game, beginning with a pile of size n, has (with a shift of two) the same nimbers as the zigzags in Spring Cleaning.

Moreover, for Couples are Forever, the nimbers have been computed into the millions, and no pattern has been found whatsoever. It is not even known whether the nimbers remain bounded.

Above is the graph for the nimbers of Couples are Forever (or zigzags in Spring Cleaning) for pile sizes up to 25,000. At first (up to 10,000 or so), it looks like the nimbers are growing linearly, but then they appear to even out. Nobody knows. This is one of the famous open problems in combinatorial game theory.

It tells us also that there won’t be a tough&smart solution for this game, or for Spring Cleaning, or for reality. Which is a good thing.

## More Circle Magic

Today we revisit the three previous posts about playing with circles with Mathematica Code, as promised.

First, we set up a reference image we want to play with:

```width = 3;
height = 2;
spacing = .2;
vectorrectangle = Graphics[{Thickness[.01],
Join[
Table[
Line[{{i, 0}, {i, height}}, VertexColors -> {Red, Green}], {i, 0,
width, spacing}],
Table[
Line[{{0, j}, {width, j}}, VertexColors -> {Blue, Yellow}], {j,
0, height, spacing}]
]
}
]
```

and convert this vector graphics into a bit image:

```a = 500 width;
b = 500 height;
bitimage = Image[vectorrectangle, ImageSize -> {a, b}];
rectangleimage = ImageData[bitimage];
```

Instead of this, you can paste any bitmap into the Image[] function and adjust a and b to the correct dimensions.
ImageData converts the bitmap into an array of RGB values.

Now we do some complex analysis magic, using elliptic functions, in order to map the unit disk to the rectangle.

```tau = b/a I;
modul = 1./(ModularLambda[2 tau])^(1/4);
ellipticwidth = (2*EllipticK[1/modul^4])/modul;

DiskToUpperHalfPlane[z_] := (1 - I z)/(-I + z);
UpperHalfPlaneToRectangle[z_] :=
EllipticF[ArcSin[modul z], 1/modul^4]/modul;
UpperHalfPlaneToNormalizedRectangle[z_] :=
1/2 + UpperHalfPlaneToRectangle[z]/ellipticwidth;
imre[z_] := {Im[z], Re[z]};

DiskToNormalizedRectangle[z_]

```

To compute the circular preimage of the rectangle, we create a 750×750 square and map each pixel of the disk within that square to the rectangle, using DiskToNormalizedRectangle, and some rescaling. We record in the square the coordinates of the image pixels, and mark all other pixels in the square that lie not inside the disk as {0,0}.

```nn = 750;
scale[{i_, j_}] := 2 (i + I j)/nn - (1 + I);

tab = Transpose[Table[
If[Abs[scale[{i, j}]] > .99,
{0, 0},
imre[a (DiskToNormalizedRectangle[scale[{i, j}]])]],
{i, 1, nn}, {j, 1, nn}]];
```

As the image coordinates are not integers, we interpolate the color of a pixel in the disk as the weighted average of the four adjacent pixels.

```WeightedExtract[t_, {x_, y_}] := (1 - FractionalPart[x]) (1 - FractionalPart[y]) t[[Floor[x], Floor[y]]] +
(1 - FractionalPart[x]) (FractionalPart[y]) t[[Floor[x],  Ceiling[y]]] +
(FractionalPart[x]) (1 - FractionalPart[y]) t[[Ceiling[x], Floor[y]]] +
(FractionalPart[x]) (FractionalPart[y]) t[[Ceiling[x], Ceiling[y]]];

colorpick[i_] :=
If[i == {0, 0}, RGBColor[1, 1, 1],
RGBColor @@ WeightedExtract[rectangleimage, i]];

Image[Map[colorpick, tab, {2}]]
```

To use Black products to create multiple copies of this image within the disk, we first generate a list of the zeroes of the Blasche factor, and then multiply the Black factors. Precomposing the Blaschke function with DiskToNormalizedRectangle makes things pretty.

```ww = Table[(1 - 1/n^1.4) E^(.4 I n), {n, 2, 20}];
Blaschke[z_] := Product[
Abs[ww[[n]]]/ww[[n]] (ww[[n]] - z)/(1 - Conjugate[ww[[n]]] z), {n,
1, Length[ww]}];

tab = Transpose[Table[
If[Abs[scale[{i, j}]] > .99,
{0, 0},
imre[a (DiskToNormalizedRectangle[scale[Blaschke[{i, j}]]])]],
{i, 1, nn}, {j, 1, nn}]];

Image[Map[colorpick, tab, {2}]]
```

To get this back into a rectangle, we need the inverse of the DiskToNormalizedRectangle function. This is done with Jacobi’s elliptical functions:

```UpperHalfPlaneToDisk[w_] := (I (-I + w))/(I + w);
RectangleToUpperHalfPlane[w_] := JacobiSN[modul w, 1/modul^4]/modul;
NormalizedRectangleToUpperHalfPlane[w_] := -RectangleToUpperHalfPlane[-ellipticwidth (w - 1/2)];

RectangleSelfMap[z_] := UpperHalfPlaneToNormalizedRectangle[
DiskToUpperHalfPlane[
Blaschke[
UpperHalfPlaneToDisk[
NormalizedRectangleToUpperHalfPlane[z]
]
]
]
]
```

Again, after some bookkeeping

```aa = a/2;
bb = b/2;
eps = 0.000001;

scale2[{i_, j_}] := (i + I j)/aa
smash[x_, u_] := If[x  u, u, x]];
smash[{i_, j_}] := {smash[i, b], smash[j, a]};
colorpick2[i_] := colorpick[smash[i]];

tab = Transpose[Table[
imre[a RectangleSelfMap[(1 - eps) scale2[{i, j}] + eps/2 b/a I ]], {i, 1, aa}, {j, 1, bb}]];
Image[Map[colorpick2, tab, {2}]]
```

we get our rectangular image back.

## Playing with Infinity

After Squaring the Circle and using Blaschke products to squeeze finitely many disks conformally into a single disk, the restless mathematician wants to put even more disks into a disk. Infinitely many, that is. What we need for this is a conformal map that maps the disk infinitely often onto itself. We will cheat a little and employ the exponential function. It maps the left half-plane to the punctured unit disk, and because it is 2π periodic. Each point except the center of the unit disk has infinitely many preimages.

So, my first examples map the disk via a Möbius transformation to the left half plane (that is a bijection), and then via the exponential map back to the (punctured) disk. Missing one point won’t be a big deal – what is a single pixel? Pulling back the default spider web on the left replicates it infinitely often, but in a somewhat disappointing way: The circles of the original web become horocycles that are mapped periodically onto the circles. We just have an infinite hyperbolic wall paper, periodic with respect to a parabolic isometry. We can do slightly better by taking products of several such maps.

Below are products of three such Möbius-exponential maps,

and here the two images that use four factors. I have placed the parabolic fixed points symmetrically but played with the Möbius transformations a little.

Of course one can also use infinite Black products, as long as the zeroes of the factors converge rapidly enough to the boundary circle, and as long one is patient enough to evaluate the infinite products to sufficient accuracy.

In the left example, the zeroes follow a spiral, while in the second example, the zeroes alternate between two spirals that turn the opposite way. The zeroes correspond to the circular holes.