.. Created by Adam Cunnningham on Fri Jun 3 2016. **Newton in the Complex Plane** =============================== Report Description ------------------ The report consists of the following exercises. **Exercise 1.** Use Newton's method to find which root different points in a rectangular portion of the complex plane converge to for the equation :math:`f(z) = z^3 - 1`. **Exercise 2.** Color the points in this region according to which root they converge to using red, green, and blue (or some other colors of your choice). **Exercise 3.** Make an additional zoomed in picture of some interesting region. **Exercise 4.** Make a picture encoding the number of iterations needed to converge in the brightness of the color. Hints and Suggestions for the Report ------------------------------------ Generating the Image ~~~~~~~~~~~~~~~~~~~~ - Use ``meshgrid`` to generate the array of points in the complex plane, then iterate using Newton's method on the whole array. - Find the root that each point converges to by checking if each point ends up closer to the root than some tolerance. - Set each component of the color separately, or use NumPy indexing with boolean arrays to set the entire color according to the root. - Increase the number of points used, since the image shown on the website is of low resolution. - Increase the number of iterations enough to remove any black areas from the image. These correspond to points that have not converged to any of the three roots. - Images can be displayed using ``imshow``. - Images can be saved using ``imsave``. They can also be saved directly from the IPython notebook, or from the window that the image is being displayed in. Making a Zoomed in Picture of Some Interesting Region ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - The displayed region of the complex plane can be changed by modifying the arguments to ``linspace`` in the website code. - How you define "interesting" is up to you. - Within limits. For example, a picture of a solid red square does not count as interesting in this context. Encoding the Number of Iterations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - The "number of iterations" refers to how many steps Newton's method requires for a given point in the complex plane to converge to a given root. - The current code on the website can already detect if a point has converged to a given root. This is only run once though, after Newton's method has finished. - Testing for convergence after *each* iteration of Newton's method can be used as the basis for finding the number of iterations needed. - The number of iterations needed will be an integer less than or equal to the maximum number of iterations. To be encoded as a brightness, this will need to be scaled somehow to a float in the interval [0, 1] and applied to the appropriate color components.