LMB7421@RITVAX.BITNET (03/17/88)
Below is a BASIC program which will compute at least some of the Mandelbrot Set. It requires an Ampersand utility from Nibble which plots on the Super-Res screen. If you have a similar utility, modify lines 25 and 110 according to your specific utility. PN is Rmin PX is Rmax QN is Imin QX is Imax M is the Mandelbrot limit (set this higher for high magnification if necessary) CS is the maximum number of colors - 1 MC is the maximum simulated number of non - 0 colors. If MC is greater than CS, the non-0 colors are repeated as K MOD CS + 1 K is the current simulated color. If K = MC, then the point is considered to be a member of the set, and is assigned color 0 (black) You can set the palette as you choose, using the palette changer in the ampersand utility. I used a scheme where color 0 = black, and colors 1 - 15 had blue = 10, and red and green = ColorNumber, which gives a range from dark blue through yellow. Once the picture is done (this will take at least 14 hours, unless you've chosen a range that's very large or far away from the set), you can save the picture by typing the following (type carefully, as you won't have a visible command line until after the C029:41) CALL - 151 C029:41 00/1000<E1/2000.9FFFM CREATE file.nam , T$C1 BSAVE file.nam , A$1000, E$8FFF, T$C1 This program works under ProDOS Standard values for the set are Rmin (Pmin) = -2.25 Rmax (Pmax) = 0.75 Imin (Qmin) = -1.5 Imax (Qmax) = 1.5 Choose other values from the boundary region of the set (try to read them from the screen, get them from the Peitgen book, or send me e-mail) I will be the first to admit the lack of speed in this program, but it DOES work. Go on vacation while it's working, turn off the monitor and play a ten-round monopoly tournament, but don't stand and watch it, it's like watching grass grow. There is a TMLPascal version in the works, but I can't seem to get the thing to write a file correctly, so it currently runs and gets the reset button treatment to save. This is a cheap and dirty program . Distribute freely. -------------------------------------------------------------------- 0 REM Freeware program see line 10000 for more info 10 INPUT "Input Pmin, Pmax, Qmin, Qmax: ";PN,PX,QN,QX 20 M = 100 22 MC = 225 23 CS = 15 25 & HGR 30 DP = (PX - PN) / 319 : DQ = (QX - QN) / 199 40 FOR Y = 0 TO 199: FOR X = 0 TO 319 50 P = PN + X * DP : Q = QN + Y * DQ: K = 0 : X0 = 0 : Y0 = 0 60 XK = X0 * X0 - Y0 * Y0 + P : YK = 2 * X0 * Y0 + Q 70 K = K + 1: X0 = XK : Y0 = YK : R = X0 * X0 + Y0 * Y0 80 IF R > M THEN CL = K - INT(K / CS) * CS + 1 : GOTO 110 90 IF K = MC THEN CL = 0 : GOTO 110 100 GOTO 60 110 & HCOLOR= CL : & HPLOT X , Y : NEXT X : NEXT Y 10000 REM _______________________________________________ 10010 REM | | 10020 REM | Mandelbrot Set grapher | 10030 REM | by | 10040 REM | Les Barstow | 10050 REM | LMB7421@RITVAX.BITNET | 10060 REM | rutgers!rochester!ritcv!ultb!lmb7421 | 10070 REM | 292 Kimball Dr. Rochester, NY 14623 | 10080 REM | | 10090 REM +---------------------------------------------+ 10100 REM ***Freeware. Distribute, don't sell.