Skip to content
Snippets Groups Projects
Commit e4cc0a6a authored by Tom Reclik's avatar Tom Reclik
Browse files

Corrected typos

parent 76ed8510
No related branches found
No related tags found
1 merge request!1Corrections - Tom
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
%% Cell type:markdown id: tags:
# Random walk in two dimensions
A random walk is a sequence where decide randomly in which direction we can move. For example, in a one-dimensional random walk, we decide randomly if we move left or right.
A random walk is a sequence where we decide randomly in which direction we can move. For example, in a one-dimensional random walk, we decide randomly if we move left or right.
We could take a coin, toss it and move right if it shows "head", or left if it shows "tail".
Similarly, in a two-dimensional random walk, we need to decide if we move up, down, left, or right.
In the simplest case, we aways take steps of the same length, but we could also vary our step size and take short, medium, or long steps.
### Exercise:
* Write a program that contains a function to create data from a 2D random walk where we take 5000 steps.
* Let each random walk start at (0,0), i.e., the first pair of values is $x=0, y=0$.
* Make the step size an optional parameter, the step size is fixed for a complete random walk.
* Hint: Think about what the function should return.
* Plot multiple random walks on top of each other. \
* Calculate the distance of between the start and the end of each random walk. \
* Plot multiple random walks on top of each other.
* Calculate the distance between the start and the end of each random walk.
* For 200 random walks, create a histogram of the distribution of the distance.
*Hint*:
* Think about which modules can help you so that your code is efficient and fast.
* Numpy provides various random number generators in the sub-module ```np.random```
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment