home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 222 / 222.d81 / t.microscope < prev    next >
Encoding:
Text File  |  2002-01-01  |  11.2 KB  |  403 lines

  1. u
  2.          MANDELBROT MICROSCOPE
  3.  
  4.             by Neal Butler
  5.  
  6.  
  7.  [DAVE'S PRE-RAMBLE:] If computers
  8. would never have word processors or
  9. spread sheets or 3-D Virtual Reality
  10. or email or the Web, it would have
  11. been sufficient for Mandelbrot to have
  12. discovered his Set.
  13.  
  14.     What, you may ask, [is] the
  15. Mandelbrot Set? Just numbers, ma'am.
  16. Nothing but numbers. But when certain
  17. numbers -- real and unreal -- are
  18. calculated over and over, the result
  19. hangs around a certain point. I
  20. believe this is called "strange
  21. attracters." Other pairs of numbers,
  22. calculated the same way soon take off
  23. for infinity and never return.
  24.  
  25.     When Benoit Mandelbrot of IBM put
  26. a grid of numbers to the test a
  27. strange thing occured. Unique and
  28. recognizable areas appeared as the
  29. results were graphed.
  30.  
  31.     Like a slow-scan transmission
  32. from an interplanetary satellite, the
  33. image builds on the screen. An island
  34. with a strange big-butted bug shape
  35. appears, with a somewhat hairy coast
  36. line. But move in closer, and behold!
  37. the features of the coast repeat
  38. themselves, with iterated variations.
  39. Move in even closer, and the rough
  40. places prove to be comprised of the
  41. same kinds of shapes.
  42.  
  43.     The official name is "fractals."
  44. I think an old rhyme says it better:
  45.  
  46.  Little fleas have lesser fleas
  47.  Upon their backs to bite 'em.
  48.  The lesser fleas have smaller still,
  49.  And so, ad infinitum!
  50.  
  51.  
  52.  [FENDER'S PREMUMBLE:] Soon after I
  53. got my CMD SuperCPU, which increases
  54. the clock speed of the C-64 from 1
  55. MHz to 20 MHz, I looked for some
  56. programs that could show off what the
  57. speed increase can do. This program
  58. was one of the first I tried and it's
  59. great at 20 MHz. It doesn't look as
  60. though the Mandelbrot is plotted 20
  61. times as fast, but it's fast enough
  62. to make it much more interesting to
  63. watch.
  64.  
  65.  [DAVE'S INTERRUPTION:] The SuperCPU
  66. will run at 20 Mhz -- unless screen
  67. memory needs to be refreshed. This has
  68. to be in the C-64 itself, and cuts the
  69. effective speed to 8 - 10 Mhz.
  70.  
  71.  
  72.  [FENDER AGAIN:]
  73.  
  74.     A great companion piece for
  75. MANDELBROT MICROSCOPE is Ian Adam's
  76. JULIA SETS, which we've also upgraded
  77. and improved. It'll probably appear
  78. on next month's issue. Of course you
  79. don't need a SuperCPU to enjoy the
  80. incredible complexities of fractals,
  81. but the faster they're plotted the
  82. more we feel like gods overlooking
  83. our little pocket universes. And we
  84. all need that from time to time.
  85.  
  86.  
  87.  [DAVE AGAIN:] Yep! JULIA SETS is
  88. slated for 223.
  89.  
  90.  
  91.  [EMULATOR NOTE:] We don't have a
  92. SuperCPU on our emulator, but we [do]
  93. have Warp Speed. On our 950 MHz
  94. Gateway, Warp cranks at 3500% --
  95. faster than the SuperCPU by 15 times.
  96.  
  97.     Kicking in Warp is easy: just
  98. press <Alt-W>. The same turns it off.
  99. Any sound is cut out, but for a
  100. number cruncher like this program,
  101. you don't have sound anyway.
  102.  
  103.     So I pressed <Alt-O><S> and
  104. turned off the sound all together.
  105. Then I booted up WinAmp and played my
  106. favorite music, downloaded off
  107. Napster. Songs like "Boris the
  108. Spider" make watching the scan lines
  109. march across the screen a real
  110. thrill.
  111.  
  112.     [Now] this thing is [RRREALLY]
  113. addictive. I must quit so you can
  114. receive this issue.
  115.  
  116.     Here are Neal's slightly edited
  117. docs from the original publication of
  118. MANDELBROT MICROSCOPE from LS #86:
  119.  
  120.  
  121.     The "Mandelbrot" set (named after
  122. Benoit Mandelbrot of IBM) is the set
  123. of complex numbers c such that the
  124. iteration z=z^2+c remains finite.
  125. This set can only be explored with a
  126. computer program due to the large
  127. number of computations required.
  128. Even on a computer, the enormous
  129. number of computations take up more
  130. time than most people are accustomed
  131. to when dealing with computers.
  132. After all, computers can multiply
  133. almost instantly, right?  Well -- not
  134. really. It happens VERY quickly, but
  135. not quite instantly
  136.  
  137.     So when you compound tens of
  138. thousands of "near-instants", you get
  139. moments. Moments become seconds.
  140. Seconds become minutes. A C-64 can
  141. compute your entire city's fiscal
  142. budget in seconds. Calculating a
  143. Mandelbrot image involves much more
  144. math. A typical image will take about
  145. fifteen minutes to produce. Some much
  146. faster, some MUCH slower. It depends
  147. on the nature of the image.
  148.  
  149.     For speed, I chose a 160 X 100
  150. format. Once you've found the image
  151. of your dreams, you can press "I" and
  152. double the resolution to 160 X 200 by
  153. interpolating. More on that later.
  154. The program allows you to choose each
  155. of the four colors. Color 0 is used
  156. for the border and for points which
  157. are nearest the set.
  158.  
  159.  [NOTE:] Areas of the Mandelbrot image
  160. that contain color 0 will take the
  161. longest time to plot. Unfortunately,
  162. that's usually where most of the
  163. action is.
  164.  
  165.     When you boot MANDELBROT
  166. MICROSCOPE, it will automatically LOAD
  167. and display the original Mandelbrot
  168. image. While this graphic screen is
  169. showing, these keys are active:
  170.  
  171.  H or SPACE - for the help screen/menu
  172.  X - Cursor On  Cycle 6x/10x/Off
  173.  C - Change Cursor Color  Cycle 0-15
  174.  CRSR keys - maneuver cursor
  175.  M - magnify (zoom in) at cursor
  176.  
  177.     Pressing X will pop up a white
  178. box-shaped cursor. You use it to pick
  179. a section of the Mandelbrot to
  180. enlarge. The larger box magnifies
  181. 6.7x. Press X again and the box will
  182. shrink to its 10x perspective.
  183. Pressing X again will turn the cursor
  184. off. The color of the cursor box can
  185. be changed by pressing C while the
  186. cursor is showing.
  187.  
  188.     You can exit the graphics mode by
  189. pressing G and manually enter the
  190. magnification by pressing M. You can
  191. specify any magnification from 1 to
  192. 25X the current magnification. The
  193. maximum magnification allowed by the
  194. progam is 1,000,000! One of the
  195. curious things about the Mandelbrot
  196. set is that there is always something
  197. interesting to see at any
  198. magnification.
  199.  
  200.  
  201.  [THE HELP (OR TEXT) SCREEN]
  202.  [-------------------------]
  203.  
  204.     You can type H or SPACE for the
  205. help (or text) screen. G will toggle
  206. between the graphic and text screens.
  207. The help screen shows all of the
  208. active keys in both modes: Graphic
  209. and Text. Here's what you'll see on
  210. the Text screen:
  211.  
  212.     At the top, the current
  213. magnification is shown along with the
  214. relative position of the viewing
  215. area. While this screen is showing,
  216. these keys are active:
  217.  
  218.  G - Toggle display
  219.  L - Change iteration limit
  220.  M - Magnify at cursor
  221.  C - Change four-color scheme
  222.  R - Change color repeat count
  223.  S - Save image and data
  224.  D - Load Image
  225.  
  226.     The iteration limit is the
  227. maximum number of times the program
  228. will iterate before quitting for each
  229. point. The maximum limit is 255.
  230. Points which reach the limit are
  231. assigned to color 0 (normally black),
  232. as is often done in published photos.
  233.  
  234.     The color repeat count determines
  235. how many times each color is used.
  236. Changing the colors and the repeat
  237. count does not require much
  238. computation, so you can experiment
  239. for the best picture. Using this
  240. feature can dramatically change the
  241. look of your image, and even reveal
  242. hidden patterns. Each of the 16,000
  243. points in the display represents a
  244. different value of c, and the color
  245. displayed at that point depends on
  246. how many iterations were completed
  247. before the computation diverges. (If
  248. the absolute value of z ever exceeds
  249. 2, the iteration will diverge.)
  250.  
  251.     The images can also be saved and
  252. loaded from disk. The actual
  253. iteration values are stored along
  254. with the display so that you can
  255. modify stored pictures without
  256. starting from scratch. However, this
  257. means that a saved file is 95 blocks
  258. long! Be sure you have enough room on
  259. a disk before saving. Up to six
  260. images can be stored on one 1541
  261. disk and of course many more on a
  262. 1581 or CMD native mode partition.
  263.  
  264.     The last step of playing with a
  265. picture should be the interpolation,
  266. which doubles the resolution to 160 X
  267. 200. There isn't enough memory to
  268. store these iteration values, so any
  269. change to the image (except changing
  270. the colors) results in lowering the
  271. resolution to the basic 160 X 100.
  272.  
  273.     The program comes with the
  274. original Mandelbrot image, named "1"
  275. with brackets around it. When you
  276. save a zoomed image, you don't have
  277. to use numbers; you can use any
  278. filename you want. Don't enter the
  279. brackets -- they'll be added for
  280. you.
  281.  
  282.     I find that gradually increasing
  283. the magnification and iteration limit
  284. is the best way to zero in on
  285. interesting areas, much like using a
  286. real microscope. Increasing the
  287. iteration limit results only in
  288. recomputation of points which reached
  289. the old limit. Reducing the
  290. iteration limit involves no new
  291. computation. The limit can be
  292. increased up to the previous largest
  293. value without recomputation.
  294.  
  295.  
  296.  [HOW IT'S DONE SO FAST]
  297.  [---------------------]
  298.  
  299.     The main problem with Mandelbrot
  300. set computations is speed. The
  301. solution is to write the fastest
  302. possible multiply routine. The
  303. approach I used is the table look up
  304. method taught in elementary school.
  305. The multiply routines first compute a
  306. complete set of look up tables in
  307. base 128 (7 bits). The numbers are
  308. stored as 5 digit (35 bit) numbers.
  309. Multiplication then just involves
  310. looking up and summing all the
  311. partial products. The multiplication
  312. tables occupy exactly 1/2 of the C-64
  313. RAM (32,768 bytes). The computation
  314. routines in this program are about 20
  315. times faster than BASIC: about 1,000
  316. iterations of the formula per second,
  317. with about the same accuracy.
  318.  
  319.     Again, as Mandelbrot generators
  320. go, this one is a bit fast. Those
  321. who have never generated Mandelbrots
  322. before may not be able to appreciate
  323. the speed since it DOES take a while
  324. to generate an image.
  325.  
  326.  
  327.  [FENDER'S ORIGINAL POSTMUMBLE:] I
  328. just read Isaac Asimov's latest
  329. book, THE SECRET OF THE UNIVERSE.
  330. It's a compilation of related essays
  331. on science, as are many of his books.
  332. Isaac was asked if he thinks we will
  333. ever fully understand the universe,
  334. and at the beginning of the book is
  335. fairly optimistic that if man
  336. survives long enough he will begin to
  337. narrow in on understanding
  338. everything.
  339.  
  340.     Then one day he was shown a
  341. Mandelbrot set on a super-fast
  342. computer (some sort of mainframe) and
  343. as he saw the program zoom in over
  344. and over again (as you can do with
  345. MANDELBROT MICROSCOPE) he gets a
  346. flash that the universe is more like
  347. a fractal than he thought. He
  348. proclaims that he now believes that
  349. there is an infinity of things to
  350. learn about even the simplest part of
  351. the universe, and that the deeper we
  352. look, the bigger the infinity is.
  353.  
  354.     He calls this revelation the
  355. Secret of the Universe, and he says
  356. he owes it all to the Mandelbrot
  357. program.
  358.  
  359.     As editor of LOADSTAR I am proud
  360. to be able to publish a program that
  361. can make Isaac Asimov change his
  362. mind. Thank you, Neal Butler.
  363.  
  364.  
  365.  [FENDER'S NEW POSTMUMBLE:] Our
  366. beloved Isaac Asimov died in April
  367. 1992 so it's debatable (or not)
  368. whether he knows more about the
  369. Secret of the Universe now, or not.
  370. But if he [is] able to appreciate
  371. anything, I hope he gets a kick out
  372. of the fact that many of us can now
  373. see the Secret of the Universe in
  374. minutes, rather than hours.
  375.  
  376.  Whatever stage of the fractal you're
  377. in, Isaac, we miss you and your
  378. books.
  379.  
  380.  FT
  381.  
  382.  [DAVE'S FINAL WORD:] Back in the
  383. early days of computers, RCA built a
  384. machine that worked like Neal's
  385. clever multiplier: All the math was
  386. done by tables rather than logic.
  387. That machine got the nickname
  388. "CADET:" Can't Add, Doesn't Even Try!
  389.  
  390.     This program nearly wasted a full
  391. day because I just couldn't stop
  392. making new scans. VICE has a nifty
  393. Screen Shot function (in the Snapshot
  394. menu), which turns the screen into a
  395. BMP image that you can save anywhere.
  396. If you are not planning to go back
  397. and continue exploring an image, take
  398. a screen shot. Amaze people by
  399. putting it up as your "wallpaper."
  400.  
  401.  DMM
  402.  
  403.  
  404.