"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.\n",
"We could take a coin, toss it and move right if it shows \"head\", or left if it shows \"tail\".\n",
"\n",
"Similarly, in a two-dimensional random walk, we need to decide if we move up, down, left, or right.\n",
"\n",
"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.\n",
"\n",
"### Exercise:\n",
"\n",
"* Write a program that contains a function to create data from a 2D random walk where we take 100 steps. \n",
" * Let each random walk start at (0,0), i.e., the first pair of values is $x=0, y=0$. \n",
" * Make the step size an optional parameter, the step size is fixed for a complete random walk.\n",
" * Hint: Think about what the function should return.\n",
"* Plot multiple random walks on top of each other. \\\n",
"* Calculate the distance of between the start and the end of each random walk. \\\n",
"* For 200 random walks, create a histogram of the distribution of the distance.\n",
"\n",
"\n",
"*Hint*: \\\n",
"Think about which modules can help you so that your code is efficient and fast.\n",
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.
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 100 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. \
* 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.