Mandelbrot set: Difference between revisions

m
→‎{{header|Python}}: A small simplification.
m (→‎{{header|Python}}: unnecessary comments removed again)
m (→‎{{header|Python}}: A small simplification.)
Line 6,394:
import matplotlib.pyplot as plt
 
pd = 100 # pointspixel per unitdensity
n = 50 # number of iterations
r = 2.5 # escape radius (must be greater than 2)
 
x = np.linspace(-2.5, 1.5, 4*pd+1)
y = np.linspace(-1.5, 1.5, 3*pd+1)
 
A, B = np.meshgrid(x, y)
Line 6,405 ⟶ 6,406:
Z = np.zeros_like(C)
T = np.zeros(C.shape)
 
r = 2.5 # escape radius (must be greater than 2)
M = abs(Z) < r
 
for k in range(n):
Z[M] = Z[M]**2 + C[M]
M = abs(Z) < r
T[M] = k + 1
Z[M] = Z[M]**2 + C[M]
 
plt.figure(dpi=200)
305

edits