The quadratic camera

A computational supplement for

"Through the Looking Glass, and What the Quadratic Camera Found There"

Volume 34 of *The Mathematical Intelligencer* (Fall 2012)

By Bart de Smit, Mark McClure, Willem Jan Palenstijn, E. Isaac Sparling, Stan Wagon

On my Macbook Pro, I've got a Photo Booth like plug-in that transforms the image seen by the built in camera into the inverse of the image under the complex square function. If you use an attached monitor, an external camera, or even just a mirror to create a video feedback loop, you can use this to generate Julia set like images. The picture above shows the program in action as I point the built in camera at my bathroom mirror. This post shows the program in action and provides an implementation in Mathematica version 8. It also serves as a computational supplement to a paper I co-authored that's been submitted to The Mathematical Intelligencer.

Iterated inverses of an image

Here's the screen of my MacBook. I simply used Mac's Grab to generate a TIFF file and dragged the result into Mathematica. The result is an Image with dimensions sm and sn.

Now, suppose that we attach a camera to the computer and point it at the screen. Generally, the field of vision of the camera will be larger than just the screen. In this simulation, we generate an artificial, checkered background representing what the computer sees behind the screen. Each pixel in this square image is associated with a complex number; the yellow circle is the unit circle in the complex plane.

The image on the screen is now passed to a digital filter. For each pixel, we square the corresponding complex number and then color the original point according to where it lands in the field of view of the camera. We have essentially computed the inverse image of the camera's view under the complex square function. We then replace the screen in the previous image with that inverse image. Experience shows that there is also a damping effect that biases the color towards a limiting cyan color. Here is the result, taking all of this into account.

If we iterate this procedure 15 times, the screen will show the following.

It's well known that inverse iteration of quadratic functions produces Julia sets. In this case, we've generated the Julia set of . Now, suppose that we don't the camera directly at the center of the screen, rather we translate the camera so that we are pointed directly at complex number *c*. Then, this procedure effectively computes the inverse image under the quadratic function . Thus, we might expect to see a more interesting Julia set. Here's 32 iterations for the case where c=-0.83-0.18i.

The quadratic camera with Mathematica

The previous code all works with a single static image for explanatory purposes. Mathematica V8 allows easy access to a camera attached to the computer so this can all be done dynamically. First, we fire up the camera and determine the resolution of the corresponding image.

Now, we define the function we want to play with. I suppose the classic case is but this should work for any polynomial. We also define some code to translate between the complex plane and the space of the image.

Finally, we do it!

OK, point the camera at the screen or point your laptop at a mirror. You can use the following command to shut down the camera.