Thursday, July 16

Random Walks example Using Numpy module

An illustrative application of utilizing array operation is in the simulation of random walks. Let's first consider a simple random walks starting at 0 with steps of 1 and -1 occurring with equal probability.   
                    The walk is simply the cumulative sum of the random steps and could be evaluated as an array expression. Thus, I use the np.random module to draw 1000 coin flips at once ,set these to 1 to -1, and compute the cumulative sum :
 

No comments:

Post a Comment

thank Q

Are you looking for ......