Engineering Probability Class 13 Mon 2019-02-25

1   This year's exam 1 online

with and w/o answers. See here.

We gave full points even if you didn't finish the arithmetic to compute a number. In the real world, you have computers. However, in the real world, accurate analysis and computation matter. In 1954, physicists made an eensy teensy error designing Castle Bravo.

2   Homework 5

online, due after break.

3   Notation

How to parse $F_X(x)$

  1. Uppercase F means that this is a cdf. Different letters may indicate different distributions.
  2. The subscript X is the name of the random variable.
  3. The x is an argument, i.e., an input.
  4. $F_X(x)$ returns the probability that the random variable is less or equal to the value x, i.e. prob(X<=x).

4   Matlab

  1. Matlab, Mathematica, and Maple all will help you do problems too big to do by hand. Sometime I'll demo Matlab since IMO more of the class knows it.

  2. Matlab

    1. Major functions:

      cdf(dist,X,A,...)
      pdf(dist,X,A,...)
      
    2. Common cases of dist (there are many others):

      'Binomial'
      'Exponential'
      'Poisson'
      'Normal'
      'Geometric'
      'Uniform'
      'Discrete Uniform'
      
    3. Examples:

      pdf('Normal',-2:2,0,1)
      cdf('Normal',-2:2,0,1)
      
      p=0.2
      n=10
      k=0:10
      bp=pdf('Binomial',k,n,p)
      bar(k,bp)
      grid on
      
      bc=cdf('Binomial',k,n,p)
      bar(k,bc)
      grid on
      
      x=-3:.2:3
      np=pdf('Normal',x,0,1)
      plot(x,np)
      
    4. Interactive GUI to explore distributions: disttool

    5. Random numbers:

      rand(3)
      rand(1,5)
      randn(1,10)
      randn(1,10)*100+500
      randi(100,4)
      
    6. Interactive GUI to explore random numbers: randtool

    7. Plotting two things at once:

      x=-3:.2:3
      n1=pdf('Normal',x,0,1)
      n2=pdf('Normal',x,0,2)
      plot(x,n1,n2)
      plot(x,n1,x,n2)
      plot(x,n1,'--r',x,n2,'.g')
      
  3. Use Matlab to compute a geometric pdf w/o using the builtin function.

  4. Iclicker. Which of the following do you prefer to use?

    1. Matlab
    2. Maple
    3. Mathematica
    4. Paper. It was good enough for Bernoulli and Gauss; it's good enough for me.
    5. Something else (please email about it me after the class).

5   My opinion

This is my opinion of Matlab.

  1. Advantages
    1. Excellent quality numerical routines.
    2. Free at RPI.
    3. Many toolkits available.
    4. Uses parallel computers and GPUs.
    5. Interactive - you type commands and immediately see results.
    6. No need to compile programs.
  2. Disadvantages
    1. Very expensive outside RPI.
    2. Once you start using Matlab, you can't easily move away when their prices rise.
    3. You must force your data structures to look like arrays.
    4. Long programs must still be developed offline.
    5. Hard to write in Matlab's style.
    6. Programs are hard to read.
  3. Alternatives
    1. Free clones like Octave are not very good
    2. The excellent math routines in Matlab are also available free in C++ librarues
    3. With C++ libraries using template metaprogramming, your code looks like Matlab.
    4. They compile slowly.
    5. Error messages are inscrutable.
    6. Executables run very quickly.

6   Chapter 4 ctd

  1. Taxi example: Sometimes there are mixed discrete and continuous r.v.

    1. Let X be the time X to get a taxi at the airport.
    2. 80% of the time a taxi is already there, so p(X=0)=.8.
    3. Otherwise we wait a uniform time from 0 to 20 minutes, so p(a<x<b)=.01(b-a), for 0<a<b<20.
  2. Iclicker. For the taxi example, what is F(0)?

    1. 0
    2. .2
    3. .8
    4. .81
    5. 1
  3. iclicker. For the taxi example, what is F(1)?

    1. 0
    2. .8
    3. .81
    4. .9
    5. 1
  4. Text 4.2 p 148 pdf

  5. Simple continuous r.v. examples: uniform, exponential.

  6. The exponential distribution complements the Poisson distribution. The Poisson describes the number of arrivals per unit time. The exponential describes the distribution of the times between consecutive arrivals.

    Ex 4.7 p 150: exponential r.v.

  7. Properties

    1. Memoryless.
    2. $f(x) = \lambda e^{-\lambda x}$ if $x\ge0$, 0 otherwise.
    3. Example: time for a radioactive atom to decay.
  8. Ski p 4.2.1 for now.

  9. The most common continuous distribution is the normal distribution.

  10. 4.2.2 p 152. Conditional probabilities work the same with continuous distributions as with discrete distributions.

  11. p 154. Gaussian r.v.

    1. $$f(x) = \frac{1}{\sqrt{2\pi} \cdot \sigma} e^{\frac{-(x-\mu)^2}{2\sigma^2}}$$
    2. cdf often called $\Psi(x)$
    3. cdf complement:
      1. $$Q(x)=1-\Psi(x) = \int_x^\infty \frac{1}{\sqrt{2\pi} \cdot \sigma} e^{\frac{-(t-\mu)^2}{2\sigma^2}} dt$$
      2. E.g., if $\mu=500, \sigma=100$,
        1. P[x>400]=0.66
        2. P[x>500]=0.5
        3. P[x>600]=0.16
        4. P[x>700]=0.02
        5. P[x>800]=0.001
  12. Text 4.3 p 156 Expected value

  13. Skip the other distributions (for now?).