stdmap.py

Created by gianfranco-oddenino

Created on March 17, 2024

293 Bytes

The script draws 10^6 points of the standard map, an area-preserving chaotic map from a square with side 2π onto itself. It is constructed by a Poincaré’s surface of section of the kicked rotator, and is defined by:
p[n+1]=p[n]+k*sin(θ[n])
θ[n+1]=θ[n]+p[n+1]


from math import *
from kandinsky import *

def draw(k=1.5):  
  p2=2*pi
  x=0.01; y=0.01
  for i in range(1000000):
    xi,yi=round(x*160/pi),round(y*111/pi)
    c=get_pixel(xi,yi)[0]-8
    if c<0:
      c=0
    set_pixel(xi,yi,color(c,c,c))
    y=(y+k*sin(x))%p2
    x=(x+y)%p2