Two-dimensional random walk simulations



Think of a drunk man that continuously tumbles left and right, back and forth, with no final destination. That can be thought of as a random walk on the plane... Now imagine that the drunk man has a shorter leg and tumbles more to one of the sides: that is a biased random walk. Now imagine the drunk man can teleport to a nearby location. That is (kind of) a Lèvy flight! All those are quite interesting to observe in motion and I implemented them in Python. (the code can be found here). From those, only the tilted walks and the one with the trail are such that the particle's movement wraps around the borders (leaving the green area makes the particle appear in the opposite side, just like the snake from the game Snake).

The image above is a screenshot of the execution of the random walk that leaves a coloured trail.

I also implemented an animation where the screen gets progressively filled with circles of different colours, as if being splattered with paint. Not sure why... But it looks interesting:

The implementation is in the same directory as the walks.

For all these, I got windows executables. Here you can find all the executables for the random walks and here for the paint splatter.

[Pt] Passeios aleatórios são engraçados e fáceis de imaginar: basta pensar num bêbado que cambaleia sem destino. Se pensarmos que uma das pernas é mais curta que a outra e que ele tende a cambalear mais para um dos lados, então o passeio aleatório já é diferente. Se, ainda para mais, pensarmos que de vez em quando o bêbado se pode teletransportar para uma outra posição perto, temos (algo parecido com) aquilo a que se chama um "Lèvy flight".

Todos estes passeios aleatórios foram implementados por mim em Python, e as implementações podem ser encontradas aqui. A imagem de cima é um screenshot da execução do trailWalk que é um passeio aleatório que vai deixando um rasto colorido. Na altura em que fiz isto, fiz também uma animação (segunda imagem) que vai "salpicando" o ecrã com bolas de várias cores e tamanhos. O código está no mesmo sítio que o dos passeios aleatórios. Para tudo isto, há executáveis windows aqui e aqui, respetivamente para os passeios e para a animação da tinta.

Let me know what you think!

-RGS
Two-dimensional random walk simulations Two-dimensional random walk simulations Reviewed by Unknown on October 25, 2017 Rating: 5

No comments:

Powered by Blogger.