[Haskell-cafe] Re: (Chaos) [An interesting toy]

jerzy.karczmarczuk at info.unicaen.fr jerzy.karczmarczuk at info.unicaen.fr
Sat May 5 17:55:12 EDT 2007

Andrew Coppin shares with us his Chaos program. 

I confirm that on my HP laptop it was faster than 15 minutes, but
I won't speculate how to optimize it. I appreciated the elegance of
overloading, the usage of Num classes, etc, which makes it more readable,
although somewhat slower. Actually it took slightly less than 10 minutes
for 300x300. I wonder whether making some constants global (such as dt)
would change anything.
For those who don't have patience to execute the program, I converted the
ppms to a XVID coded AVI file. Thanks, Andrew

What I didn't appreciate was the use of simple extrapolating Euler's
method which for oscillating systems is known to be unstable, so the results
of the simulation may be far from the reality. Well, one chaos is worth
another one, and the sin is not as mortal as in the case of truly periodic
systems, but it may be the cause that it is difficult to see the classical
fractal structure of the attraction domains on the generated images. Try
to use leapfrog Verlet...  It will require to keep not only p and v for
each frame, but also the acceleration, but the corrections are minor. Of
course it will be slower, but then, why not increase dt? 

Jerzy Karczmarczuk 

More information about the Haskell-Cafe mailing list