Beginn / Init
This commit is contained in:
25
Mandelbrot.py
Normal file
25
Mandelbrot.py
Normal file
@@ -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)
|
||||||
|
|
||||||
Reference in New Issue
Block a user