Last active
March 15, 2020 08:57
-
-
Save abecus/32203f7613ae9d5af04cf5ec0653303b to your computer and use it in GitHub Desktop.
use to find the divergence of complex number for mandelbrot set
This file contains hidden or 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 matplotlib.pyplot as plt | |
import numpy as np | |
def get_iter(c:complex, thresh:int =4, max_steps:int =25) -> int: | |
# Z_(n) = (Z_(n-1))^2 + c | |
# Z_(0) = c | |
z=c | |
i=1 | |
while i<max_steps and (z*z.conjugate()).real<thresh: | |
z=z*z +c | |
i+=1 | |
return i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment