Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- #Create an array of points to be checked
- points = np.arange(-100, 101)
- #The function that checks for convergence
- #If after 100 iterations abs(var) < 2 -- return True
- #Return False otherwise
- def conv(x, y):
- c = complex(x,y)
- var = c
- for i in range(100):
- if abs(var) > 2:
- return False
- var = var**2 + c
- return True
- #Plots the set
- for i in range(201):
- for j in range(201):
- if conv(points[i]/50, points[j]/50):
- plt.scatter(points[i]/50, points[j]/50, c = 'b', s = 1, marker = '.')
- plt.xlim(-2,2)
- plt.ylim(-2,2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement