Some help rendering the Mandelbrot set

前端 未结 4 450
情深已故
情深已故 2021-01-13 18:15

I have been given some work to do with the fractal visualisation of the Mandelbrot set.

I\'m not looking for a complete solution (naturally), I\'m asking for help wi

4条回答
  •  没有蜡笔的小新
    2021-01-13 18:25

    Actually the Mandelbrot set is the set of complex numbers for which the iteration converges.

    So the only points in the Mandelbrot set are that big boring colour in the middle. and all of the pretty colours you see are doing nothing more than representing the rate at which points near the boundary (but the wrong side) spin off to infinity.

    In mathspeak,

    M = {c in C : lim (k -> inf) z_k = 0 } where z_0 = c, z_(k+1) = z_k^2 + c
    

    ie pick any complex number c. Now to determine whether it is in the set, repeatedly iterate it z_0 = c, z_(k+1) = z_k^2 + c, and z_k will approach either zero or infinity. If its limit (as k tends to infinity) is zero, then it is in. Otherwise not.

    It is possible to prove that once |z_k| > 2, it is not going to converge. This is a good exercise in optimisation: IIRC |Z_k|^2 > 2 is sufficient... either way, squaring up will save you the expensive sqrt() function.

提交回复
热议问题