Mandelbrot Set Programs Posted

Martin Minow minow at decvax.UUCP
Wed Aug 7 10:59:54 AEST 1985


I recently posted a pair of programs to compute and display
the Mandelbrot set (as described in Scientific American, Aug.
1985) to net.sources.  In the readme.txt that accompanied the
posting, I suggested that this software would make an interesting
project for an introduction to computing sciences course.  This
note expands on that comment, suggesting a few "homework assignments".
It presupposes familiarity with the article.

1. (easy) Although the program deals with complex numbers, it does
   not define a complex datatype such as

	typedef struct complex {
	    double	real, imag;
	} COMPLEX;

   but rather defines the variables as, for example, z_real and z_imag.
   Why?  What does this tell you about the C language, compilation
   techniques, and the adaptation of programming style to real-world
   problems?

2. (harder) The program uses double-precision floating point variables
   to compute each set.  However, we know that the range of the (interesting)
   values is real [-2.0,+.50] and imag [-1.25,+1.25].

   Can the program be redesigned to use scaled fixed-point arithmetic?
   Would it be faster without losing accuracy?

   Can the computations be carried out in polar coordinates in a sensible
   manner?

3. (hardest) The program computes each point independently of all others.
   I.e, the algorithm may be summarized as follows:

	for (i = 0; i < npixels; i++) {
	    for (j = 0; j < npixels; j++) {
		compute set at pixel[i][j];
	    }
	}

   Can the value at pixel[i][j] be used to compute the value at
   pixel[i][j+1] or are the values truely independent?  Looking
   at the displayed results suggests a correlation.

Have fun.

Martin Minow
decvax!minow



More information about the Comp.lang.c mailing list