Mandelbrot set: Difference between revisions

m (→‎Mercator zooms of the Mandelbrot set using NumPy: The same center point was used for both examples)
Line 7,151:
import matplotlib.pyplot as plt
 
d, h = 2080, 60 # pixel density and image height
n, r = 50, 2.5 # number of iterations and escape radius (r > 2)
 
x = np.linspace(0.0, 4.02, 4 * d, endpoint=False)
y = np.linspace(0.0, 3.0, 32 * h / d, h, endpoint=False)
 
U, V = np.meshgrid(x - 2.01, -y -+ 1.5h / d)
W = U + V * 1j
 
C = -0.41031 + 0.61021 * 1j + 01.50 * W
A, B = C.real, C.imag
 
Line 7,175:
plt.savefig("Mandelbrot_image.png", dpi=100)
 
D = 12 / d * np.ones(C.shape)
S = (100150 * D) ** 2 # factor depends on the size of the figure
 
fig, ax = plt.subplots(figsize=(8, 6))
Line 7,188:
n, r = 100, 2.5 # number of iterations and escape radius (r > 2)
 
x = np.linspace(0.0, 2 * np.pi, d, endpoint=False)
y = np.linspace(0.0, 2 * np.pi * h / d * h, h, endpoint=False)
 
U, V = np.meshgrid(x, -y)
Line 7,210:
 
D = 2 * np.pi / d * abs(W)
S = (100150 * D) ** 2 # factor depends on the size of the figure
 
fig, ax = plt.subplots(3, 2, figsize=(12, 18))
305

edits