MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / mandelbrot_set

Function mandelbrot_set

galleries/examples/showcase/mandelbrot.py:16–27  ·  view source on GitHub ↗
(xmin, xmax, ymin, ymax, xn, yn, maxiter, horizon=2.0)

Source from the content-addressed store, hash-verified

14
15
16def mandelbrot_set(xmin, xmax, ymin, ymax, xn, yn, maxiter, horizon=2.0):
17 X = np.linspace(xmin, xmax, xn).astype(np.float32)
18 Y = np.linspace(ymin, ymax, yn).astype(np.float32)
19 C = X + Y[:, None] * 1j
20 N = np.zeros_like(C, dtype=int)
21 Z = np.zeros_like(C)
22 for n in range(maxiter):
23 I = abs(Z) < horizon
24 N[I] = n
25 Z[I] = Z[I]**2 + C[I]
26 N[N == maxiter-1] = 0
27 return Z, N
28
29
30if __name__ == '__main__':

Callers 1

mandelbrot.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…