Top
What Random Walks in Multiple Dimensions Teach You About Life – ANITH
134470

# What Random Walks in Multiple Dimensions Teach You About Life

## What Random Walks in Multiple Dimensions Teach You About Life

The last time I looked at random walks, I used them to calculate the value of Pi for Pi Day. But what is a random walk, really? A mathematician will tell you that it’s a stochastic process—a path defined by a series of random steps. It’s a pretty abstract concept, but I want to show you how it can reveal something fundamental about life itself—the proteins that make up you and me and everything around us.

### One Dimensional Random Walk

Suppose I have an object. This object can either move one space to the left or one space to the right. Suppose I let it make 100 steps. Here’s what that might look like. (click the “play” to run it)

That’s at least marginally interesting, right? But the cool part is that if you run it a bunch of times, it will (on average) end up farther away from the starting point depending on the number of steps. Oh sure—it’s possible that it could take 1,000 steps and end up where it started, but that probably won’t happen.

But wait. There is another kind of random walk—there is the Self Avoiding Walk (SAW). This is just like a random walk except that the object can’t cross over its own path. In one dimension this would just be an object that continues to move to the left or continues to move to the right. After it makes its first move, there is only one way it can go. This is a boring simulation, so I won’t show it—but you can change line 37 in the code above so that it reads saw=True (case matters) and then it will be a self avoiding walk.

Now for a plot. Suppose I run the random walk (the normal one, not the self avoiding one) such that it goes 10 steps. If I repeat these 10 steps 500 times, I will get an average final distance. Then I can repeat this for 20 steps, then 30 steps and so on. After that (which takes a while to run), I get the following plot of average distance vs. number of steps. If you want to see the code to produce this plot, here it is (no warranty included).