<jupyter_start><jupyter_text>Mandelbrot set___The *Mandelbrot set* $M$ is the set of  $c\in \mathbb{C}$  which satisfy $f^n_c(0)$ $(n \ge 1)$is bounded:$$M = \bigl\{ c\in \mathbb{C}\bigm|\{f^n_c(0)\}_{n\ge 1} : bounded\bigr\},$$where $\ \ f^1_c(z) =  f_c(z) = z^2 + c $, $\ \ f^n_c = f^{n-1}_c \circ f_c$.  For more details, see [Wikipedia--Mandelbrot set](https://en.wikipedia.org/wiki/Mandelbrot_set).___<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline


def mandel(x_min, x_max, y_min, y_max, N, x_pix, y_pix, R):
    x = np.linspace(x_min, x_max, x_pix).astype(np.float32) 
    y = np.linspace(y_max, y_min, y_pix).reshape(y_pix, 1).astype(np.float32) * 1j
                     # below of y-axis is smaller
    c = x + y   #broadcasting by numpy 
    counter = np.zeros_like(c, dtype=np.uint32)
    z = np.zeros_like(c)        
    boolean = np.zeros_like(c, dtype=bool)
    for i in range(N):
        z[boolean] = z[boolean]**2 + c[boolean]
        boolean = np.less(abs(z), R)
        if not boolean.any():
            break
        counter[boolean] += 1
    return counter


def draw_md(x_min, x_max, y_min, y_max, N, 
            x_pix=1000, y_pix=1000, R=3, colormap='viridis'):
    counter = mandel(x_min, x_max, y_min, y_max, N, x_pix, y_pix, R)
    fig = plt.figure(figsize = (6, 6))
    ax = fig.add_subplot(1,1,1)
    ax.set_xticks(np.linspace(x_min, x_max, 5))
    ax.set_yticks(np.linspace(y_min, y_max, 5))
    ax.set_title("Mandelbrot Set")
    plt.imshow(counter, extent=[x_min, x_max, y_min, y_max], cmap=colormap)
x_min = -2.25
x_max =  0.75
y_min = -1.25
y_max =  1.25
N = 200
x_pix = 1200
y_pix = 1000

draw_md(x_min, x_max, y_min, y_max, N, x_pix, y_pix)
#plt.savefig("./pictures/mandelbrot.png", dpi=72)
x_min = -1.40
x_max = -1
y_min = -0.2
y_max =  0.2
N = 200
x_pix = 1000
y_pix = 1000

draw_md(x_min, x_max, y_min, y_max, N, x_pix, y_pix)
#plt.savefig("./pictures/mandelbrot2.png", dpi=72)
x_min = -1.25
x_max = -1.23
y_min =  0.1
y_max =  0.12
N = 200
x_pix = 1000
y_pix = 1000

draw_md(x_min, x_max, y_min, y_max, N, x_pix, y_pix)
#plt.savefig("./pictures/mandelbrot3.png", dpi=72)
x_min = -1.245
x_max = -1.243
y_min =  0.115
y_max =  0.117
N = 200
x_pix = 1000
y_pix = 1000

draw_md(x_min, x_max, y_min, y_max, N, x_pix, y_pix)
#plt.savefig("./pictures/mandelbrot4.png", dpi=72)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16582491582491582, 'fraction_numerical': 0.056818181818181816, 'mean_word_length': 3.2906137184115525, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '257762', 'license': 'MIT', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1116, 'n_words': 233, 'path': 'mandelbrot.ipynb', 'repo_name': 'mo-mo-666/dynamics', 'size': '2376'}