
Shepherding Random Numbers - andra_nl
http://inconvergent.net/shepherding-random-numbers/
======
JadeNB
As a mathematician but not a statistician or probabilist (so very much not an
expert here), this:

> When we look at this it can sometimes seem as if there is a pattern emerging
> from the behaviour. However, if you feel like you can see such a pattern it
> is entirely coincidental, since the nodes are completely unaware of each
> other.

bothered me. It seems to me that the fact that patterns can emerge from non-
coördinated behaviour is one of the interesting facts about mathematics. See,
for a dodgy example—because there is _some_ coördination—firefly flash-
locking; and, for a genuine example that I literally just happened to be
reading about this morning, the fascinating Nobel-Prize work discussed at
[https://johncarlosbaez.wordpress.com/2016/10/07/kosterlitz-t...](https://johncarlosbaez.wordpress.com/2016/10/07/kosterlitz-
thouless-transition) . (I encourage you to go read the latter if you haven't
already; as you will expect if you have read Baez's work, it's exposition at a
level just about anyone, including non-mathematicians, can probably understand
of scientific Nobel-Prize work, and those don't come along very often.) I
guess, though, that to make any rigorous statement that this can occur, and
isn't just an illusion, one has to make a rigorous definition of 'pattern',
and the implicit definition of something like "externally imposed structure"
has just as much claim to being 'correct' as anything I could cook up.

~~~
open_nsfw
I'm pretty sure each point was rendered independently - i.e. the nodes have no
interactions. So unlike flocking, they are are entirely coincidental.

------
rawnlq
There are a lot of very cool math properties hidden in each of these examples
so I want to start a discussion on modeling some of them:

For the "memory" example, each particle is moving Uniform(-k, k) at each
timestep (where k is some just some fixed distance). So the the distribution
of the position of a particle at timestep t is the sum of t identically
independent distributions, which will converge to a normal distribution,
specifically with Uniform(a, b) having variance (b - a)^2 / 12, you converge
to:

N(0, t * k^2 / 3)

So it turns out these particles end up behaving kind of like brownian motion!
(Note I didn't take into account hitting walls. I am not sure how to model
that?)

For the "velocity" example, empirically you can see that if you just let it
run forever the points will just end up bunching at the walls. This makes
sense since if there's a positive velocity in either direction it's hard to
flip your velocity back into the other direction to get off the wall. By
symmetry you expect half to be bunched on one wall and half on the other.

A fun question to ask then is if the velocities will accumulate so much in one
direction such that it will always stay stuck on one wall after you run it a
long enough time. I believe the answer is no! It will always switch directions
again due to the fact that the probability that a random walk on a line
returning to the origin has probability 1 as you run it forever (google
recurrent random walk in 1 or 2 dimensions). This means the velocity (which is
doing the random walk) will have to cross 0 and flip signs at some point. So
although you will mostly find these particles hugging the walls, they will
keep switching sides forever!

I think there are a lot of other really cool properties in these fancy
visualizations waiting to be discovered.

------
bajsejohannes
Recommend following the link at the bottom:
[http://inconvergent.net/generative/](http://inconvergent.net/generative/)

Very nice work. My favorite is this:
[http://inconvergent.net/generative/trees/](http://inconvergent.net/generative/trees/)

------
visarga
<offtopic>It's interesting how random numbers are essential in AI. Dropout and
adding random Gaussian noise are standard practices. Random numbers are also
essential in exploration strategies in Reinforcement Learning (epsilon
greedy).

In the human brain, signals are stochastic, so they embed a large portion of
randomness with each bit of information. Amazingly, adding noise to signals
helps learning. Intelligence is at the edge of order and chaos - the lesson
being that chaos is an essential part of it.

------
DanBC
These are beautiful.

If you're interested in these you might also be interested in the book
"Computers, Pattern, Chaos, and Beauty":

[http://www.worldcat.org/title/computers-pattern-chaos-and-
be...](http://www.worldcat.org/title/computers-pattern-chaos-and-
beauty/oclc/899158113)

~~~
noelwelsh
Looks very interesting!

Another suggestion: I'm currently working through "Creating Symmetry"
([http://press.princeton.edu/titles/10435.html](http://press.princeton.edu/titles/10435.html))
which is a very readable maths text and one that involves some gorgeous
images.

The author calls is a postmodern maths book, and says "Postmodern books are
situated in time and place, taking into account the identities of both reader
and author. Here I am, writing to reach you; please join me." The world needs
more postmodern maths books.

~~~
zimpenfish
Ah, that book very much aligns with my current interests. Thank you kindly!

------
dorianm
That's amazing!

He also has a very interesting Twitter account where he posts his experiments:
[https://twitter.com/inconvergent](https://twitter.com/inconvergent)

------
joshu
I love his stuff. I've ported some of his code on GitHub to emit gcode and run
it on my various drawing machines. Fun stuff.

------
mturmon
Given how close to random walks (e.g., with absorption/reflection) some of
these concoctions are, the probabilist in me wants a higher-level explanation,
in a few cases, to be part of the post. Either way, it's fun to look at.

------
marmaduke
Yay stochastic differential equations..

~~~
rawnlq
I think he has to sample his position deltas from a gaussian with mean 0 and
variance equal to the time since last update for it to be a valid brownian
motion.

See
[https://en.wikipedia.org/wiki/Brownian_motion#Mathematics](https://en.wikipedia.org/wiki/Brownian_motion#Mathematics)

------
jijojv
very nice animations

