I need to write this in python. Thanks a lot for your help.
R3 GRAPHICS AND VISUALIZATION 3.7 The Mandelbrot set: The Mandelbrot set, named after its discoverer, the mathematician Benoit Mandelbrot, is a fractal, an infinitely ramified ject that contains structure within structure within structure, as deep as we The definition of the Mandelbrot set is in terms of complex numbers as follows mathematical ob- to look Consider the equationn where z is a complex number and c is a complex constant. For any given value c this equation turns an input number z into an output number. The def the Mandelbrot set involves the repeated iteration of this equation: we take an in starting value of z and feed it into the equation to get a new value z. Then we ta value and feed it in again to get another value, and so forth. The Mandelbrot set is set of points in the complex plane that satisfies the following definition: initial For a given complex value of c, start with z 0 and iterate repeatedly. If the magnitude |z) of the resulting value is ever greater than 2, then the point in the complex plane at position c is not in the Mandelbrot set, otherwise it is in the set. In order to use this definition one would, in principle, have to iterate infinitely many set only if the iteration never passes z = 2 ever. In practice, however, one usually just performs some large number of iterations, say 100, and if lz) hasn't exceeded 2 by that point then we call that good enough. Write a program to make an image of the Mandelbrot set by performing the iteration for all values of c = x + iy on an N x N grid spanning the region where-s 2 and -2 sy s 2. Make a density plot in which grid points inside the Mandelbrot set are colored black and those outside are colored white. The Mandelbrot set has a distinctive shape that looks something like a beetle with a long snout-you'll know it when you see it. very Hint: You will probably find it useful to start off with quite a coarse grid, ie, with a small value of N-perhaps N 100-so that your program runs quickly while you are testing it. Once you are sure it is working correctly, increase the value of N to produce a final high-quality image of the shape of the set. If you are feeling enthusiastic, here is another variant of the same exercise that can produce amazing looking pictures. Instead of coloring points just black or white,color points according to the number of iterations of the equation before l becomes greater than 2 (or the maximum number of iterations if |z never becomes greater than 2). If you use one of the more colorful color schemes Python provides for density plots, such as the "hot" or "jet" schemes, you can make some spectacular images this way. A interesting variant is to color according to the logarithm of the number of i which helps reveal some of the finer structure outside the set. nother R3 GRAPHICS AND VISUALIZATION 3.7 The Mandelbrot set: The Mandelbrot set, named after its discoverer, the mathematician Benoit Mandelbrot, is a fractal, an infinitely ramified ject that contains structure within structure within structure, as deep as we The definition of the Mandelbrot set is in terms of complex numbers as follows mathematical ob- to look Consider the equationn where z is a complex number and c is a complex constant. For any given value c this equation turns an input number z into an output number. The def the Mandelbrot set involves the repeated iteration of this equation: we take an in starting value of z and feed it into the equation to get a new value z. Then we ta value and feed it in again to get another value, and so forth. The Mandelbrot set is set of points in the complex plane that satisfies the following definition: initial For a given complex value of c, start with z 0 and iterate repeatedly. If the magnitude |z) of the resulting value is ever greater than 2, then the point in the complex plane at position c is not in the Mandelbrot set, otherwise it is in the set. In order to use this definition one would, in principle, have to iterate infinitely many set only if the iteration never passes z = 2 ever. In practice, however, one usually just performs some large number of iterations, say 100, and if lz) hasn't exceeded 2 by that point then we call that good enough. Write a program to make an image of the Mandelbrot set by performing the iteration for all values of c = x + iy on an N x N grid spanning the region where-s 2 and -2 sy s 2. Make a density plot in which grid points inside the Mandelbrot set are colored black and those outside are colored white. The Mandelbrot set has a distinctive shape that looks something like a beetle with a long snout-you'll know it when you see it. very Hint: You will probably find it useful to start off with quite a coarse grid, ie, with a small value of N-perhaps N 100-so that your program runs quickly while you are testing it. Once you are sure it is working correctly, increase the value of N to produce a final high-quality image of the shape of the set. If you are feeling enthusiastic, here is another variant of the same exercise that can produce amazing looking pictures. Instead of coloring points just black or white,color points according to the number of iterations of the equation before l becomes greater than 2 (or the maximum number of iterations if |z never becomes greater than 2). If you use one of the more colorful color schemes Python provides for density plots, such as the "hot" or "jet" schemes, you can make some spectacular images this way. A interesting variant is to color according to the logarithm of the number of i which helps reveal some of the finer structure outside the set. nother