Jump to content

Mandelbrot set: Difference between revisions

→‎{{header|Python}}: Changed names of some variables (arrays and lists have a capital letter)
m (→‎{{header|Python}}: Explanation added)
(→‎{{header|Python}}: Changed names of some variables (arrays and lists have a capital letter))
Line 7,053:
r = 2.5 # escape radius (must be greater than 2)
 
xX = linspace(-2.5, 1.5, 4 * d + 1)
yY = linspace(-1.5, 1.5, 3 * d + 1)
 
T = zeros(len(yY), len(xX))
 
for i, b in enumerate(yY):
for j, a in enumerate(xX):
ux, vy = 0.0, 0.0
for k in range(n):
if ux ** 2 + vy ** 2 < r ** 2:
ux, vy = ux ** 2 - vy ** 2 + a, 2 * ux * vy + b
T[i][j] = k + 1
 
Line 7,075:
r = 2.5 # escape radius (must be greater than 2)
 
xX = np.linspace(-2.5, 1.5, 4 * d + 1)
yY = np.linspace(-1.5, 1.5, 3 * d + 1)
 
A, B = np.meshgrid(xX, yY)
C = A + B * 1j
 
305

edits

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