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

In summary, the conversation discusses the idea of plotting the Mandelbrot set using a computer. The equation Z_{n+1}=Z_n^2+c is used, with given parameters of Z_0=0, maximum of 100 iterations, and step value of 0.01. The process involves iterating through the x and y planes and plotting points on a Cartesian coordinate system. The author also mentions an example where step values are calculated instead of explicitly defined, and questions the reasoning behind it.
  • #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.
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 [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:
Physics news on Phys.org
  • #2
Bump. :smile:
 

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

1. What is the Mandelbrot set?

The Mandelbrot set is a famous mathematical set named after mathematician Benoit Mandelbrot. It is a set of complex numbers that, when plotted on a complex plane, create a beautiful and intricate fractal shape.

2. How is the Mandelbrot set plotted?

The Mandelbrot set is plotted by using a complex number iteration formula. For each point on the complex plane, the formula is repeatedly applied, and if the resulting value stays within a certain range, that point is considered part of the set. The process is then repeated for every point on the plane, creating a visual representation of the set.

3. What is the significance of the Mandelbrot set?

The Mandelbrot set has significance in both mathematics and art. It is a beautiful and complex visual representation of mathematical concepts, and it has also been used in various fields such as computer graphics and chaos theory.

4. How can the Mandelbrot set be used in real-world applications?

While the Mandelbrot set is primarily a mathematical concept, it has been used in various real-world applications. It has been used in computer graphics to create intricate and visually appealing designs, and it has also been used in the study of chaos theory to understand complex systems such as weather patterns and the stock market.

5. Is there a limit to how deep the Mandelbrot set can be zoomed in?

Technically, there is no limit to how deep the Mandelbrot set can be zoomed in. As the formula is applied repeatedly, smaller and smaller details continue to appear. However, due to computational limitations, there is a practical limit to how deep we can zoom in and still see meaningful results.

Similar threads

  • Calculus and Beyond Homework Help
Replies
4
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
2K
  • Atomic and Condensed Matter
Replies
7
Views
494
  • Calculus and Beyond Homework Help
Replies
8
Views
2K
Replies
5
Views
1K
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
1
Views
975
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
951
  • Engineering and Comp Sci Homework Help
Replies
10
Views
2K
Back
Top