Inversion at the Circle

Inv2 01

My first encounter with the inversion at a circle happened through Stan Ogilvy’s wonderful little book Excursions in Geometry. It is like a magic key: When you know how to use it, it opens many doors. The definition is simple: A point at distance r from the center of the uniut circle is inverted to a point on the ray through that point at distance 1/r.

One of the magic facts one has to learn is that this inversion maps lines or circles to lines or circles. More precisely:

  1. Lines through the origin or mapped to lines through the origin.
  2. Circles through the origin or mapped to lines not through the origin (and vice versa).
  3. Circles not through the origin or mapped to circles not through the origin.

Why is this true? One can of course prove this by computation. The formulas are not pretty and provide little insight. One can argue geometrically, but the diagrams get very messy. I suspect that a decent way to to this is to define a circles/line through three points as the set of points whose cross ratio with the three points is real, and then show that Möbius transformations preserve cross ratios. But arguments quickly become circular this way…

Here I am outlining a hybrid approach. We will only use two simple facts about triangle. Thales theorem

Thales 01

characterizes circles as those points that make a right angle over a given hypothenuse. Secondly a triangle ABC has a right angle at C if the pre-Pythagorean theorem AD AB = AC^2 holds. This follows from the similarity of triangles ABC and ACD.

We will now begin with the simplest non-trivial case, where the vertical straight line tangent to the unit circle at 1, is inverted to a circle with center at 1/2 and radius 1/2.

Inversion line 01

We use our geometric preliminaries: By Thales, the point q’ lies on the orange circle iff the angle at q’ is a right angle. This is the case iff the two triangles 01q’ and 0q1 are similar, and that is true iff |q||q’|=1.

That case was easy. All other non-trivial cases have significantly more complicated proofs, as far as I know. Therefore we will reduce all other cases to the one we just saw.

We will look at an arbitrary vertical line L not through the origin.
Let R(z) = r z be a homothety with r being fixed positve number chosen so that R maps our line to the vertical line through 1. We denote the inversion by I(z) = z/|z|^2. Please check in your head that R I R = I. This means that we can determine I(L) by computing R(I(R(L))). This is easy, because R(L) is the vertical line through 1, I(R(L)) the circle centered at 1/2 with radius 1/2, and R(I(R(L))) a circle through the origin. Because inversion is compatible with rotations about the origin, we have no proven the second statement above. The first was trivial.

Circleintouch2

Next we look at a circle C that touches the unit circle at the point 1.
For notational simplicity, we will argue with the reciprocal map 1/z instead of I(z). They only differ by a complex conjugation. Then

  • z-1 maps C to a circle through 0.
  • 1/(z-1) maps C to a line not through 0.
  • 1+1/(z-1) maps C to another vertical line.
  • 1/(1+1/(z-1)) maps C to another circle.
  • 1-1/(1-1/(1-z)) maps C to another circle.

So far so good. That last expression turns out to be equal to 1/z, so that in fact 1/z maps C indeed to a circle. I promised no serious computations.
Why then is this strange identity true? By taking reciprocals, it can be written even more dramatically as

Phi3

where φ(z) = 1/(1-z). No φ is a Möbius transformation that maps 0 to 1 to ∞ to 0. This means that its third power fixed these three points and therefore must be the identity as claimed.

Circleinv2

Lastly, we need to consider a general circle not through 0. Using a homothety R as before, we can map it to a circle touching the unit circle, invert, and scale again, using RIR=R.

It is a pity that this material is not taught in high schools, and even considered “obscure”. Its close cousin, the stereographic projection, and its corresponding properties were at the foundation of Astronomy and Navigation all the way through the Middle Ages. Only Mercator’s projection improved on the Astrolabe. Moreover, the inversion opens the door to hyperbolic geometry.

Parking Garages

The first examples of periodic minimal surfaces with helicoidal ends (besides the helicoid itself) are Hermann Karcher’s twisted Scherk surfaces from 1988.
Here are a few of them, rendered with Bryce back in 1999.

Hst

As you can see, these can be twisted more and more so that they appear to become two helicoids glued together. In this case, the two helicoids turn the same way. A few years later, Martin and I were looking at more general ways of gluing helicoids together to obtain new minimal surfaces. The model case is what we called a parking garage structure: You can describe them mathematically as superpositions of complex argument functions, like so:

Arg

Here the numbers z(k) designate the location of the axis viewed from above, and the ε(k) can be +1 or -1, depending on the spin of the helicoid.
Note that the graph of the multivalued function arg(z) is half of a helicoid (that stays on one side of the vertical axis).

An example with three helicoidal columns of the same spin, placed at -1, 0, and 1, looks like this:

