diff --git a/Mandelbrot.py b/Mandelbrot.py index fcfd306..093b871 100644 --- a/Mandelbrot.py +++ b/Mandelbrot.py @@ -40,6 +40,7 @@ for x in range(width): img.putpixel((x, y), color) img.save("mandelbrot.png") -print("Bild wurde als mandelbrot.png gespeichert!") +img.show() +#print("Bild wurde als mandelbrot.png gespeichert!") diff --git a/julia.py b/julia.py index c93c05b..b3fff26 100644 --- a/julia.py +++ b/julia.py @@ -1,4 +1,5 @@ from PIL import Image +import math # Bildeinstellungen width, height = 800, 800 @@ -9,7 +10,12 @@ x_min, x_max = -1.5, 1.5 y_min, y_max = -1.5, 1.5 # Die Konstante c (hier kannst du experimentieren!) -c = complex(-0.7, 0.27015) +#c = complex(-0.7, 0.27015) +#c = complex(-0.4, -0.6) +#c= complex(-0.123, 0.745) +#c = complex (0.75) +#c = complex (0,1) +c = complex(-0.391, -0.587) # Neues Bild erstellen (RGB-Modus) img = Image.new('RGB', (width, height), (0, 0, 0)) @@ -29,11 +35,22 @@ for py in range(height): # Einfärben if n < max_iter: - # Ein einfacher Farbverlauf basierend auf n - r = (n * 10) % 256 - g = (n * 5) % 256 - b = (n * 20) % 256 + # Die magische Formel für die Glättung + # v = n + 1 - log2(log2(|z|)) + log_zn = math.log(z.real ** 2 + z.imag ** 2) / 2 + nu = math.log(log_zn / math.log(2)) / math.log(2) + iteration = n + 1 - nu + + # Farbe berechnen (Sinus-Wellen erzeugen sanfte Übergänge) + r = int(128 + 127 * math.sin(0.3 * iteration + 0.0)) + g = int(128 + 127 * math.sin(0.3 * iteration + 2.0)) + b = int(128 + 127 * math.sin(0.3 * iteration + 4.0)) pixels[px, py] = (r, g, b) + # Ein einfacher Farbverlauf basierend auf n + # r = (n * 10) % 256 + # g = (n * 5) % 256 + # b = (n * 20) % 256 + # pixels[px, py] = (r, g, b) else: # Inneres der Menge bleibt schwarz pixels[px, py] = (0, 0, 0) diff --git a/julia_set.png b/julia_set.png new file mode 100644 index 0000000..ea3a818 Binary files /dev/null and b/julia_set.png differ