Jump to content

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
dots = 100
escape_radiusr = 2.15 # escape radius (must be greater than 2)
iterations = 50
 
x = np.linspace(-2.05, 1.05, 3 * dots + 1401)
y = np.linspace(-1.05, 1.05, 2 * dots + 1301)
 
A, B = np.meshgrid(x, y)
C = A + B * 1j
 
C = A + B * 1j
Z = np.zeros_like(C)
escape_tableT = np.zeros(ZC.shape)
 
M = abs(Z) < r
escape_radius = 2.1 # must be greater than 2
for ik in range(iterationsn):
escape_table = np.zeros(Z.shape)
Z[not_escapedM] = Z[not_escapedM] ** 2 + C[not_escapedM]
 
not_escaped M = abs(Z) < escape_radiusr
T[M] = k + 1
 
for i in range(iterations):
Z[not_escaped] = Z[not_escaped] ** 2 + C[not_escaped]
not_escaped = abs(Z) < escape_radius
escape_table[not_escaped] = i + 1
 
plt.imshow(escape_tableT, cmap=plt.cm.twilight_shifted)
plt.savefig("'image.png"', dpi=150200)</lang>
 
=={{header|R}}==
305

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.