cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Random Walks in PTC Mathcad

TudorMarin
1-Newbie

Random Walks in PTC Mathcad

By Frank Purcell

random_walks.png

About this worksheet:

  • Simulates a random walk and visualizes it 
  • Academic in nature but random walks are also applicable in other fields 
  • Performs using "runif" function, graphing, histograms, cumulative distribution plots, standard deviation, etc

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.

0 REPLIES 0
Top Tags