Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use python to code the following: The Mandelbrot set is an example of a fractal: an object that contains a structure within a structure, iteratively

Use python to code the following:

image text in transcribed

The Mandelbrot set is an example of a fractal: an object that contains a structure within a structure, iteratively as far as we care to look. Consider the following iterative equation all variables represent complex numbers) The Mandelbrot set considers a complex number c and sets z 0. The above equation is applied iteratively until 12 is above 2 or until z has been updated many times (to zoo , say). If is not found to ever exceed 2, then the point c is in the Mandelbrot set; if it does exceed 2, it is not in the Mandelbrot set. 1. Consider a complex number in the formc-x+iy. Consider a100x100grid of points on the complex plane constrained by -23xs2 and-2sys2 For each value ofc on this grid, determine the number of iterations required for to exceed 2. If z does not exceed 2, record the maximum number of iterations considered instead. Record these values on a100x100 NumPy array. 2. 3. Save the array formed in step 2 to file. Then comment out the analysis code and instead load your results from file. (This speeds things up as you play around in the following step!) Plot the array constructed in step 2 using: plt.imshow(, cmap-). Try different color maps until you find one that you like. The default colormaps available in matplotlib are listed here: 4. matplotlib.o les/color/colormaps reference.ht (example: plt.imshow (a, cmap-'spectral')). Once you have successfully implemented the above, increase the resolution of your grids from 100x100to 1000x1000 Tip: In Spyder, you can make your images open in a large window instead of being embedded in your console. Among other things, this allows you to zoom in on your images (which is fun when generating fractals!). To enable this feature, go to Tools/Preferences/IPython Console/Graphics/Backend and change from "Inline" to "Automatic." Click on "Apply" at the bottom of the dialogue box. You may need to restart Spyder for the changes to take effect. If you're feeling adventurous, increase your resolution further and see how sharp your image becomes when zooming in. The Mandelbrot set is an example of a fractal: an object that contains a structure within a structure, iteratively as far as we care to look. Consider the following iterative equation all variables represent complex numbers) The Mandelbrot set considers a complex number c and sets z 0. The above equation is applied iteratively until 12 is above 2 or until z has been updated many times (to zoo , say). If is not found to ever exceed 2, then the point c is in the Mandelbrot set; if it does exceed 2, it is not in the Mandelbrot set. 1. Consider a complex number in the formc-x+iy. Consider a100x100grid of points on the complex plane constrained by -23xs2 and-2sys2 For each value ofc on this grid, determine the number of iterations required for to exceed 2. If z does not exceed 2, record the maximum number of iterations considered instead. Record these values on a100x100 NumPy array. 2. 3. Save the array formed in step 2 to file. Then comment out the analysis code and instead load your results from file. (This speeds things up as you play around in the following step!) Plot the array constructed in step 2 using: plt.imshow(, cmap-). Try different color maps until you find one that you like. The default colormaps available in matplotlib are listed here: 4. matplotlib.o les/color/colormaps reference.ht (example: plt.imshow (a, cmap-'spectral')). Once you have successfully implemented the above, increase the resolution of your grids from 100x100to 1000x1000 Tip: In Spyder, you can make your images open in a large window instead of being embedded in your console. Among other things, this allows you to zoom in on your images (which is fun when generating fractals!). To enable this feature, go to Tools/Preferences/IPython Console/Graphics/Backend and change from "Inline" to "Automatic." Click on "Apply" at the bottom of the dialogue box. You may need to restart Spyder for the changes to take effect. If you're feeling adventurous, increase your resolution further and see how sharp your image becomes when zooming in

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Identify Ending Evaluation Criteria

Answered: 1 week ago