Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
By Frank Purcell
About this worksheet:
This worksheet using PTC Mathcad shows you how to simulate a random walk and visualize it through the use of graphs and charts. To begin, you are shown how to use the 'runif' to generate an array of +1 or -1. You can plot this to see how the number of "steps" affects the distance away from the starting point. You can repeat this process over a couple hundred times using walks and then plot a histogram to see the distribution of the endpoints.
You can also repeat in 2D and plot the walk on the Cartesian coordinate. The distribution of endpoints can be modeled with a normal distribution with a standard deviation related to the number of steps. As the number of steps approaches infinity, the arcsine law can be used to express the probability that the fraction of the walk spent on the positive side is less than some variable 't'.
All data, charts, graphs, solutions, and notation is included to help you in creating and viewing your own random simulations.
Download and explore this worksheet yourself! You can download a free lifetime copy of PTC Mathcad Express and get 30 days of full functionality.