Created
January 3, 2015 19:43
-
-
Save tedunderwood/3f0f5c94a9e5818cb6c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # aggregate 100 random walks, with | |
| # different start points: | |
| # in each case take a walk of ten steps | |
| # and add a 100-dimensional vector | |
| # to an aggregator (allwalks) | |
| # that has ten different entries, | |
| # for the ten possible steps of each | |
| # walk | |
| import numpy as np | |
| allwalks = list() | |
| for i in range(10): | |
| allwalks.append(np.zeros(100)) | |
| for j in range(100): | |
| last=np.random.normal(0, .1, 100) | |
| for i in range(10): | |
| new=last+np.random.normal(0, .1, 100) | |
| last=new | |
| allwalks[i] += new | |
| for i in range(10): | |
| print(','.join([str(x) for x in allwalks[i]])) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is in Python 3.