Download El-Shorouk Academy Acad. Year : 2012/ 2013 Higher Institute for

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
El-Shorouk Academy
Acad. Year : 2012/ 2013
Higher Institute for Computer &
Term
: First
Information Technology
Year
: 3rd
Department of Computer sciences
Instructor : Dr.farouk shaaban
Computer modeling & simulation
 Use the one-digit Random Number (6, 3, 5, 0, 8) to
generate random observations for:
a) Throwing fair coin.
b) Throwing a biased coin, assuming that probability of
tail=30%.(unfair coin)
?? Implement c# programs to simulate these two problems ??
Page 1 of 5
a)
Random numbers that are one-digit are from 0 -------> 9 [ten integer numbers].
Because the coin is fair, then the probability of head equal to the probability of tail =
50% , Means “P(Head)=50% & P(Tail)=50% “.
-
Theoretical probability of Head ( H )= 50 %= 0.5
-
Theoretical probability of Tail ( T ) = 50 % = 0.5
Means that , the random numbers that indicate to head are five numbers (50%) , say :
0,1,2,3,4 and the random numbers that indicate to tail are the other five numbers
which are: 5,6,7,8,9.
H -----> 0, 1, 2, 3, 4
0.5
T -----> 5, 6, 7, 8, 9
0.5
No . of .trails = 5  According to the number of random numbers that given in that
problem ( we have in that problem 5 random numbers then no of trails = 5 )
Then:(6, 3, 5, 0, 8 )
-------Random observations--------->
(T, H, T, H, T )
Simulated probability of head = no. of repeating head / no. of trials.
Simulated probability of( head)=2/5=0.4
Simulated probability of tail = no. of repeating tail / no. of trials.
Simulated probability of (tail)=3/5=0.6
Page 2 of 5
Error = Theoretical prob - Simulated prob
* 100
Theoretical prob
Error of head = 0.5 – 2/5 * 100 = 20 %
0.5
Error of tail = 0.5 – 0.6
* 100 = 20 %
0.5
Conclusion :

Error of HEAD is 20% which means probability of head decreased by 20 %
because the theoretical probability = 0.5 then after compute simulated probability it
become = 0.4 then it decreased ( 0.5  0.4 ) , means also that the simulated
probability is smaller 0.2 THAN the theoretical probability.
Error of tail is 20% which means probability of tail increased by 20 % because
the theoretical probability = 0.5 then after compute simulated probability it become
= 0.6 then it increased ( 0.5  0.6 ) ,means also that the simulated probability is
greater 0.2 than the theoretical probability.
Page 3 of 5
Unfair Coin
b)
Random numbers that are one-digit are from 0 -------> 9 [ten integer numbers].
Because the coin is unfair, then the probability of head isn’t equal to the probability
of tail , then from the given probability the probability of head = 70 % , because the
probability of tail = 30 % ( given ).
Then let the random numbers that indicate to head are seven numbers (70%) , say :
(0,1,2,3,4,5,6) and the random numbers that indicate to tail are the other three
numbers which are: (7,8,9).
-
Theoretical probability of head = 70 % = 0.7
-
Theoretical probability of tail = 30 % = 0.3
H -----> 0, 1, 2, 3 , 4 , 5 , 6
0.7
T -----> 7, 8, 9
0.3
Then:(6, 3, 5, 0, 8 )
-------Random observations--------->
(H, H, H, H, T )
No .Of . trails = 5 ( because the number of random numbers is 5 numbers )
Simulated probability of head = no. of repeating head / no. of trials.
Simulated probability of( head)=4/5=0.8
Simulated probability of tail = no. of repeating tail / no. of trials.
Simulated probability of (tail)=1/5=0.2
Error=
Theoretical prob - Simulated prob
Theoretical prob
Error of head = 0.7 – 0.8 * 100 = 14.29 %
0.7
Error of tail =
0.3 – 0.2 * 100 = 33.33 %
0.3
Page 4 of 5
* 100
Conclusion:
-
Error of head = 14.29 % which means that the probability of head increased by
14.29 %, because the theoretical probability = 0.7 and then after compute simulated
probability it become = 0.8 then it increased ( 0.7  0.8 ) , means also the simulated
probability is greater than theoretical probability.
-
Error of tail = 33.33 % which means that the probability of tail decreased by 33.33
% , because the theoretical probability = 0.3 and then after compute simulated
probability it become = 0.2 then it decreased ( 0.3  0.2 ) , means also the simulated
probability is smaller than theoretical probability.
Page 5 of 5
Related documents