What is the best approach for plotting the Mandelbrot set using a computer?

Click For Summary
SUMMARY

The discussion focuses on plotting the Mandelbrot set using the iterative formula Z_{n+1}=Z_n^2+c, with Z_0=0 and a maximum of 100 iterations. The proposed method involves looping through the x and y planes in increments of 0.01, determining whether points belong to the Mandelbrot set based on the condition abs(Z) < 2. The user seeks clarification on the use of dynamic step values dx and dy in relation to scaling for a larger canvas, contrasting it with a fixed increment approach.

PREREQUISITES
  • Understanding of complex numbers and their representation in the Cartesian coordinate system.
  • Familiarity with iterative algorithms and convergence criteria.
  • Basic knowledge of programming concepts, particularly loops and conditionals.
  • Experience with graphical plotting libraries in programming languages such as Python or Java.
NEXT STEPS
  • Explore Python libraries such as Matplotlib for visualizing the Mandelbrot set.
  • Learn about dynamic scaling techniques for rendering fractals on different canvas sizes.
  • Investigate optimization techniques for improving the performance of Mandelbrot set calculations.
  • Study advanced coloring techniques for visualizing fractals based on iteration counts.
USEFUL FOR

Programmers, mathematics enthusiasts, and anyone interested in computer graphics or fractal geometry will benefit from this discussion.

cdotter
Messages
305
Reaction score
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


Z_{n+1}=Z_n^2+c for some constant c

The Attempt at a Solution


Given: Z_0=0, 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.
From there I would plot all the points using the corresponding iteration number to give a color. Points that are part of the set would be one color, points that are not part of the set would be another colored that is reflective of the number of iterations before abs(Z)>=2.

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 \pm 2 for x & y and then scaling them to a much larger 300 pixel canvas, rather than just using a \pm 2 canvas and plotting many smaller points in explicit increments of 0.01, like I do?
 
Last edited by a moderator:
Physics news on Phys.org
Bump. :smile:
 

Similar threads

Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
891
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
969
  • · Replies 8 ·
Replies
8
Views
2K
Replies
1
Views
1K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
892
  • · Replies 10 ·
Replies
10
Views
2K