Question: def is_in_set(z): return abs(z) > 2.0 width = int(input(Please enter a width: )) height = int(input(Please enter a height: )) max_iterations = 50 x_min =


def is_in_set(z): return abs(z) > 2.0
width = int(input("Please enter a width: ")) height = int(input("Please enter a height: ")) max_iterations = 50 x_min = -100 x_max = 100 y_min = -1.5 y_max = 1.5
for row in range(height): y = 1 - 2.0 * row / (height - 1) for col in range(width): x = -1 + 2.0 * col / (width - 1) c = complex(x,y) z = 0 for i in range(max_iterations): z = (z*z) + c if is_in_set(z): print("-", end="") else: print("*", end="")
THis is the code I have so far, I am getting na output of some * outputs and some - outputs, but the image is not to scale as the output example shows. I think there is a logical error in how I am calculating x and y for my complex number c. Any help will be appreciated
Problem: Using python, write a program that will take two integer dimensions (width and height) from the user and then perform the necessary calculations to generate a Mandelbrot set of that dimension. Requirements: 1. Accept input from the user on the width and height of the image to be displayed. Optional) Accept as input the four(4) float values that determine the placement of the display window. Write a function to perform the iterations for a single point in the complex plane with a specified upper limit on the iterations (1000-10000 your choice). This function should returm an Boolean indication of whether the given point is in or out of the Mandelbrot set. 2. 3. Write a function to iterate over the given width and height, determining the corresponding 4 Output an "in" or "out" symbol for each point calculated in order to create an "image". Expected Output: value of the point in the complex plane and call the iteration function for each point. Problem: Using python, write a program that will take two integer dimensions (width and height) from the user and then perform the necessary calculations to generate a Mandelbrot set of that dimension. Requirements: 1. Accept input from the user on the width and height of the image to be displayed. Optional) Accept as input the four(4) float values that determine the placement of the display window. Write a function to perform the iterations for a single point in the complex plane with a specified upper limit on the iterations (1000-10000 your choice). This function should returm an Boolean indication of whether the given point is in or out of the Mandelbrot set. 2. 3. Write a function to iterate over the given width and height, determining the corresponding 4 Output an "in" or "out" symbol for each point calculated in order to create an "image". Expected Output: value of the point in the complex plane and call the iteration function for each point
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
