Mandelbrot set: Difference between revisions
→{{header|Python}}: a more mathematical spelling, as the students are used to it.
m (→{{header|Python}}: Minor change (save picture)) |
(→{{header|Python}}: a more mathematical spelling, as the students are used to it.) |
||
Line 6,394:
import matplotlib.pyplot as plt
n = 50 # number of iterations
x = np.linspace(-2.
y = np.linspace(-1.
A, B = np.meshgrid(x, y)
C = A + B * 1j▼
▲C = A + B * 1j
Z = np.zeros_like(C)
M = abs(Z) < r
▲escape_radius = 2.1 # must be greater than 2
▲escape_table = np.zeros(Z.shape)
T[M] = k + 1
▲for i in range(iterations):
▲ Z[not_escaped] = Z[not_escaped] ** 2 + C[not_escaped]
plt.imshow(
plt.savefig(
=={{header|R}}==
|