Transcript New - MAPL

Probability
05. Continuous Random Variable
Independent random variable
Mean and variance
郭俊利
2009/03/30
1
Outline

Review




Probability
Problem 2.42
Exponential random number
Normal random number
CDF
2.7 ~ 3.3
(Cumulative Distribution Function)
2
Problem 2.42

Probability
Computational problem. Here is a probabilistic method for computing the
area of given subset S of the unit square. The method uses a sequence of
independent random selections of points in the unit square [0, 1] x [0, 1],
according to a uniform probability law. If the ith point belongs to the subset
S the value of a random variable Xi is set to 1, and otherwise it is set to 0.
Let X1, X2, … be the sequence of random variables thus defined, and for
any n, let
X1 + X2 + … + Xn
Sn =
n
(a) Show that E[Sn] is equal to the area of the subset S, and that var(Sn)
diminishes to 0 as n increases.
(b) Show that to calculate Sn, it is sufficient to know Sn-1 and Xn, so the past
values of Xk, k = 1, …, n – 1, do not need to be remembered. Give a
formula.
(c) Write a computer program to generate Sn for n = 1, 2, …, 10000, using the
computer’s random number generator, for the case where the subset S is the
circle inscribed within the unit square. How can you use your program to
measure experimentally the value of π?
(d) Use a similar computer program to calculate approximately the area of the
set of all (x, y) that lie within the unit square and satisfy 0 ≦ cosπx + sinπy
≦ 1.
3
Solution 2.42
(1/3)
Probability
我的翻譯 (my translation, 翻錯別打我):
有種機率算法是計算一個 S 的面積 (S 在給定範圍 unit square 內),
每次選取的點 ith 會落在 [0, 1] x [0, 1] 中 (並且 ith 是 uniform 且
independent),如果點 ith 落在 S 裡, Xi 就等於 1,否則 Xi = 0,又

X1 + X2 + … + Xn
Sn =
n
(a) 計算 E[Sn] 和 var(Sn)
(b) 發現 Sn 不用管 X1 ~ Xn – 1,可以用 Sn – 1 和 Xn 表示 Sn
(c) 可以用程式語言寫一個遞迴求 Sn,設 Sn 是一個圓形,從 n = 1 ~
10000 推敲出π值
(d) 算出符合 0 ≦ cosπx + sinπy ≦ 1 這樣式子的所有 (x, y) 組合成的面
積
4
Solution 2.42

My solution
(2/3)
Probability
(解錯別打我):
S
..........
..........
..........
..........
i=1~n
= 1 ~ 40
Xi = 1 or 0
Xi is a random variable,
Sn is a random variable.
..........
..........
..........
..........
P(Xi = 1) = 18/40
P(Xi = 1) = Area(S) / 給定範圍 = Area(S)
Area( [0, 1] x [0, 1] ) = 1
5
Solution 2.42
(3/3)
Probability
6
Continuous Random Variable
Probability

Uniform (Lecture 8)
∫fX(x) dx = 1
∫x fX(x) dx = E[X]
PDF fX(x) =
(2) E[X] =
(3) var(X) =
(1)
, a≦x≦b
7
Example 1

Probability
Computer’s lifetime is a random variable (unit: hour).
f(x) =

(PDF)
{
0
100 / x2
, x≦100
, x > 100
Five computers construct a network server
= P(X ≧ a) – P(X ≧ b)
(1)
(2)
(3)
(4)
A
A
A
A
computer is down at 150th hour.
computer is down before 150th hour.
computer is down before 200th hour.
server is crash before 700th hour.
8
Exponential random number




Probability
f(x) = λe–λx
P(x ≧ a) =∫a∞ λe–λx dx
= –e–λx | a∞ = e–λa
E[X] = 1 / λ
var(X) = 1 / λ2 (E[X2] = 2 / λ2)
9
Example 2

(Exponential)
Probability
The spent time of work is modeled as an
exponential random variable. The average
time that Xiao-Ming completes the task is 10
hours. What is the probability that Xiao-Ming
has done this task early (in advance)?
10
Cumulative Distribution Function
Probability
dFx
f(x) =
(x)
dx
p(k) = P(X ≦ k) – P(X ≦ k–1) = F(k) – F(k–1)
11
Normal random number
Probability
0
aμ + b
a2σ2
12
Example 3

N(–a) = P(Y ≦ –a) = P(Y ≧ a) = 1 – P(Y ≦ a)
N(–a) = 1 – N(a)
CDF


Probability
Standard normal distribution


(Normal)
P(X ≦ a) = P(Y ≦
a–μ
σ ) = N(
a–μ
σ )
The annual rainfall is modeled as a normal random
variable with a mean = 600 mm and a standard
deviation = 200. What is the probability that this
year’s rainfall will be at least 800 mm?
13