23.5 Exercises

Exercise 23.1 In class we found that the diffusion coefficient is equal to \(\displaystyle D = \frac{ (\Delta x)^{2}}{2\Delta t}\).

  1. Solve the expression for \(D\) in terms of \(\Delta t\).
  2. The diffusion coefficient for oxygen in water is approximately \(10^{-5}\) cm\(^{2}\) sec\(^{-1}\). Use that value to complete the following table:
Distance (\(\Delta x\)) \(\mu\)m = 10\(^{-6}\) m 10 \(\mu\)m 1 mm 1 cm 1 m
Diffusion time (\(\Delta t\))

Report your the diffusion time in an appropriate unit (seconds, minutes, hours, years) accordingly.

  1. Navigate to the following website, which lists sizes of different cells: (https://en.wikibooks.org/wiki/Cell_Biology/Introduction/Cell_size)[LINK]. For what cells would diffusion be a reasonable process to transport materials?

 

Exercise 23.2 You are playing a casino game. If you win the game earn a dollar. If you lose the game you lose one dollar. The probability of winning or losing is 50-50 (0.50). You start the game with $100.

  1. Write a one-dimensional random walk to simulate your money after playing the game 50 times. Make a few sample plots.
  2. Based on the results of this section, what do you think your long-term expected winnings will be?
  3. Now assume the house win probability is 0.52. Modify your random walk to simulate your money after playing the game 50 times. Make a few sample plots.
  4. What do you think your long-term expected winnings of this modified game will be? (You may need to play the game for 100, 200 times to see a pattern.)

 

Exercise 23.3 Compute \(\langle r \rangle\) for the following random variable: \[\begin{equation} r=\begin{cases} -1 & p(r)=0.52 \\ 1 & p(r)=0.48 \end{cases} \end{equation}\]

 

Exercise 23.4 Compute \(\langle r \rangle\) for the following random variable: \[\begin{equation} r=\begin{cases} -1 & p(-1)=q \\ 1 & p(1)=(1-q) \end{cases} \end{equation}\]

 

Exercise 23.5 Consider the following random variable: \[\begin{equation} r= \begin{cases} -1 & p(-1) = 1/3 \\ 0 & p(0)= 1/3\\ 1 & p(1)=1/3 \end{cases} \end{equation}\]

  1. Modify the code for the one dimensional random walk to generate a simulation of this random walk and plot your result. You can do this by applying a if else statement as shown in the code chunk below.:

  2. Compute \(\displaystyle \langle r \rangle\) and \(\displaystyle \langle r^{2} \rangle\).

  3. Based on your last answer, explain how this random variable introduces a different random walk than the one described in this section. In what ways do you tihnk this would change our calculations for the mean and variance of the ensemble simulations?

 

p <- runif(1)
if (p < 1 / 3) {
  x[i] <- x[i - 1] - 1
} else if (1 / 3 <= p & p < 2 / 3) {
  x[i] <- x[i - 1]
} else {
  x[i] <- x[i - 1] + 1
}

Exercise 23.6 In this exercise you will write code for a two dimensional random walk.

  1. Modify the code for the one dimensional random walk to have both an \(x\) and a \(y\) position. One way to do this is to create a variable \(y\) structured similar to \(x\), and to make a second if statement in your for loop that moves y.
  2. Plot a few different realizations of your sample paths.
  3. If we were to compute the mean and variance of the ensemble simulations, what do you think they would be?