Mandelbrot Set Generator [fixed]
 Posted by Gizmosis350k Last Updated: April 09, 2012   2264

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ch04Ex06
{
class Program
{
static void Main(string[] args)
{
double realCoord, imagCoord;
double realTemp, imagTemp, realTemp2, arg;
int iterations;
for (imagCoord = 1.2; imagCoord >= -1.2; imagCoord -= 0.05)
{
for (realCoord = -0.6; realCoord <= 1.77; realCoord += 0.03)
{
iterations = 0;
realTemp = realCoord;
imagTemp = imagCoord;
arg = (realCoord * realCoord) + (imagCoord * imagCoord);
while ((arg < 4) && (iterations < 40))
{
realTemp2 = (realTemp * realTemp) - (imagTemp * imagTemp)
- realCoord;
imagTemp = (2 * realTemp * imagTemp) - imagCoord;
realTemp = realTemp2;
arg = (realTemp * realTemp) + (imagTemp * imagTemp);
iterations += 1;
}
switch (iterations % 4)
{
case 0:
Console.Write(".");
break;
case 1:
Console.Write("o");
break;
case 2:
Console.Write("O");
break;
case 3:
Console.Write("@");
break;
}
}
Console.Write("\n");
}
}
}
}

I got the source code right after comparing it with the one from the site at wrox.com.

Basically, this demonstrates the for statement in lots fo style. The authors went a little overboard with this one, because things such as Mandelbrot Sets are for persons who are VERY verse in math, and so to be honest i only have a very limited understanding of how this function is capable of achieving such a  complex pattern.
In full colours, this is what it looks like:-

and this is what the program printout looks like:

 It's inverted and has pattern differences but as Wikipedia states, this pattern best demonstrates "Visual Mathematics". Also, i found out recently that lots of math is in store for me in later chapters. -_-
 Very kool man!  don't worry u will grasp all the concepts! it just a matter of time...
 u a gwan good thou giz
 Yea, I'm supposed to make a interactive version of this program soon O_O but, it shouldn't be THAT difficult, only a few variables that were assigned fixed values will prompt for the user to enter values within a certain range (this is where the ^ operator comes in for my version of the program Samath >.>) and then print a portion of the mandelbrot based on the integer range entered. This should be out as soon as I'm finished revising chapter 5 @.@