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
n = 50 # number of iterations
r = 2.5 # escape radius (must be greater than 2)▼
x = np.linspace(-2.5, 1.5, 4*
y = np.linspace(-1.5, 1.5, 3*
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)
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)
|