@frederik
the solution of Fredrik is indeed megabit faster...
In the meantime (yesterday) I found another fix by using the python pillow environment. It works even faster than the solution of Frederic. Anyway it is strange that Drawbot does not offer a simple plot(x,y) statement
xscreen = 640
yscreen = 480
picname ="Feigenbaum.png"
newPage(xscreen,yscreen)
# Definitions for the pillow environment
import math
from PIL import Image, ImageDraw
colour = (255, 255, 255) #white
im = Image.new("RGB", (xscreen, yscreen), colour)
draw = ImageDraw.Draw(im)
# --------------------------------------
def f(p, k) :
fwert = p + k * p * (1 - p)
return fwert
def input():
global left, right, bottom, top
global invisible, visible
left = 1.8
right = 3.0
bottom = 0.0
top = 1.5
invisible = 200
visible = 200
def setup():
input()
feigenbaumIteration()
# Show picture and save picture pillow environment
im.show()
im.save(picname)
def setglobalpoint(xw, yw):
size = randint(1,1)
middle = randint(-1,1)
x = (xw - left) * xscreen / (right - left)
y = (yw - bottom) * yscreen / (top - bottom)
# point statement of pillow environment
draw.point([(x, yscreen - y)], fill="black")
def feigenbaumIteration():
deltaxPerPixel = (right - left) / xscreen
for section in range(0, xscreen+1, 1):
coupling = left + section * deltaxPerPixel
population = 0.3
for i in range(0, invisible+1, 1):
population = f(population, coupling)
for i in range(0, visible+1, 1):
setglobalpoint(coupling, population)
population = f(population, coupling)
setup()