Питон Ньютон Рафсон

from PIL import Image

imagesize = 1024
image = Image.new("RGB", (imagesize, imagesize))

maxIt = 60

for y in range(imagesize):
  zy = y * (2.0 - 2.0) / (imagesize - 1) + 2.0
  for x in range(imagesize):
    zx = x * (2.0 - 2.0) / (imagesize - 1) + 2.0

    z = complex(zx, zy)

    for i in range(maxIt):

      z0 = z - (z**3 - 1.0) / (3 * z**2) 
      if abs(z0 - z) < 1e-3: 
        break
        z = z0

        image.putpixel((x, y), (i % 4 * 64, i % 8 * 32, i % 16 * 16))
        
image.save(f"./newton.png", "PNG")
Uninterested Unicorn