Question: python help! You should start with this math formula. This is my initial start but im kind of confused. import matplotlib.pyplot as plt def fn(x):

python help!

python help! You should start with this math formula. This is my

initial start but im kind of confused. import matplotlib.pyplot as plt def

You should start with this math formula. This is my initial start but im kind of confused.

import matplotlib.pyplot as plt

def fn(x): return 4*x*(1-x)

data1 = [] data2 = [] x = 0 for iteration in range(100): x = fn(x) print(iteration, x) data1.append(x)

""" x = 0.749 for iteration in range(100): x = fn(x) print(iteration, x) data2.append(x) """

plt.plot(data1, 'r-')#, data2, 'b-') plt.ylabel('Value') plt.xlabel('Iteration') plt.show()

"""# Complext iterations z0 = complex(0.35,0.35) z = 0 magnitudes = [] for iteration in range(1000): z = z*z + z0 temp = abs(z) magnitudes.append(temp) if temp > 2: break

plt.plot(magnitudes, 'k-') plt.ylabel('Magnitude') plt.show() """

Objective: Write a program that makes use of functions, conditional execution, and looping to d calculation and display the results. Problem: Using python, write a program that will take two integer dimensions from the user and then perform the necessary calculations to generate a Mandelbrot set of that dimension Deadline: Thursday, April 5, 2018, 11:59 PM Requirements: Submit to Blackboard a single python file named "homework2py". Include in the header your name, PSID, and the homework number. Use meaningful variable and function names in order to: Accept input from the user on the width and height of the image to be displayed. Write a function to perform the iterations for a single point in the complex plane with a specified upper limit on the iterations. This function should return an indication of whether the given point is in or out of the Mandelbrot set. Write a function to iterate over the given width and height; determining the corresponding value of the point in the complex plane and calling the iteration function for each point. Output an "in" or "out" symbol for each point calculated in order to create an "image". 1. 2. 3. 4. xpected Output: Objective: Write a program that makes use of functions, conditional execution, and looping to d calculation and display the results. Problem: Using python, write a program that will take two integer dimensions from the user and then perform the necessary calculations to generate a Mandelbrot set of that dimension Deadline: Thursday, April 5, 2018, 11:59 PM Requirements: Submit to Blackboard a single python file named "homework2py". Include in the header your name, PSID, and the homework number. Use meaningful variable and function names in order to: Accept input from the user on the width and height of the image to be displayed. Write a function to perform the iterations for a single point in the complex plane with a specified upper limit on the iterations. This function should return an indication of whether the given point is in or out of the Mandelbrot set. Write a function to iterate over the given width and height; determining the corresponding value of the point in the complex plane and calling the iteration function for each point. Output an "in" or "out" symbol for each point calculated in order to create an "image". 1. 2. 3. 4. xpected Output

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!