For this homework, we are going to consider the straightforward problem of applying Newton's method to ﬁnding the roots of the simple third-order polynomial 1:3 — 1. For this

simple polynomial we lmow there are three roots, one of which by inspection is l. The other

two are complex numbers whose cube is also 1: the two numbers {—1 :l: ﬁjﬂﬂ have this

property, which you can {and should} verify in Matlab. Newton’s method for ﬁnding one of these roots consists of iteratively improving an initial

guess a by repeatedly applying the rule _ 23 —1

3r:2 until lea — 1| is suﬁciently small; we'll use 11]"5 as a tolerance level for this homework. Since the roots are generally complex, so too might be e. Newton’s method works

perfectly well for complex values of a, but we must he sure to do the complex-valued

arithmetic properly. As we saw on LEG, Il:i'++ won't do this for us natively, and we will

need to implement the rules for complex subtraction, multiplication, and division manually.

[Integer powers are just repeated multiplication, so those are implicitly covered in the rules

we practiced this week}. Remember that mixing real and complex arithmetic is easily

accomplished by treating any real number as a complex with zero imaginary part {so 1

is really 1 + 03‘ and 3 is really 3 + ﬂj in the equation above} Finally note that for the

absolute value in the convergence test, you need to use the deﬁnition ofthe absolute value

[magnitude] of a complex number. Now, since we already know what the roots of this polynomial are, you might wonder

why we would go through the trouble of writing a program to I[at best approximately) ﬁnd

one. It turns out that there is a fascinating, indeed fractal, geometric ﬁgure hiding in the

Newton calculations for this problem. Barring pathological choices of initial guess for e [and it is possible for Newton to diverge

for a very poor initial guess}, any initial guess will converge to one of the three roots. The

question is: which one? Theoretically, and experimentally, initial guesses in a connected

region of the complex plane "surrounding"I one of the three roots will converge to the nearest

one. But what about regions of the plane that are approximately equidistant from two or

more roots? These might converge equally well to any of the roots, and the boundaries between points which converge to different roots can be very complex [and non-obvious},

resulting in a beautiful fractal structure it visualised graphically. i=2 So that‘s what we want to do with our program. We want it to accept as an input the

choice of initial guess for a. After Newton's metlrod has converged to a root, we want the

program to "graphically"I describe the root to which the initial guess has converged. For

this, we‘ll assign a color corresponding to each of the three roots, "red“l for the root at 1, “green” for the root at. {—1 + veins, and “blue” for the root at [—1 — isms.

A. sample run of your program should look as shown at the top of the following page: