File:Mandelbrot numpy set 3.png

Original file(2,560 × 1,920 pixels, file size: 3.03 MB, MIME type: image/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
 
This plot was created with Matplotlib.
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, b = -1.748764520194788535, 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)

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

for k in range(n):
    M = Z.real ** 2 + Z.imag ** 2 < r ** 2
    Z[M], dZ[M] = Z[M] ** 2 + C[M], 2 * Z[M] * dZ[M] + 1

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")

X, Y = C.real, C.imag  # zoom images (adjust circle size 50 and zoom level 8 as needed)
R, c, z = 50 * (2 / d) * np.pi * np.exp(- B), min(d, h) + 1, max(0, h - d) // 8

for i in range(8):
    axs = fig.add_subplot(3, 4, 5 + i)
    axs.scatter(X[i*z:i*z+c,0:d], Y[i*z:i*z+c,0:d], s=R[0:c,0:d]**2, c=D[i*z:i*z+c,0:d]**.5, cmap=plt.cm.nipy_spectral)
    axs.set_xticks([])
    axs.set_yticks([])
    axs.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.

Captions

Computing the Mandelbrot set with NumPy and complex matrices (Part 3)

Items portrayed in this file

depicts

24 September 2023

image/png

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current22:35, 24 September 2023Thumbnail for version as of 22:35, 24 September 20232,560 × 1,920 (3.03 MB)MajowUploaded own work with UploadWizard

The following page uses this file:

Global file usage

The following other wikis use this file:

Metadata