
The system seems to give interesting results only when b is close to one. It behaves less chaotically when b > 1 is fixed, so you can actually animate it - click the thumbnail to see.
import Control.Arrow ((***)) | |
import Graphics.UI.SDL as SDL | |
(xres, yres) = (200, 200) | |
main = withInit [InitVideo] $ do | |
w <- setVideoMode xres yres 32 [NoFrame] | |
enableEvent SDLMouseMotion False | |
setCaption "Gumowski-Mira" "Gumowski-Mira" | |
loop w p pss | |
where | |
p = (xres `div` 2, yres `div` 2) | |
pss = map points [0.31, 0.3101.. 0.316] | |
loop w p pss = do | |
render w p $ map (round *** round) $ head pss | |
e <- pollEvent | |
case e of | |
KeyUp (Keysym SDLK_ESCAPE _ _) -> return () | |
_ -> loop w p $ tail pss | |
render w (x,y) ps = do | |
s <- createRGBSurface [SWSurface] 2 2 32 0 0 0 0 | |
fillRect w (Just $ Rect 0 0 xres yres) (Pixel 0) | |
mapM_ (draw s 0xFFFFFF . rect . center) ps | |
SDL.flip w | |
where | |
center = ((xres - x) +) *** (+ (yres - y)) | |
rect (x,y) = Just $ Rect x y 1 1 | |
draw s c p = do fillRect s Nothing $ Pixel c | |
blitSurface s Nothing w p | |
points a = take 650000 . map (h *** h) $ iterate f (12, 0) | |
where | |
f (x,y) = let x' = b*y + g x in (x', -x + g x') | |
g x = a*x + (2 * (1 - a) * x^2) / (1 + x^2) | |
(b,h) = (1.005, (* 4)) |