

Lorenz Attractor in 101 bytes of JS - dbaupp
https://gist.github.com/1320178

======
jashkenas
Very neat. Attractors + <canvas> are a lot of fun...

My favorite is the Peter de Jong attractor, described here:
<http://paulbourke.net/fractals/peterdejong/>

Here's a <canvas> version. Click and drag and release to re-seed the starting
coordinates: <http://jashkenas.s3.amazonaws.com/misc/deJong/deJong.html>

Here's the annotated source code:
[http://jashkenas.s3.amazonaws.com/misc/deJong/docs/deJong.ht...](http://jashkenas.s3.amazonaws.com/misc/deJong/docs/deJong.html)

 _Edit_ : I've added a permalink button, so that you can link directly to
interesting coordinates that you discover:
[http://jashkenas.s3.amazonaws.com/misc/deJong/deJong.html#59...](http://jashkenas.s3.amazonaws.com/misc/deJong/deJong.html#599,182)

~~~
dbaupp
In the comments on the gist there is a canvas version too:
<http://fiddle.jshell.net/aemkei/d99PL/show/>

------
julian37
This looks just like the C code on Paul Burke's page [1], except that the
translation to JS isn't quite correct because x gets updated before yz are
calculated (and y before z) due to sequential parameter evaluation. And the
101 bytes conveniently doesn't count any of the rendering and other code.

The result is still pretty, but that's a bit too much handwaving for my taste.

[1] <http://paulbourke.net/fractals/lorenz/>

------
jahewson
Great. It's just a shame about the boneheaded "DO WHAT THE FUCK YOU WANT TO
PUBLIC LICENSE". It makes you look like a complete idiot.

~~~
sp332
It's really not worth licensing hassle for this amount of code.

~~~
ctdonath
It's really not worth dragging otherwise nifty code into the gutter with
unnecessary obscenity.

"Public domain" would suffice. Yes, a significant percentage of the population
_does_ have a problem with needless obscenity.

~~~
EvanAnderson
In some jurisdictions it isn't possible for creators to disclaim all their
rights. In those cases something like WTFPL (or, in a more tasteful manner,
CC0) is necessary.

------
gbadman
Link to play with it: <http://plnkr.co/edit/UFLKBx>

_Hint: Hit the eye icon on the right for live preview._

------
0x0
Claiming 101 bytes feels a bit like cheating, since you need a bunch of setup
and painting code to drive the algorithm, don't you think? :)

------
karpathy
I ported this to the newly announced Khan Academy CS sandbox :)

<http://www.khanacademy.org/cs/lorenz-attractor/966338554>

------
bdon
Not quite 101 bytes, but here's an interactive version in WebGL:

<http://bdon.github.com/strange_attractor/>

(Only works in Chrome)

------
jianshen
Nostalgic! Fractals are what got me interested in programming when I was a
student because I always wanted to know how to "draw infinitely".

------
blorenz
Good use of 101 bytes! I'm attracted to it.

------
ehosca
ITT Schaub- ?

