Question: Create code in PYTHON that follows all criteria below please! 1. Create Code to Compute and Display Mandelbrot Fractals with Python. Problem Requirements (See Lecture

Create code in PYTHON that follows all criteria below please!

1. Create Code to Compute and Display Mandelbrot Fractals with Python.

Problem Requirements (See Lecture Notes for more details):

a) Create class for Complex Numbers that has the following Magic Methods -- __add__, __sub__, __abs__, __mul__, __truediv__, __str__. See Lecture Notes.

b) Create a function that will determine if within a given number of iterations (maxiter) if a given complex number is in or out of the Mandelbrot Set. It will be in the set if the distance of the function to the origin <= 4 at maxiter: It will out of the set if the distance exceeds 4 at less than maxiter iterations. The function should be structured as follows:

def mandelbrot(c,maxiter=80):

""" Takes Seed and Applies Mandlebrot Recursion until either Maximum Iterations are encountered or until We Exit Mandelbrot Set with diestance >=4. Here c is the test Complex Number"""

return c.count

c) Create a function that will tessellate the complex domain between [-2,2] (real) and [-2,2] imaginary. The function should return a list of tuples of real and imaginary coordinates. Try to use a generator.

d) Create a function that will test whether the complex numbers in the list of tuples are in or are out of the Mandelbrot set.

e) Test your code in parts (a-d) and identify complex numbers within defined by the tessellation that are in the Mandelbrot set. Let the Maximum number of iterations be 80 and let there be 100 points in the x (real) and y (imaginary) directions.

f) Plot out the Mandelbrot set generated in part (E). Only plot out those coordinates that are in the set.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!