## Thursday, 1 September 2016

### Simulation with Excel Series: Final Lab Funtime!

Title: Simulate the path (Random Walk) of a drunkard.

Basic Theory:
In this lab, we try to simulate the motion of a drunkard in two dimensions, which depicts Random Walk. A drunkard can move in any direction without proper thought and we try to simulate this process using a random function which determines the next step of the drunkard. It is an example of Markov Chain because the prior motion of the drunkard does not influence its current motion.

Procedure:
For simulation of drunkard’s random walk, we first specify an initial position with randomly distributed values of motion in X and Y directions (dx and dy). These will characterize that the drunkard moves randomly in a two-dimensional space. This can be described using a random function in Excel as,

dx =1-2*RAND()
dx =1-2*RAND()

The next values of X and Y are calculated as
Xi = Xi-1 + dxi
Yi = Yi-1 + dyi

This formula shows that the points will be plotted with respect to their last values, and the values prior to that do not make direct contributions. Hence, we can observe the Markov property in Brownian motion.

After that, we generate a Scatter plot of the X and Y values and see the drunkard’s motion. We can experiment with values of dx and dy to see the changes in the behavior of particle motion.

Thus, we were able to visualize a drunkard’s random walk using random distribution and assuming Markov property.

Sample Data:
Table1: Sample Data for drunkard’s motion is
 dx dy X Y 0.838546 -0.32853 0 0 0.673706 -0.94962 0.673706 -0.94962 -0.59668 0.811554 0.077027 -0.13807 -0.59386 0.346488 -0.51683 0.208419 0.78065 0.295288 0.26382 0.503707 -0.16151 0.428357 0.102307 0.932064 -0.11278 0.908384 -0.01047 1.840448 -0.17453 0.235414 -0.18501 2.075862 -0.76316 -0.10395 -0.94817 1.971913 -0.44464 -0.53974 -1.3928 1.432171

Output:

Below are the graph plots for drunkard’s motion up to 300 steps:

Conclusion:
Hence, we could see that the Drunkard’s motion was consistent with the random values of dx and dy. The more the values of dx and dy deviate in each new step of the drunkard, the obtained curve gets more zig-zag.