Fractals, Visualization, and J
Vector 13:1, page 64
Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 64
A hands-on course on mathematical visualization by Clifford A. Reiter, Iverson Software Inc., Toronto, 1995. viii+182 pp., 18 colour plates.
Cliff Reiter’s book breaks new ground. Hitherto, all books on J have been written by Kenneth Iverson or others (Roger Hui or Chris Burke) working at Iverson Software Inc. If J is to take off in a big way, and many of us hope very much that it will, all sorts of enthusiasts, and especially experienced teachers, must write J books at a variety of levels. Moreover, this is the first book with a focus on J as a way of doing graphics, thus providing a welcome extension of the range of applications for the language that have been publicised in detail.
Target Audience¶
It is a little difficult to say for whom the book is written, except in the fatuous sense that it is for anyone interested. The reader is not expected to know J (or indeed APL). Indeed, the examples might well get a beginner in J suitably excited, because we move fairly briskly to things that are fun to do, while also immediately getting a strong sense of the power and elegance of J. The reader is plotting polygons by p.5 and drawing a Sierpinski triangle on p.9. There are also several drill exercises for the learner, although they tend to be mixed up with much more substantial projects without overt discrimination. My guess, however, is that most readers would be better off cutting their teeth on other material introducing J.
Similarly, it is said that readers who have studied matrix algebra ought to find the mathematical level comfortable. That is about right with the proviso, presumably implicit, that they should have studied several other parts of mathematics to roughly the same level, say at least to a beginning university level. Any readers who have not yet come across fractals will also find some ideas introduced as if they were already broadly familiar.
Obtaining the Software¶
Access to J for Windows is required. Other files and programs produced by Reiter or available in the public domain are also essential for practical work. (They are now bundled with J Release 3.) A freeware version of the J interpreter or the other material may be obtained by anonymous ftp from the archive at the University of Waterloo.
Cliff Reiter has stuffed this book full of neat and clever things that you can do. They range from reproducing standard introductory examples to producing original pieces of mathematical research. To do it full justice would require many sessions on the computer, and perhaps also several bursts of reading to make up the reader’s mathematical deficiencies. I found that the story jumped around in a rather unpredictable manner. Indeed, most books touching on fractals seem consciously or unconsciously to mimic the nonlinear form of their subject. Major themes such as fractals, cellular automata, image processing and ray tracing tend to occur as attractors experiencing multiple visits during the reader’s trajectory. (Inevitably?)
It is difficult to imagine this book being used as a course text, unless the teacher were Cliff Reiter himself, or were to have exceptional verve and enthusiasm in projecting the material and helping the students at tricky points. Rather, this is primarily a book for private study. Here are some examples from among the many intriguing details. Gerunds are used to implement random transformations. Thus suppose one of the transformations t0, t1 or t2 is to be chosen with equal probability. The verb rt =. t0`t1`t2@.(?@3:) chooses randomly from 0, 1 and 2 and then correspondingly from the three transformations. Most of the examples of gerunds I have seen previously struck me as somewhat contrived (‘OK, but I can’t imagine actually wanting to do that’), so I like this example in which the construct appears naturally and neatly.
Sample Fractals¶
More substantial is the example of the Lorenz attractor (‘strange’ according to some), now a staple of chaotic dynamics, that arises from three coupled differential equations, originally a caricature of atmospheric convection. We get results with a dozen lines of code. This should be a good way to impress an applied mathematician or numerate scientist that J can be used to move quickly on serious projects. In my persona as a geomorphologist, I must comment on the fractal simulation of topography, familiar to most of us from movies or posters if not from Mandelbrot’s mathematics.
Reiter follows previous workers in drowning the lower levels on the resultant image. A good reason for such a graphical flood is that it looks more attractive to most of us, because of the primal or aesthetic appeal of water masses. A bad reason less often remarked is that it hides the least accurate characteristic of fractal-simulated topography, namely that the number of pits (local minima) is expected to be the same as the number of peaks (local maxima). Very few natural landscapes satisfy this equality: for a variety of physical reasons, not only are lowlands much smoother than highlands, but they also possess very few pits.
J reference sections in the Appendices are useful in their own right. In particular, there is a very useful summary of function composition that nicely complements Kenneth Iverson’s expositions. Commenting on a more pedantic level, I note a horror of hyphens (as in ‘the long term behavior of a real valued quadratic map’), and a generous sprinkling of typos: Reiter goes back and forth between ‘Mandelbrot’ (right) and ‘Mandlebrot’ (wrong) and he several times treats ‘automata’ as a singular noun. I did not spot any serious errors, although I did not always manage to get things working properly on my computer. It is a pity that the colour illustrations are all gathered at the end, presumably to keep the price down. Anyone with a strong interest in J, actual or potential, should get hold of this book and study it.