@@ -33,11 +33,11 @@ def mandelbrot_set(xmin, xmax, ymin, ymax, xn, yn, maxiter, horizon=2.0):
33
33
from matplotlib import colors
34
34
import matplotlib .pyplot as plt
35
35
36
- xmin , xmax , xn = - 2.25 , + 0.75 , 3000 / 2
37
- ymin , ymax , yn = - 1.25 , + 1.25 , 2500 / 2
36
+ xmin , xmax , xn = - 2.25 , + 0.75 , 3000 // 2
37
+ ymin , ymax , yn = - 1.25 , + 1.25 , 2500 // 2
38
38
maxiter = 200
39
39
horizon = 2.0 ** 40
40
- log_horizon = np .log (np .log (horizon )) / np . log ( 2 )
40
+ log_horizon = np .log2 (np .log (horizon ))
41
41
Z , N = mandelbrot_set (xmin , xmax , ymin , ymax , xn , yn , maxiter , horizon )
42
42
43
43
# Normalized recount as explained in:
@@ -47,15 +47,13 @@ def mandelbrot_set(xmin, xmax, ymin, ymax, xn, yn, maxiter, horizon=2.0):
47
47
# This line will generate warnings for null values but it is faster to
48
48
# process them afterwards using the nan_to_num
49
49
with np .errstate (invalid = 'ignore' ):
50
- M = np .nan_to_num (N + 1 -
51
- np .log (np .log (abs (Z )))/ np .log (2 ) +
52
- log_horizon )
50
+ M = np .nan_to_num (N + 1 - np .log2 (np .log (abs (Z ))) + log_horizon )
53
51
54
52
dpi = 72
55
53
width = 10
56
54
height = 10 * yn / xn
57
55
fig = plt .figure (figsize = (width , height ), dpi = dpi )
58
- ax = fig .add_axes ([0.0 , 0.0 , 1.0 , 1.0 ], frameon = False , aspect = 1 )
56
+ ax = fig .add_axes ([0 , 0 , 1 , 1 ], frameon = False , aspect = 1 )
59
57
60
58
# Shaded rendering
61
59
light = colors .LightSource (azdeg = 315 , altdeg = 10 )
0 commit comments