/ Published in: Other
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
For each pixel on the screen do: { x0 = x co-ordinate of pixel y0 = y co-ordinate of pixel x = 0 y = 0 iteration = 0 max_iteration = 1000 while ( x*x y*y <= (2*2) AND iteration < max_iteration ) { xtemp = x*x - y*y x0 y = 2*x*y y0 x = xtemp iteration = iteration 1 } if ( iteration == max_iteration ) then color = black else color = iteration plot(x0,y0,color) }
URL: http://en.wikipedia.org/wiki/Mandelbrot_set