Ks3a

If you alternate the spin, you get surfaces that untwist to higher genus helicoids, we believe.

Heli3a

It is also possible to place the columns off a common line, like so:

Exotic2

Nobody knows what minimal surfaces these untwist to.

The images above were made with Mathematics in 2001. Later I found a simple way to do this in PoVRay, which I might explain next time. Here an image from 2002:

1 3 a slice 025 m

Most people get easily lost in parking garages that have only two columns. It would be cool to have a computer game where one can walk around these more complicated structures, with the location of the columns moving in time …

Magnetism

Magnetism is played by two players on a strip of squares, who take turns placing + and – tokens onto the strip. The only rule is that no two tokens with the same parity can be placed next to each other. For instance, there are three legal moves in the following position:

Legal

The player who moves last, wins. This makes Magnetism an impartial game, so that each position is equivalent to a Nim-pile. It turns out that Magnetism is very simple.
First we notice that any position is the sum of simpler positions that have tokens just at the end of a strip. (A sum of games is played by first choosing a game summand, and then making a move in that summand).

Sum 01

Therefore we will know everything about Magentism if we can determine the size of the Nim-piles (the “nimbers”) of the 9 elementary positions:

Nine 01

Things get even simpler. Because of the symmetry of things, there are only four truly different boards to consider.

Four 01

Let’s denote the nimbers of a board of n empty squares (thus not counting the tokens at the end when present) by G(n), G+(n), G++(n), and G+-(n).

n 0 1 2 3 4 5 6
G(n) 0 1 0 1 0 1 0
G+(n) 0 1 2 3 4 5 6
G++(n) 1 1 1 1 1 1
G+-(n) 0 0 0 0 0 0 0

Now you can win in a position with a positive nimber by moving to a position with zero nimber. For instance, on a board with a single + at one end, one possible winning move is to put a – at the other end.

Flat is Beautiful

Every flat 2-dimensional torus can be obtained by identifying opposite edges of a parallelogram.

Flatmarked 01

Each such torus has an involution that fixes four points, marked in four colors above. We can visualize the quotient as a tetrahedron with 180 degree angles at every corner by taking the triangle consisting of the lower left half of the parallelogram, and folding it together.

Tetra

So the space of all tori is nothing but the space of tetrahedra. Each such tetrahedron determines a unique point on the thrice punctured sphere. This can be seen by constructing the elliptic function on the torus determined by sending red to infinity, yellow to 0, and green to 1. The unique point is then the value of blue, and is called the modular invariant of the torus. To go backwards, take a point in the thrice punctured sphere and compute the quotient of elliptic integrals (using independent cycles)

Latex image 1

This complex number is the ratio of the two edges of the parallelogram that defines the torus.
This map is a Schwarz-Christoffel map: It maps the upper half plane to a circular triangle with all angles 0.
Restricting it to the upper half disk has as its image one half of such a triangle, namely

A 0 0 x

Let’s repeat all this starting again with a parallelogram, which now has been removed from the plane.

Complement 01

Identifying again opposite edges defines a translation structure on a punctured torus that corresponds to a meromorphic 1-form with a double order zero at red (because the cone angle there is 6π), and a double order pole at infinity (yellow) (because the holomorphic 1-form dz has a double order pole at infinity). For a given modular invariant, we can determine the parallelogram to use using another Schwarz-Christoffel map

Latex image 3

which maps the upper half disk to a different circular polygon:

A 1 0 x

Curiously, we see that the ratio of the edge vectors of the parallelogram can now also lie in the lower half plane or even be real, in which case the parallelogram degenerates. For instance, we can construct a torus that corresponds to the quotient -1 by slitting the complex plane from -1 to 1, and identifying the top of the slit from -1 to 0 (resp. 0 to 1) with the bottom of the slit from 0 to 1 (resp. -1 to 0).

Slit70 01

This corresponds to an ordinary torus whose parallelogram is a rhombs with angle 70.7083 degrees. Next time we will see what this torus is good for.

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.

Square

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.

Mobius

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).

Exp

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

Gap2series

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

Gap2

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.

Colorwheel

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,

Mobius7

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

Llmc

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

Figureeightbottle

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:

MobiusTrandormation0

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.

MobiusTrandormation1

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).

MobiusTrandormation1b

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

MobiusTrandormation2

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

Quadratic

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:

Quadratic2

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.

Identity

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

Square

And here a rational function function of degree 4:

Quartic

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:

Deg5

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

Gamma

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:

Sweep L53

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),

Zigzags

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.

Couplesgraph

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}]
    ]
   }
  ]

Rect1

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}]]

Rect2

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}]]

Rect3

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.

Rect4