Created
September 26, 2021 15:04
-
-
Save adiamaan92/326ae6c50f9b526283275053b7f7eb74 to your computer and use it in GitHub Desktop.
Iterate - Diverge logic for Mandelbrot set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
x_dim, y_dim = 500, 500 | |
x = np.linspace(-2, 1, x_dim) | |
y = np.linspace(-1.5, 1.5, y_dim) | |
max_iterations = 100 | |
array = np.zeroes((x_dim, y_dim)) | |
for i in range(x): | |
for j in range(y): | |
n, z = 0, 0 | |
c = np.complex(x[i], y[j]) | |
n = 0 | |
while np.abs(z) < 2 and n <= max_iterations: | |
z = brot_equation(z, c) | |
n += 1 | |
array[j, i] = n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment