From dea0fa5b0a5da26bddf5a9f0c7dadeed6f2338f6 Mon Sep 17 00:00:00 2001 From: Sven Riwoldt Date: Sat, 3 Jan 2026 11:28:35 +0100 Subject: [PATCH] Beginn / Init --- Mandelbrot.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Mandelbrot.py diff --git a/Mandelbrot.py b/Mandelbrot.py new file mode 100644 index 0000000..3fd3f1e --- /dev/null +++ b/Mandelbrot.py @@ -0,0 +1,25 @@ +from PIL import Image + +def mandelbrot (c, max_iter): + z = 0 + for n in range(max_iter): + if abs(z) > 2: + return n # Wie schnell ist der Punkt entflohen? + z = z*z + c + return max_iter + +width = 800 +height = 600 +img = Image.new('RGB', (width, height)) + +# die komplexe Ebene definieren +x_min, x_max = -2 , 1 +y_min, y_max = -1.5, 1.5 + +for x in range(width): + for y in range(height): + real = x_min + (x / width) * (x_max - x_min) + imag = y_min + (y / height) * (y_max - y_min) + c = complex(real, imag) + print ("x-> ", x, " y-> ", y, " -> ",c) +