File:Mandelbrot numpy set 3.png

Summary

Description
Deutsch: Die Mandelbrot-Menge wird mit NumPy unter Verwendung komplexer Matrizen berechnet. Es wird eine von David Madore und Anders Sandberg vorgestellte logarithmische Projektion verwendet. Die so erstellten Bilder werden auch Exponential Maps oder Mercator-Mandelbrot Maps genannt. Durch diese Projektion lässt sich die Berechnung von Zoom-Animationen sehr vereinfachen.
English: The Mandelbrot set is calculated with NumPy using complex matrices. A logarithmic projection presented by David Madore and Anders Sandberg is used. The images created in this way are also called Exponential Maps or Mercator-Mandelbrot Maps. This projection makes the calculation of zoom animations much easier
Date
Source Own work
Author Majow
Other versions
PNG development
InfoField
Source code
InfoField

Python code

import numpy as np
import matplotlib.pyplot as plt

d, h = 200, 1000  # pixel density (= image width) and image height
n, r = 800, 5000  # number of iterations and escape radius (r > 2)

a = -1.748764520194788535  # coordinates by Claude Heiland-Allen
b = 3e-13  # https://mathr.co.uk/web/m-location-analysis.html

x = np.linspace(0, 2, num=d+1)
y = np.linspace(0, 2 * h / d, num=h+1)

A, B = np.meshgrid(x * np.pi, y * np.pi)
C = 4.0 * np.exp((A + B * 1j) * 1j) + (a + b * 1j)

def iteration(C):
    Z, dZ = np.zeros_like(C), np.zeros_like(C)

    def iterate5(C, Z, dZ):
        Z, dZ = Z * Z + C, 2 * Z * dZ + 1
        Z, dZ = Z * Z + C, 2 * Z * dZ + 1
        Z, dZ = Z * Z + C, 2 * Z * dZ + 1
        Z, dZ = Z * Z + C, 2 * Z * dZ + 1
        Z, dZ = Z * Z + C, 2 * Z * dZ + 1
        return Z, dZ

    for i in range(0, n, 5):
        M = abs(Z) < r
        Z[M], dZ[M] = iterate5(C[M], Z[M], dZ[M])

    return Z, dZ

Z, dZ = iteration(C)
D = np.zeros(C.shape)

fig = plt.figure(figsize=(12.8, 9.6))
fig.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.95)

N = abs(Z) > 2  # exterior distance estimation
D[N] = np.log(abs(Z[N])) * abs(Z[N]) / abs(dZ[N])

ax1 = fig.add_subplot(3, 1, 1)
ax1.imshow(D.T ** 0.05, cmap=plt.cm.nipy_spectral, origin="lower")

M = 50 * (2 / d) * np.pi * np.exp(- B)  # adjust marker size 50 as needed
k, l = min(d, h) + 1, max(0, h - d) // 8  # adjust zoom level 8 as needed

for i in range(8):
    X, Y = C[i*l:i*l+k, 0:d].real, C[i*l:i*l+k, 0:d].imag
    S, T = M[0:k, 0:d] ** 2, D[i*l:i*l+k, 0:d] ** 0.5
    ax = fig.add_subplot(3, 4, 5 + i)
    ax.scatter(X, Y, s=S, c=T, cmap=plt.cm.nipy_spectral)
    ax.set_xticks([])
    ax.set_yticks([])
    ax.axis('equal')

fig.savefig("Mandelbrot_numpy_set_3.png", dpi=200)

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#Mandelbrot%20numpy%20set%203.pngCategory:Self-published work
Category:Mandelbrot sets - Mercator projection Category:NumPy Category:German text Category:Images with Python source code
Category:CC-Zero Category:German text Category:Images with Python source code Category:Mandelbrot sets - Mercator projection Category:NumPy Category:PNG created with Matplotlib code Category:Self-published work