You are on page 1of 12

El-Shorouk Academy

Higher Institute for Computer & Term : First

Information Technology Year : 3rd

Department of Computer sciences

Instructor : Dr.farouk shaaban

Computer modeling & simulation

a-Drive the CDF of a distribution whose probability density function is given by:

f(X)=1/4(x-1)3 1≤x≤3

=0 Otherwise

Also get 4 random observations following the above distribution using the
following R.N(0.38,0.9,0.13,0.73)

F(x)=

F(x)=

F(x)=

F(x)= . /4

1
Page 1 of 12
F(X)-F(1)= /16 – 0

F(X)= /16

To get random observation:


R=F(X)
R= /16

16R=

2 =(x-1)

X=1 + 2 0 1

To get 4 R.O:
1) R=0.38
X=1 + 2
X1=1 + 2 =2.57

2) R=0.9
X=1 + 2
X2=1 + 2 =2.94

Page 2 of 12
3) R=0.13
X=1 + 2
X3=1 + 2 = 2.2

4) R=0.73
X=1 + 2
X4=1 + 2 =2.84

Page 3 of 12
- Drive the cumulative distribution function of the distribution whose
probability density function is given by

f(x)=(x-1)/3 1<=x<=3

=(8-2x)/3 3<=x<=4

=0

also get 3 random observations following the above distribution


using the following R.N(0.18,0.93,0.58).

To get CDF:-
1st part :

F(x1) = =

= . |

F( X1)= F(x) – F(1) = — 0

F(x1) = 1≤x≤3

F(1)=0
F(3)=2/3

F(X2)= + = +

= + ( . | )
F(x) – F(3) = — (- )

Page 4 of 12
F(x2) = — +

F(X2)=1- 3≤x≤4

R = 1≤x≤3

=1- 3≤x≤4
1st part:
When R= 1≤x≤3

= 6R
x-1 =
x1 = + 1 1 ≤ x ≤ 3
When
x = 1 à R = 0
x = 3 à R = 2/3
Then 0 ≤ R ≤ 2/3
x = + 1 1 ≤ x ≤ 3 , 0 ≤ R ≤ 2/3
1

2nd part:
When R= 1- 3≤x≤4

R = 1 — × (12)
12 R = 12 — (8-2x)2
(8-2x)2 = 12 — 12R

8-2x =
2(4-x) =
2(4-x) = , where 12 = ÷ (2)

Page 5 of 12
4 x =
x2 = 4 3 ≤ x ≤ 4

When
x = 3 à R = 2/3
x = 4 à R = 1
Then 2/3 ≤ R ≤ 1

x2 = 4
3 ≤ x ≤ 4 , 2/3 ≤ R ≤

1
To get R.O :
R.N : 0.18 -----> x= + 1 1 ≤ x ≤ 3 , 0 ≤ R ≤ 2/3
x1 = + 1 = 2.04

Belongs to X1 equation because R belongs to that range 0 ≤ R ≤ 2/3


X1 must be in that range 1 ≤ x ≤ 3

R.N: 0.93 -----> x= 4 3 ≤ x ≤ 4 , 2/3 ≤ R ≤ 1

x2 = 4 = 3.54 3 ≤ x ≤ 4 , 2/3 ≤ R ≤ 1

Belongs to x2 equation because R belongs to that range 2/3 ≤ R ≤ 1


X2 must be in that range 3 ≤ x ≤ 4

R.N: 0.58 -----> x= + 1 1 ≤ x ≤ 3 , 0 ≤ R ≤ 2/3

x3 = + 1 = 2.87 1 ≤ x ≤ 3 , 0 ≤ R ≤ 2/3


Belongs to x1 equation because R belongs to that range 0 ≤ R ≤ 2/3
X3 must be in that range 1 ≤ x ≤ 3



Page 6 of 12





Page 7 of 12
a-Drive the CDF of a distribution whose probability density function is given by:

F(x)=(1+x ) -1≤x≤0

=(1-x ) 0≤x≤1

Also get 4 random observation following the above distribution using the
following R.N(0.38,0.9,0.13,0.73)

F(x)=

F(x1)=

x
F(x1)=(1+x /2

-1
F(x)-F(-1)= (1+x /2 -0

F(X1)= (1+x /2

F(x2)=

F(x2)=

Page 8 of 12


0 x
F(x2)=(1+x /2 + (1-x /2*-1

-1 0
0

(1+x /2 = F(0)-F(1)= - 0=

-1
x

(1-x /2*-1 = F(x)-F(0)=(1-x /-2 –(- )= (1-x /-2 +

F(x2)= + (1-x /-2 +

F(x2)=1-(1-x /2

To get random observation(R.O)
Ø Random observation of F(x1)
R=F(x1)
R=(1+x /2

Page 9 of 12
2R= (1+x

(1+x)=

X= – 1

When x = -1

-1= - 1

R=0

When x= 0

0= - 1

R=

X= – 1 0 -1 0

Ø Random observation of F(x2)


R=F(x2)

R=1-(1-x /2

(1-x /2 = 1 – R

(1-x =2(1 – R)

(1 – x)=

Page 10 of 12
X=1-

When x=0

0=1-

R=

When x=1

1=1-

R=1

X=1- X 1


è To get 4 random observations:
1) R=0.38 0

X= – 1

X1= - 1=- 0.128 -1 0

2) R=0.9

X=1-

X2=1- = 0.55 0 1

3) R=0.13 0
Page 11 of 12
X= – 1

X3= - 1=- 0.49 -1 0

4) R=0.73

X=1-

X4=1- = 0.26 0 1

Page 12 of 12

You might also like