Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please code in Java Task Your task is exercise 3.2.32 of the text book: Chaos with Newton's method. You also need stdlib.jar and Complex.java. How
Please code in Java
Task Your task is exercise 3.2.32 of the text book: Chaos with Newton's method. You also need stdlib.jar and Complex.java. How to use StdDraw: StdDraw.doc Case 1: The polynomial f(x) = 24 1 has four roots: at 1,-1, i, and -i. We can find the roots using Newton's method in the complex plane. Note that the derivative of the function is f'(z) = 4z. 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 Yellow if it converges to 1+0i Blue if it converges to -1 +0i Red if it converges to 0+ li Green if it converges to 0+ -li Black if no convergence after 100 iterations Convergence is 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. public static void setXscale (double min, double max) public static void setyscale (double min, double max) 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(O) 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) = 23-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 derivative of f(z) is f'(x) = 322 Since f(z) = 23 1 has three roots, so: Green if it converges to -0.5, 0.866i Blue if it converges to -0.5, -0.866i Red if it converges to 1 + Oi Black if no convergence after 100 iterations Task Your task is exercise 3.2.32 of the text book: Chaos with Newton's method. You also need stdlib.jar and Complex.java. How to use StdDraw: StdDraw.doc Case 1: The polynomial f(x) = 24 1 has four roots: at 1,-1, i, and -i. We can find the roots using Newton's method in the complex plane. Note that the derivative of the function is f'(z) = 4z. 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 Yellow if it converges to 1+0i Blue if it converges to -1 +0i Red if it converges to 0+ li Green if it converges to 0+ -li Black if no convergence after 100 iterations Convergence is 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. public static void setXscale (double min, double max) public static void setyscale (double min, double max) 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(O) 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) = 23-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 derivative of f(z) is f'(x) = 322 Since f(z) = 23 1 has three roots, so: Green if it converges to -0.5, 0.866i Blue if it converges to -0.5, -0.866i Red if it converges to 1 + Oi Black if no convergence after 100 iterations
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started