Trying to Short-Stop Iterated Functions May 15th, 2009
Patrick Stein

If a function is pretty fun, why not do it again?

My post yesterday about the Mandelbrot set got me thinking again about iterated functions. With the Mandelbrot set, you start with some complex number c and with z_0 = 0. Then, you generate z_{i+1} by doing z_{i+1} = z_i^2 + c.

Here’s another way to write this iteration. Let f_c(z) = z^2 + c. Let z_0 = 0 and z_1 = f_c(z_0) and z_2 = f_c(z_1) = f_c(f_c(z_0)) = f_c^2(z_0). In general, we write f_c^n(z) to mean f_c(f_c(\ldots f_c(z))) when there are n copies of f_c. It is easy to verify then that f_c^{a}(f_c^{b}(z)) = f_c^{a+b}(x).

The Jam

fibers For that post, I generated the image linked at the right here. Each level of that image represents one iteration of f_c^{i+1}(0) = f_c(f_c^i(0)) with each strand made up of four different f_c functions with neighboring c‘s.

One of the annoying things about that image is that I went directly from one iteration to the next. I had pondered using conventional splines or other polynomials to interpolate between iterations in an effort to smooth out the transitions. I didn’t go to the trouble for it though because any straightforward interpolation would be every bit as fake as the linear version. There is no provision in the iteration for f_c^{\alpha} unless \alpha is a non-negative integer.

Now the question is, can we fake one? Can we make some other function g_c(z) so that g_c^2(z) = f_c(z)?

Faking easy functions

Let’s start with an easier function. In fact, let’s start with the easiest function: f(x) = 0. It is obvious that f^n(x) = f(x) for all positive integers n. As such, if we let g(x) = 0, it is trivially true that g^2(x) = f(x). But, that was too easy.

Maybe f(x) = x will be harder? No. Again, f^2(x) = f(f(x)) = f(x).

Faking translations

Let’s move up to something a little trickier. Let’s say that f(x) = x + c for some constant c. Now, we see that f^2(x) = f(f(x)) = f(x + c) = (x + c) + c = x + 2c. What are we going to try for g(x) then? Let’s try the obvious: g(x) = x + \frac{c}{2}. Hooray! g^2(x) = f(x). So, it makes sense then to think of f^{1/2}(x) as x + \frac{c}{2}. Similarly, we can think of f^{1/n}(x) as x + \frac{c}{n} for all positive integers n. In this way, we can make values f^q(x) for any positive rational number q.

Faking translations with scaling

Now, we’re cooking. Let’s up the ante. Let’s try f(x) = ax + b. What are we going to try for g(x) then? Let’s guess we can still use roughly the same form: g(x) = \alpha x + \beta. Then, g^2(x) = \alpha^2 x + \alpha \beta + \beta. If we want g^2(x) = f(x), then we need \alpha^2 = a and (\alpha + 1)\beta = b. This means that \alpha = \sqrt{a} and \beta = \frac{b}{1 + \sqrt{a}}. In particular, notice that if a and b are both real numbers with a less than zero, then \alpha is pure imaginary and \beta is complex.

TTFN

I have much more to say about iterated functions, but I will save some for the next iteration. Next time, I will start with that last case and calculate f^q(x) for rational q.

A Different Look at the Mandelbrot Set May 14th, 2009
Patrick Stein

When you see pictures of the Mandelbrot set you are seeing the results of iterating a function over and over.

For the Mandelbrot set, you take a complex number c. You square it and add the original number. You take that, square it, and add the original. You do this a number of times. If the value stays relatively close to zero, the number is in the Mandelbrot set. If the value takes off away from zero, the number is not in the Mandelbrot set. Typically, one colors in the parts of the picture that aren’t in the Mandelbrot set with some color that indicates just how fast it hightailed it out of there.

I wanted to try something different. I wanted to see what the iteration process looks like. So, I threw together some code using Lisp with cl-opengl.

fibersThe first visualization that I coded was to start with tiny patches of the complex plane. From each patch, I would extrude it up out of the plane and over to its next iteration. The picture at the right is (IIRC) a patch with side-length one half centered at i with either 25 or 36 patches tiled in that area. As you can see, this isn’t a wholly satisfying picture of what’s going on.

The other idea that I had was to show the progress through iterations as an animation. This is a bit more interesting to look at until some of the patches start overflowing my floating point numbers or get too big for my clipping region. This is an area of side-length one centered at the origin with four-hundred patches. Here is a movie of that flow.

Finding Better Polynomials May 12th, 2009
Patrick Stein

Some time ago, I wrote a small domain-specific language for finding polynomials given their value or the value of their derivatives at particular points.

It occurred to me shortly after writing that code that I could easily extend it to include the value of its integral over a certain range. I didn’t get to tackling that right away, and that was a Good Thing. In the intervening time, it occurred to me that I could extend it to moments as well.

So, are you looking for a polynomial that is zero at both zero and one, has a derivative of zero at one, has a second derivative of negative one at one, whose integral from zero to one is one, and whose mean (first moment centered at zero) on the interval zero to one is one fourth?

(polynomial-to-string
  (calculate-polynomial-subject-to
    (value :at 0 :equals 0)
    (value :at 1 :equals 0)
    (derivative :at 1 :equals 0)
    (nth-derivative 2 :at 1 :equals -1)
    (integral :from 0 :to 1 :equals 1)
    (mean :from 0 :to 1 :equals 1/4)))

Well, that would be f(x) = \frac{149}{4}x - 163x^2 + 265x^3 - 190x^4 + \frac{203}{4}x^5. (For some reason though, gnuplot thinks f(x) = -1, so no graph for you…)

Here is the source file.

graph
Edit: I realized that gnuplot was off by one because it was truncating the fractions. So, I just changed the 4’s in the denominators to 4.0’s and Bob’s your uncle.

 

Study with Me: Enter Snail Mail May 11th, 2009
Patrick Stein

I have not received a response from the rights department at Cambridge University Press about using one of their books to publicly study Clifford Algebras. I sent a follow-on letter in snail mail. It should be arriving there today.

Hopefully, I will hear back from them soon. If I don’t, the questions become: Should I forge ahead until they send me a cease and desist? Should I pick a different book? Should I just avoid quoting anything sizable?

Study Clifford Algebras with Me May 4th, 2009
Patrick Stein

I want to learn more about Clifford Algebras. I want you to join me on the journey.

I just sent an email to Cambridge University Press asking permission to use the book Clifford Algebras and the Classical Groups by Ian R. Porteous as the outline and springboard for a long series of posts about Clifford Algebras.

More details once they respond….

Updates In Email

Email:

l