Search Forum
(53671 Postings)
Search Site/Articles

Archived Articles
712 Articles

C# Books
C# Consultants
What Is C#?
Download Compiler
Code Archive
Archived Articles
Advertise
Contribute
C# Jobs
Beginners Tutorial
C# Contractors
C# Consulting
Links
C# Manual
Contact Us
Legal

GoDiagram for .NET from Northwoods Software www.nwoods.com


 
Printable Version

Mandelbrot Image Programming in C#
By Theron Wirenga

It was a number of years ago, in August of 1985, when the cover of the Scientific American caught my eye. The abstract image seemed somehow familiar but after further examination I discovered it was an entirely new area of mathematics called fractals. A. K. Dewdney's article in his Computer Recreations column entitled "A computer microscope zooms in for a look at the most complex object in mathematics." fascinated me. This article was the first exposure the general public had to Benoit Mandelbrot's fractal images and, perhaps more than many other technical articles, launched a popular interest in fractal programming. Within a few days of reading the article I had produced a black and white 50 pixel square image of the Mandelbrot set on an IBM PC with an Intel 8088 CPU, an effort that took a several hours of computing time as I recall.

As the 1980's progressed I purchased an IBM Model 50, which could display these fractal images in 16 colors and on a 640 x 480 pixel screen. Later my fractals appeared in even greater detail on an IBM Model 70 with 256 colors and a 1024 x 768 screen. During this time most of my fractal programming was in Pascal, as Borland had produced an inexpensive Pascal compiler that was a quantum leap in speed from the old BASIC interpreters. Later Borland produced a C compiler as well and my fractal programs migrated to this language. Up until the early 1990's all of these programs were written for the MS-DOS operating system. Computation times for large Mandelbrot fractal images remained long, in many cases several hours and even overnight. The introduction of math coprocessors in the Intel 486 CPU helped reduced computation time and the Pentium family with its multiple pipes has finally brought the rendering time down to reasonable levels.

As the Pentium CPU family was introduced I began writing my first Windows program that produced a Mandelbrot fractal image. If you haven't figured it out by now, yes I'm a bit enthralled with these images and continue to spend time writing even more involved programs for their generation and display. Actually, I find it relaxing. Whenever work or other cares press in I find myself at the computer watching a new Mandelbrot image painting its way across the screen. It's my form of therapy.

Mandelbrot images aren't that hard to compute, you just need a computer because you end up with millions and billions of multiplications to form an image. The core of the computations for these images take up only a few lines of code and you can cut and paste this code into any program fairly easily.

The Mandelbrot set is computed by operating on a fairly simple equation that contains complex numbers of the form

[Continued]