jump to navigation

Newton Fractal Visualization with Python August 13, 2009

Posted by halfawake in Alchemy.
Tags: , , ,
trackback

I felt like trying something new, so I wrote a Python script to plot Newton’s fractal.

Newton's Fractal (30 iterations, 1500 x 1500 resolution, 1e-6 convergence)

This graphic shows the time to convergence for solving z^4+1 = 0 using Newton’s Method.  The solution to this equation is one of four possibilities, which are represented using the colors red, blue, green, and yellow.  The solution that Newton’s Method returns depends on the initial guess.  I plotted the final solution for initial guesses in the range 0-1 (real, horizontal axis) and 0j-0j (imaginary, vertical axis).  Color depth represents faster convergence to a particular soltion (i.e., brighter pixels represent initial guesses that converge to a solution faster).

The script is based heavily on Listing 7-1 from “Beginning Python Visualization” by Shai Vaingast. It’s a good book with other fun examples, but my code for this problem is here.

Comments»

1. weirleader - August 19, 2009

good stuff. I just did some work with the Julia set in MATLAB and I love how relatively simple it was once I understood the tools I had to work with. Of course, the ease of swapping colors around and defining tolerances also made it pretty simple to get some slick pictures.