Newton Fractals
Total Page:16
File Type:pdf, Size:1020Kb
Newton Fractals Complex Roots of Polynomials 1 Introduction Newton Fractals are a beautiful consequence of studying roots of polynomials, namely complex roots, and applying numerical methods like the Newton method to nd them. Introducing Newton Fractals to learners can be a great way to motivate the study of polynomials, complex numbers and numerical methods like the Newton method. 2 Complex Polynomials A polynomial of degree n is a function of the form n n−1 p(x) = anx + an−1x + ··· + a1x + a0 2 where an 6= 0. Quadratics, for example 2x + 3x − 2, are polynomials of degree 2. We can extend this idea to polynomials with complex coecients and a complex variable p z = x + iy. (Recall i = −1.) Denition 2.1. A polynomial with complex coecients is a function of the form n n−1 p(z) = anz + an−1z + ··· + a1z + a0 where , , and is a complex variable. If , then is the aj 2 C j = 0; 1; : : : ; n z an 6= 0 n degree of p(z). (The degree is essentially the highest power n of the polynomial.) 1 Example Below are some examples of polynomials with complex coecients of a complex variable z: (a) z2 + (8 + i)z + 4, (b) z16 − 64, (c) 147, p (d) (7 − 8i)z3 − (4 + 4i)z2 − 17, (e) z − 1. What is the degree of each of these polynomials? Solution. (a) The degree of this polynomial is 2, this is a quadratic polynomial. (b) The degree of this polynomial is 16. (c) The degree of this polynomial is 0, this is a constant polynomial. (d) The degree of this polynomial is 3, this is a cubic polynomial. (e) The degree of this polynomial is 1, this is a quadratic polynomial. 2.1 Roots of Complex Polynomials Let's introduce the following denition. n n−1 Denition 2.2. Let p(z) = anz + an−1z + ··· + a1z + a0 be a polynomial of degree n ≥ 1. A complex number r 2 C is called a root of p(z), if p(r) = 0. Finding roots of polynomials is a long-standing problem in mathematics and this is tes- tament to the fact that algebra meant essentially theory of polynomial equations up until the 19th century. Finding the root of a linear polynomial (degree 1) is rather trivial, b p(z) = az + b = 0 ) z = − a You are probably also familiar with nding roots of quadratic polynomials, either by factorisation or the quadratic formula, p −b ± b2 − 4ac p(z) = az2 + bz + c = 0 ) z = 2a An important (fundamental) result in algebra is known as the Fundamental Theorem of Algebra. We shall state here without proof. 2 Theorem 2.1 (Fundamental Theorem of Algebra). Let p(z) be a polynomial of degree n ≥ 1. Then p(z) always has a root r 2 C. This theorem states that a root always exists for a polynomial of degree greater or equal to one. The theorem however does not give us a method or algorithm to nd a root. Applying the Fundamental Theorem of Algebra repeatedly we can obtain the following result. Corollary 2.1. Let p(z) be a polynomial of degree n ≥ 1. Then there exists complex numbers , such that z1; z2; : : : ; zn 2 C p(z) = an(z − z1)(z − z2) ··· (z − zn): This corollary tells us that for any polynomial of degree n there are n roots. These root are in general complex and therefore may not be real. For example z1; z2; : : : ; zn 2 C z3 − 1 only has one real root z = 1, but Corollary 2.1 guarantees the existence of three roots in C. Let's investigate this with the following example. Example Find the three roots of z3 − 1. Solution. We know one root is z1 = 1 therefore, by Corollary 2.1 we can write the polynomial in the form, (z − 1)(az2 + bz + c) = az3 + (b − a)z2 + (c − b)z − c = z3 − 1 equating coecients, a = 1; b − a = 0; c − b = 0; c = 1; hence a = 1, b = 1, c = 1, and z3 − 1 = (z − 1)(z2 + z + 1) using the quadratic formula to obtain the roots of z2 + z + 1, p p −1 ± −3 −1 ± i 3 p z = = ; where i = −1: 2 2 Therefore, the three complex roots of z3 − 1 are, p p 1 3 1 3 z = 1; z = − + i ; z = − − i 1 2 2 2 3 2 2 We can plot the three roots of z3 − 1 are an Argand Diagram which is a representation of the complex numbers on a two-dimensional plane where the x-axis refers to the real part and the y-axis refers to the imaginary part of the complex number z = x+iy denoted Refzg = x and Imfzg = y. Below is an illustration of the Complex Plane (Argand Diagram) where we have identied the locations of the roots of z3 − 1. 3 Imfzg 1:5i p 1 3 1i z = − + i 2 2 2 0:5i −1:5 −1 −0:5 0:5 1 1:5 Refzg z1 = 1 −0:5i p 1 3 z = − − i 3 2 2 −1i −1:5i 2.2 Newton's Root Finding Method For polynomials of degree 3 and 4 solutions to the root nding problem can be found in general but this is too complicated for our purposes (but still worthy of investigation). For polynomials of degree 5 or higher there is in general no method to acquire the roots exactly. So, except for low degrees, root nding of polynomials consists of nding approximations of the roots using numerical methods. What we mean by numerical method is the an algorithm that given an initial guess at the root say z0 the method would then give us a new and improved approximation to the root say z1, we can then use z1 and the method will produce a further improvement to our approximation say z2. One numerical method which has this feature is called Newton's method and is described by the following recurrence relation, f(zn) zn+1 = zn − 0 f (zn) Newton's method uses the function in question f(z) and also it's derivative f 0(z) to improve an approximation to the root of f(z). This method is useful in practice because of it's extremely fast convergence. The distance from the root to each approximation is roughly squared at each iteration; assuming the distance between the root and the approximation is less than 1. So, if you start with a reasonably good approximation to 4 the root the Newton method can very quickly provide an excellent approximation to the root. Let's try the Newton method out with our test polynomial we studied earlier z3 −1. Example Use Newton's Method to nd an approximation to a root of the polynomial z3 − 1. (Experiment with dierent starting values z0.) Solution. In this case our function f(z) = z3 − 1 and we require the derivative f 0(z) = 3z2, Newton's method can be written, 3 zn − 1 zn+1 = zn − 2 : 3zn Since we studied this polynomial earlier we know the roots already, so let's start with an initial guess of z0 = 2 and see which root the iterative method above converges to, 3 3 z0 − 1 2 − 1 z1 = z0 − 2 = 2 − 2 = 1:416667; 3z0 3(2 ) 3 z1 − 1 z2 = z1 − 2 = 1:110534; 3z1 3 z2 − 1 z3 = z2 − 2 = 1:010637; 3z2 3 z3 − 1 z4 = z3 − 2 = 1:000112; 3z3 3 z4 − 1 z5 = z4 − 2 = 1:000000; 3z4 Working in 6 decimal places, after only 5 iterations we have acquired at least 6 −6 decimal places of accuracy in approximating the root r = 1, i.e., jz5 − rj < 10 . We can nd the other roots using Newton's method by just starting near to the corresponding root. For example if we let after iterations we obtain z0 = −1 + i 5 p −6 z5 = −0:5 + 0:866025 which an accuracy of 10 to the root r = −1=2 + i 3=2. What starting value could we try which would make the Newton method converge z0 p to the root r = −1=2 − i 3=2? 5 2.3 Python Programming Newton's Method All ready it is becoming a bit of a drag having to do these repeated computations by hand so how about we start using a bit of Python programming. On Canvas you can nd the complete program newton_method.py, here I will just show you the important parts of the code, highlighting where we have included the Newton method. 16 while error > Tol and count < nIteration: 17 count = count + 1 18 znew = z - (z**3-1)/(3*z**2)#newton method 19 error = abs(z - znew)#compute the error at this step 20 z = znew 21 print('{0:^6d}{1:^20.6f}'.format(count,z)) As you can see in the code above the Newton method is applied at line ##, where the variable z is the initial value and the variable znew is the new approximation after applying the Newton method. On line ## we store the new approximation znew into z and thus replace z with the new approximation value. We then print the iteration number count and this new approximation of the root, which has been stored in z, to the python console. This loop will continue to run until the error variable is no longer greater than the Tol variable which we set in the beginning of the code. (Don't worry to much about the print statement at this stage as it just looks a little complicated so that the output is well presented.) Now we have a better understanding of how the program newton_method.py works we can start experimenting with dierent starting values in the complex plane and see which root the Newton method will converge to.