Files
Mandelbrot/Mandelbrot.py
2026-01-03 11:28:35 +01:00

26 lines
604 B
Python

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)