Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site decvax.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!harvard!talcott!panda!genrad!decvax!minow From: minow@decvax.UUCP (Martin Minow) Newsgroups: net.math,net.graphics,net.lang.c Subject: Mandelbrot Set Programs Posted Message-ID: <100@decvax.UUCP> Date: Tue, 6-Aug-85 20:59:54 EDT Article-I.D.: decvax.100 Posted: Tue Aug 6 20:59:54 1985 Date-Received: Sat, 10-Aug-85 04:50:15 EDT Lines: 47 Xref: linus net.math:1799 net.graphics:973 net.lang.c:5400 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