When working with the Mandelbrot set and related topics such as Julia curves, it is convenient to be able to follow out their recursive development. One way to arrive at the Julia curves is to calculate the images of the fixed points of a function, such as the quadratic w = z2 + c which underlies the Mandelbrot set. Since two square roots always arise in each counterimage and each of their counterimages should be calculated in turn, the whole structure resembles a gigantic binary tree.
To process it, one half is always saved while the other is run down to completion, following which the first half is given the same treatment. Such saving can be done on the pushdown list where complex arithmetic is being performed. In fact, the use of a pushdown list was dictated by foreseeing applications such as this one. Nevertheless the pushdown list is finite, only a part of the infinite calculation will ever be performed, so each recursive chain should be stopped when some assigned depth has been reached -- such as the extent of the pushdown list.
Additionally, performance of the recursion accounts for only part of the activity on the pushdown list, making it convenient to reckon the recursion depth independently, to one side. With luck, or planning, the recursive depth can be kept low enough to avoid pushdown overflow.
With some forty of fifty letters having been assigned to complex operations, there are not many left over, and certainly not nice mnemonic ones. But there are ways to keep within the philosophy of single letters; say by using double letters, which is a category which the REC compiler recognizes. To keep track of the depth of recursions, the heretofore unused l has been chosen, with a single-letter parameter, which is assigned as follows.
- z
- - Initialize the depth to zero
- +
- - Increment the depth
- -
- - Decrement the depth
- k
- {k = 0, 1, ..., 9} - True if the depth exceeds k, False otherwise.
From this specification, lx is seen to be a predicate, but it is always true except when testing for depth, at which time it is used in the form (lk too deep; go on;). Most likely, ``too deep'' would be null.
As another illustration of colorization, which can profitably be used in conjunction with a root tree, Figure 17 shows the result of a couple of iterations of the Julia set for the parameter -1. The light spots are zeroes, the rest is left to the imagination; apparently the rainbow is assigned to the phase of the function rather than its modulus.
However, to examine all the possibilities of complex function behavior is more the province of an article devoted to complex analysis than to the description of a program for performing the calculations. Even so, REC/C can be expected to evolve with further usage, as routes to better orgsnization become evident, or additional facilities are added to accomodate demands for additional calculations.