Your task is exercise 3.2.32 of the text book. Chaos with Newton's method. StdDraw doc, StdDraw.jar (Complex.java)
The method converges to one of the four roots, depending on
the starting point Z Using this method write a complex client Newton that takes a
command-line argument N and colors pixels in an N by- N canvas by mapping the pixels complex points in a regularly spaced grid
in the square of size 2 centered at the origin. (Complex.java) Iterate using the newton method 100 times and color of each pixel according to which of the four roots the corresponding point( the pixel coordinate) converges, i.e white if it converges to 1+0i red if it converges to -1+0i blue if it converges to 0+1i green if it converges to 0+-1i black if no convergence after 100 iterations Convergence is s the approach toward a definite value. When we iterate if the value approach to one of the roots i.e if it is within +/- 0.001 range of one of the roots, then we say the value converges. N.B.: Set the scale of your canvas between -1 and 1.
Choose a starting point Zo ( x , y ) Note: For drawing the picture use StdDraw.java . you can use the following format to draw picture for the corresponding pixels,public static void point(double x, double y). Also, at the start of the program call StdDraw.show(0) and then call show() again at the end of the program to avoid drawing every pixel individually. Case 2: it should be easy for the program to plot given a different polynomial and its roots.Similarly, the polynomial f(z) = z ^{3} - 1 has three roots: at 1, -0.5-i*0.866, and -0.5+i*0.866. We
can find the roots using Newton's
method in the complex plane:the roots of f(z) are calculated as follows. For this polynomial we have 3 roots, so use the following colors: green if it converges to -0.5, 0.866i red if it converges to -0.5, -0.866i blue if it converges to 1 + 0i black if no convergence after 100 iterations |