Let’s Do It Again

Iteration usually increases complexity. For example, ponder the following “Fractal Maze”. The green lines mark the boundaries of a frame that shows the black paths of a maze. Copies of that frame and the paths are copied inside. With 4 levels of nested frames, it is possible to get from 1 to 8 on the outer frame. When pictures are repeated inside themselves, it’s usually called the Droste effect.

Another simple experiment involves rolling a box around, each time toppling it over an edge. Where can the box wind up? “Box Toppling Patterns” shows how complicated moving a box can get.

So, obviously, when faced with thousands of calculations, using a computer can help a lot. But therein lies a danger. Most textbooks list as a property of logarithms that log(a b)=log(a)+log(b). Most of the time that’s correct, but unfortunately, there is a branch cut with logarithms. For negative integers, logarithms are discontinuous. More pictures are available at “Surface with Branch Cuts” (Yu-Sung Chang) or “The Monodromy Group of an Algebraic Function” (Maxim Rytin).

Many programming languages ignore branch cuts. Mathematica does not have that luxury—when released in 1988, there were various function combinations that could make nonsensical results. Eventually, most of these errors were resolved by being exceedingly careful with branch cuts. For example, here is a correct method for handling the Log function. Thousands of other examples for how to be careful are given at The Wolfram Functions Site. Many of the most crucial functions have been available for a decade now.

If you’re a fan of fractals, you’ve probably seen pictures of the Mandelbrot set and the like. The popular fractals are built on continuous functions, such as x2. When a discontinuous function is used as the basis of a fractal, the result is a chaotic soup of discontinuities, which tends to be ugly to the human eye.

Why do I mention all this? Financial formulas tend to use many mathematical functions that have discontinuities. They can have bifurcations, which are the basis of catastrophe theory. When such a function is iterated outside of a careful program like Mathematica, the results can be meaningless. Making big financial decisions based on something utterly meaningless billions of times a second can be highly dangerous. Here’s a chart of the stock market on May 6, 2010 from Wikipedia.

If lives or fortunes depend on the functions you’re combining and iterating, at least make sure that extreme caution went into their construction. Wolfram Research learned the hard way, two decades ago, how combined functions could misbehave. In Mathematica, these dangerous errors have been fixed for a long time. Iterate cautiously.