lecture 11: a bit more on probability and random walks · 2020. 9. 18. · xn k=1 p(k)x k = e(x)...

23
Physical Principles in Biology Biology 3550 Fall 2020 Lecture 11: A Bit More on Probability and Random Walks Friday, 18 September 2018 ©David P. Goldenberg University of Utah [email protected]

Upload: others

Post on 21-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

  • Physical Principles in BiologyBiology 3550

    Fall 2020

    Lecture 11:

    A Bit More on Probability and Random Walks

    Friday, 18 September 2018

    ©David P. GoldenbergUniversity of Utah

    [email protected]

  • Two Important Parameters for any Discrete Random Variable

    Expected value, also called the mean (—)

    — =nX

    k=1

    p(k)xk = E(x)

    Variance (ff2)

    ff2 =nX

    k=1

    p(k)(xk − —)2

    • A measure of the width of the distribution of x values around the mean.• Mean of the squares of the differences between x-values and the mean.• Squares are taken so that both positive and negative differences contribute.• Square root of the variance, ff, is called the standard deviation.ff has the same dimensions as x and —.

  • Another Probability Distribution Function

    The discrete uniform distribution: A finite number of outcomes with equalprobabilities.

    An example: A fair, six-sided die with 1–6 dots on the sides.• Six outcomes: k = 1 : : : 6, where k is the number of dots on the side that lands

    facing up.• Random variable: xk = k .• Probabilities: p(k) = 1=6

  • The Expected Value for a Fair Six-sided Die

    Dots (k) xk p(k) p(k)xk

    1 1 1/6 1/6

    2 2 1/6 2/6

    3 3 1/6 3/6

    4 4 1/6 4/6

    5 5 1/6 5/6

    6 6 1/6 6/6

    Total 1 21/6 =3.5

  • Mean, Variance and Standard Deviation for the

    Binomial Probability Distribution FunctionThe probability function:

    p(k ; n; p) =n!

    k!(n − k)!pk(1− p)(n−k)

    for k = 0 to n.

    The mean of k :— = np

    The variance:

    ff2 = np(1− p)

    The standard deviation:

    ff =pnp(1− p)

  • Effect of n on the Mean and Standard Deviation for the

    Binomial Probability Distribution Function

    — = np

    ff =pnp(1− p)

    The distribution gets wider as n gets larger, by the factor√n.

  • Effect of p on the Mean and Standard Deviation for the

    Binomial Probability Distribution Function

    — = np

    ff =pnp(1− p)

    For a given value of n, the distribution is widest when p = 0:5.

  • Direction Change

    Warning!

    Random Walks

  • A Random Walk in One Dimension

    Heads - rightTails - left

    1. Start at position x = 0.

    2. Flip coin.• Heads, take step of length ‹ to the right.• Tails, take step of length ‹ to the left.

    3. Repeat 2 another (n − 1) times.Final position is xn.

    Generally expect a distribution of xn ifthe random walk is repeated a largenumber of times (N).

  • Calculate The Average Final Position

    (The Expected Value of xn)

    For a single random walk, the final position will be:

    xn =nX

    i=1

    ‹i

    where i is the step number, and ‹i is either +‹ or −‹, with probabilities p+and p−.

    For each step, ‹i is a random variable, with an expected value, E(‹i):

    E(‹i) = ‹p+ + (−‹p−) = ‹p+ − ‹p−

    = ‹p+ − ‹(1− p+)

    = ‹p+ − ‹ + ‹p+

    = 2‹p+ − ‹ = ‹`2p+ − 1

    ´

  • Clicker Question #1

    If the random-walk step size is 0.5 m, and the probability of a forwardstep, p+, is 0.3, what is the expected value for the displacement in asingle step, E(‹i)?

    A) -0.5 m

    B) -0.2 m

    C) 0 m

    D) 0.2 m

    E) 0.5 m

    E(‹i) = ‹p+ − ‹p−

    = 0:5m · 0:3− 0:5m · 0:7

    = 0:5m(0:3− 0:7) = −0:2m

  • Calculating The Expected Value of xn

    An important theorem: If x and y are two independent random variables,then the expected value of the sum is calculated as:

    E(x + y) = E(x) + E(y)

    Since:

    xn =nX

    i=1

    ‹i

    The expected value of xn is calculated as:

    E`xn´=

    nXi=1

    E(‹i) = nE(‹i)

    = n‹`2p+ − 1

    ´

  • Expected Value of xnfor a One-dimensional Random Walk

    0.8

    0.35

    0.5

    0.65

    0.2

  • Some Different Kinds of Average

    For N random walks of n steps each:The mean:

    〈xn〉 =1

    N

    NXj=1

    xn;j , for large N

    Angle brackets, 〈 〉, indicate average over a large sample.xn;j is the final position of the j th walk.

    The mean-square average:

    〈x2n 〉 =1

    N

    NXj=1

    x2n;j

    The root-mean-square (RMS) average:

    RMS(xn) =p〈x2n 〉 =

    vuut 1N

    NXj=1

    x2n;j

  • An Application of Mean-square and

    Root-mean-square Averages: Household Power (US)

    Voltage versus time

  • An Application of Mean-square and

    Root-mean-square Averages: Household Power (US)

    Voltage squared versus time

  • An Application of Mean-square and

    Root-mean-square Averages: Household Power (US)

    √V 2 versus time

  • Clicker Question #2

    For the numbers: −4; 2;−3; 1; 5,Calculate the root-mean-square average

    A) ∼ 0:2

    B) ∼ 1:5

    C) ∼ 2:9

    D) ∼ 3:3

    E) ∼ 4:8

    RMS =

    r−42 + 22 +−32 + 12 + 52

    5=

    r16 + 4 + 9 + 1 + 25

    5=

    r55

    5=√11

  • Calculating the Mean-Square Displacementfor a 1-d Random Walk

    The mean-square average:

    〈x2n 〉 =1

    N

    NXj=1

    x2n;j

    j is the random walk number.

    For a single random walk, the final position will be:

    xn =nX

    i=1

    ‹i

    i is the step number.

    If we do a large number, N, of random walks, the mean-squaredisplacement will be:

    〈x2n 〉 =1

    N

    NXj=1

    x2n;j =1

    N

    NXj=1

    nX

    i=1

    ‹j;i

    !2

  • A Random Walk in Two Dimensions

    1. Start at (x; y) coordinates (0,0).

    2. Choose a random direction, defined bythe angle „ from the x-axis.

    3. Move distance ‹ in the chosen direction.

    4. Repeat another (n − 1) times.

    5. For simulation, how do we choose „?

  • Simulating Random Processes with a Computer

    Computers aren’t supposed to do things at random!

    But, we often ask them to!

    Pseudo-random number generators

    Pseudo random number

    Mathematical

    function

    Seed number

    Function has to be carefully designed so that numbers “look random”.

  • How Do We Decide if Numbers “Look Random”?

    After generating lots of numbers, they should approximate a defineddistribution; for instance evenly distributed numbers from 0 to 1.

    Shouldn’t be able to predict one number from a previous one, withoutknowing the algorithm.

    A sign of trouble: Numbers start repeating.• Eventually this will happen with any pseudo-random number generator.• Repeat period should be very large.

    (greater than the number of numbers to be used)

    Good random numbers are are becoming more important every day!

  • Where Does the Seed Number Come From?

    A user-specified number, to generate a predictable set of pseudo-randomnumbers. Useful for simulations.

    The computer’s clock. Very common method.

    A truly random physical process:• Radioactive decay.https://www.fourmilab.ch/hotbits/

    • A lava lamp!https://en.wikipedia.org/wiki/Lavarand

    • Electronic or thermal noise.https://en.wikipedia.org/wiki/Hardware_random_number_generator

    Now incorporated in some computer CPUs and USB dongles.

    https://www.fourmilab.ch/hotbits/https://en.wikipedia.org/wiki/Lavarandhttps://en.wikipedia.org/wiki/Hardware_random_number_generator