Computer Science Canada

mandelbrot fractal algorithm?

Author:  Blade [ Sat Aug 14, 2004 12:53 am ]
Post subject:  mandelbrot fractal algorithm?

I know how the mandelbrot works on paper, but it seems to be entirely different when its put into programming. to the best of my understanding the pixel color is found by how many iterations is completed before exiting, and that is the only part i understand of the program. if someone could explain this to me, i'd really appretiate it. i have searched for the past few days to figure out how the code works -- but i've had no luck (i know php (which i guess is a lot like c++), and turing if you want to use examples)

and please dont give me the code for this -- i just want to know how it works

Author:  Catalyst [ Sat Aug 14, 2004 10:53 am ]
Post subject: 

ok the algorithm is fairly simple for this, here we go:

your basic mandlebrot equation goes like this:
Z=Z**2 + C where both Z and C are complex numbers
in the mandlebrot fractal C is the same point you are iterating (x is i and y is r or viceversa), in the julia set, it is constant

for each point you run this iteration over and over again each time testing its distance from the origin. If the distance is greater than somevalue (usually around 2) then point is not it the set. If the point is iterated the maximum amount of times and is still within the distance, it is considered within the set. The colors are usually based on how many iterations it to "escape".


: