0
I am studying a specific code of the set of Mandelbrot (equation with complex numbers) with a focus on object-oriented programming. However, there is a specific part I did not understand of the code, as below:
columns = 2000
rows = 2000
result = numpy.zeros([rows, columns])
for row_index, Re in enumerate(numpy.linspace(-2, 1, num=rows)):
for column_index, Im in enumerate (numpy.linspace(-1, 1, num=columns)):
result[row_index, column_index] = mset(Re, Im, 200)
Below, follow the full code:
import numpy
from numba import autojit
import matplotlib.pyplot as plt
@autojit
def mset (Re, Im, max_inter):
c = complex (Re, Im)
z = 0
for i in range (max_inter):
z = z*z + c
if (z.real*z.real + z.imag*z.imag) >= 4:
return i
return max_inter
columns = 2000
rows = 2000
result = numpy.zeros([rows, columns])
for row_index, Re in enumerate(numpy.linspace(-2, 1, num=rows)):
for column_index, Im in enumerate (numpy.linspace(-1, 1, num=columns)):
result[row_index, column_index] = mset(Re, Im, 200)
plt.figure(dpi=100)
plt.imshow(result.T, cmap='hot', interpolation='bilinear', extent=[-2, 1, -1, 1])
plt.xlabel('Real')
plt.ylabel('imagin')
plt.show()
Greetings, Vanderson; we’re on [en.so], so could you translate your question?
– Woss