File:Mandelbrot numpy set 6.png
Summary
| Description |
Deutsch: Die Mandelbrot-Menge wird mit NumPy unter Verwendung komplexer Matrizen berechnet. Die Einfärbung geschieht durch sogenannte Orbit Traps. English: The Mandelbrot set is calculated with NumPy using complex matrices. The coloring is done using so-called orbit traps. |
| Date | |
| Source | Own work |
| Author | Majow |
| Other versions |
|
| PNG development | |
| Source code | 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)
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 = (2.0 + 1.0j) * (A + B * 1j) - 0.5
def iteration(C):
S, Z = np.abs(C), np.copy(C)
def iterate(C, S, Z):
S = np.minimum(abs(Z), S)
S = np.minimum(abs((Z * (1.0 + 0.5j)).real - 4.0), S)
S = np.minimum(abs((Z * (1.0 - 0.5j)).real - 4.0), S)
Z = Z * Z + C
return S, Z
for i in range(n):
M = abs(Z) < r
S[M], Z[M] = iterate(C[M], S[M], Z[M])
return S, Z
S, Z = iteration(C)
fig = plt.figure(figsize=(12.8, 4.8))
fig.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.95)
ax1 = fig.add_subplot(1, 2, 1)
ax1.imshow(S ** 0.5, cmap=plt.cm.hot, origin="lower")
ax2 = fig.add_subplot(1, 2, 2)
ax2.imshow(S ** 0.5, cmap=plt.cm.hot_r, origin="lower")
fig.savefig("Mandelbrot_numpy_set_6.png", dpi=200)
|
Licensing
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.
|