File:Mandelbrot numpy set 2.png
Tools
Actions
General
Print/export
In other projects
Appearance
From Wikimedia Commons, the free media repository
Size of this preview: 960 × 360 pixels. Other resolutions: 330 × 124 pixels | 960 × 360 pixels | 1,280 × 480 pixels | 3,840 × 1,440 pixels.
Original file (2,560 × 960 pixels, file size: 927 KB, MIME type: image/png)
File information
Structured data
Captions
Captions
Computing the Mandelbrot set with NumPy and complex matrices (Part 2)
Berechnung der Mandelbrot-Menge mit NumPy und komplexen Matrizen (Teil 2)
Summary
[edit]| DescriptionMandelbrot numpy set 2.png |
Deutsch: Die Mandelbrot-Menge wird mit NumPy unter Verwendung komplexer Matrizen berechnet. Die verwendeten Färbungen werden von Arnaud Chéritat und Jussi Härkönen beschrieben: Normal Map Effect und Stripe Average Coloring. English: The Mandelbrot set is calculated with NumPy using complex matrices. The colorings used are described by Arnaud Chéritat and Jussi Härkönen: Normal Map Effect and Stripe Average Coloring. |
| Date | |
| Source | Own work |
| Author | Majow |
| Other versions |
|
| PNG development InfoField | |
| Source code InfoField | Python codeimport numpy as np
import matplotlib.pyplot as plt
d, h = 800, 600 # pixel density (= image width) and image height
n, r = 200, 500 # number of iterations and escape radius (r > 2)
direction, height = 45.0, 1.5 # direction and height of the light
density, intensity = 4.0, 0.5 # density and intensity of the stripes
x = np.linspace(0, 2, num=d+1)
y = np.linspace(0, 2 * h / d, num=h+1)
A, B = np.meshgrid(x - 1, y - h / d)
C = (1.5 + 1.0j) * (A + B * 1j) - 0.5
def iteration(C):
S, T = np.zeros(C.shape), np.zeros(C.shape)
Z, dZ, ddZ = np.zeros_like(C), np.zeros_like(C), np.zeros_like(C)
def iterate1(C, S, T, Z, dZ, ddZ):
S, T = S + np.sin(density * np.angle(Z)), T + 1
Z, dZ, ddZ = Z * Z + C, 2 * Z * dZ + 1, 2 * (dZ * dZ + Z * ddZ)
return S, T, Z, dZ, ddZ
for i in range(0, n, 1):
M = abs(Z) < r
S[M], T[M], Z[M], dZ[M], ddZ[M] = iterate1(C[M], S[M], T[M], Z[M], dZ[M], ddZ[M])
return S, T, Z, dZ, ddZ
S, T, Z, dZ, ddZ = iteration(C)
D = np.zeros(C.shape)
fig = plt.figure(figsize=(12.8, 4.8))
fig.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.95)
N = abs(Z) >= r # basic normal map effect and stripe average coloring (potential function)
P, Q = S[N] / T[N], (S[N] + np.sin(density * np.angle(Z[N]))) / (T[N] + 1)
U, V = Z[N] / dZ[N], 1 + (np.log2(np.log(abs(Z[N])) / np.log(r)) * (P - Q) + Q) * intensity
U, v = U / abs(U), np.exp(direction / 180 * np.pi * 1j) # unit normal vectors and light vector
D[N] = np.maximum((U.real * v.real + U.imag * v.imag + V * height) / (1 + height), 0)
ax1 = fig.add_subplot(1, 2, 1)
ax1.imshow(D ** 1.0, cmap=plt.cm.bone, origin="lower")
N = abs(Z) > 2 # advanced normal map effect using higher derivatives (distance estimation)
H, K, L = abs(Z[N] / dZ[N]), abs(dZ[N] / ddZ[N]), np.log(abs(Z[N]))
U = Z[N] / dZ[N] - (H / K) ** 2 * L / (1 + L) * dZ[N] / ddZ[N]
U, v = U / abs(U), np.exp(direction / 180 * np.pi * 1j) # unit normal vectors and light vector
D[N] = np.maximum((U.real * v.real + U.imag * v.imag + height) / (1 + height), 0)
ax2 = fig.add_subplot(1, 2, 2)
ax2.imshow(D ** 1.0, cmap=plt.cm.afmhot, origin="lower")
fig.savefig("Mandelbrot_numpy_set_2.png", dpi=200)
|
Licensing
[edit]I, the copyright holder of this work, hereby publish it under the following license:
| 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.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse |
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Thumbnail | Dimensions | User | Comment | |
|---|---|---|---|---|---|
| current | 22:35, 24 September 2023 | 2,560 × 960 (927 KB) | Majow (talk | contribs) | Uploaded own work with UploadWizard |
You cannot overwrite this file.
File usage on Commons
The following 8 pages use this file:
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
| Software used |
|
|---|---|
| Horizontal resolution | 78.74 dpc |
| Vertical resolution | 78.74 dpc |