- #1
cdotter
- 305
- 0
Homework Statement
Note: This is not for homework. I'm trying to teach myself programming and this looks like a fun project. I want to plot the Mandelbrot set using a computer.
Homework Equations
[itex]Z_{n+1}=Z_n^2+c[/itex] for some constant c
The Attempt at a Solution
Given: [itex]Z_0=0[/itex], maximum of 100 iterations, step value of 0.01.
Conceptually, I think I want to plot the points on Cartesian coordinate system centered at (0,0). Then x=Re(c) and y=Im(c).
Code:
Loop across the x plane in increments of 0.01
Loop across the y plane from in increments of 0.01
Iterate Z_{n+1}=Z_n^2+c 100 times, where is (x,y)=x+iy, breaking if abs(Z)>=2
If it breaks record the iteration it broke on.
Conceptually, is this correct?
I read another example where the author calculates step values dx and dy instead of explicitly defining them: http://kemenaran.winosx.com/?2008/05/16/126-petit-ensemble-de-mandelbrot-en-python I'm not really sure why they do this. Is it something to do with using values of [itex]\pm 2[/itex] for x & y and then scaling them to a much larger 300 pixel canvas, rather than just using a [itex]\pm 2[/itex] canvas and plotting many smaller points in explicit increments of 0.01, like I do?
Last edited by a moderator: