You are on page 1of 71

SIMULATION AND MODELING

INDEX
No. Topic
Page
No.
Date Sign
1 Single-Channel Queuing Model 2-6
2 Multi-Channel Queuing Model 7-10
3 Inventory System 11-14
4 Disrete Distri!ution 1"-2"
" Continuous Distri!ution 26-42
6 #eneration o$ %andom &um!ers 43-4'
7 %andom &um!ers (ests 4)-64
' *e+tane-%e,etion (ehni-ue 6"-6)
Practical-01
1
Single-Channel Queuing Model
Write a C/C++/Excel Program to simulate a Single-Channel Queuing Moel.
!or C/C++ Programming use the li"rar# $unctions to generate the n-igite ranom
num"ers.
!or Excel use the in-"uilt $unction to generate the n-igite ranom num"ers.
Distri"ution o$ Time "et%een &rri'als
*e+t +ro!a!ility values $or the Inter-arrival time !et.een /1 minute 0 6 minutes12
#enerate the %andom-digit assignment2
Distri"ution o$ Ser'ice Time
*e+t +ro!a!ility values $or the Servie (ime !et.een /1 minute 0 6 minutes12 #enerate
the %andom-digit assignment2
Total No. o$ Customers N()*.
Prepare a simulation ta"le an ans%er the $ollo%ing +ueries such as $in
i, &'g. %aiting time -minutes,
ii, Pro"a"ilit# that a customer has to %ait
iii, Pro"a"ilit# o$ ile ser'er
i', &'g. ser'ice time -minutes,
', &'g. time "et%een arri'als -minutes,
'i, &'g. %aiting time o$ those %ho %ait -minutes,
'ii, &'g. time customer spens in the s#stems -minutes,
Theor#. Simulation o$ +ueuing s#stem.
* -ueuing system is desri!ed !y its alling +o+ulation3 the nature o$ the arrivals
the servie mehanism3 the system a+aity3 and the -ueuing disi+line2
(hus $or simulation o$ -ueuing system3 .e need to generate arrivals and servie
times2 (he
time $or arrivals and servie times should !e random/ as time re+resents real .orld situation12
(hese random times are generated .ith the hel+ o$ random no4s2
Example. Single Channel Queue
In the single -ueue3 the system .or5s an /6irst-In-6irst-7ut1 6I67 !y a single
server or hannel2
In a single hannel -ueuing system3 inter-arrival times and servie times are
generated $rom the distri!utions o$ random num!ers
-2-
/i'en Data.
Distri"ution o$ Ser'ice Time.
*e+t +ro!a!ility values $or the Servie (ime !et.een /1 minute 0 6 minutes12
#enerate the %andom-digit assignment2
Ser'ice-Time Distri"ution.
(his is servie-time distri!ution in .hih servie time varies $rom 1 to 6 minutes .ith the
+ro!a!ilities2
Distri"ution o$ Time "et%een &rri'als.
*e+t +ro!a!ility values $or the Inter-arrival time !et.een /1 minute 0 6 minutes12
#enerate the %andom-digit assignment2
(his is the simulation study $or Single-Channel Queuing System
Distribution of Time between Arrivals
Time
between
Arrivals
(Minutes)
Probabilit
y
Cumulative
Probability
Service Time Distribution
Service
Time
(Minutes
)
Probabilit
y
Cumulativ
e
Probabilit
y

1 0.10 0.10
2 0.20 0.0
0.0 0.!0
" 0.2# 0.$#
# 0.10 0.%#
! 0.0# 1.00
-3-
1 0.12# 0.12#
2 0.12# 0.2#0
0.12# 0.&#
" 0.12# 0.#00
# 0.12# 0.!2#
! 0.12# 0.&#0
& 0.12# 0.$&#
$ 0.12# 1.000
Explanation o$ Simulation Ta"le $or Single Channel Queuing S#stem
1.
( )
( )
ustomers o$ num!er total
minutes -ueue in .ait ustomers time total

minutes
time %aiting &'erage
2.
ustomers o$ num!er total
.ait .ho ustomers o$ num!er
%ait to has customer a that # Pro"a"ilit
3.
( )
( ) minutes simulation o$ run time total
minutes server o$ time idle total
ser'er ile o$ # Pro"a"ilit
4.
( )
( )
ustomers o$ num!er total
minutes time servie total

minutes
time ser'ice &'erage
5.
( )
( )
1 - arrivals o$ num!ers
minutes arrivals !et.een times all o$ sum

minutes
arri'als "et%een time &'erage
Column Description
Customer the ustomers in order o$ their arrival2
Inter-arrival Time the inter-arrival time o$ the ustomer at the random $ashion2
Arrival Time the arrival time o$ the +revious ustomer and the +resent ustomer2
Service Time the estimated time ta5en !y the system to om+lete the servie2
Time Service the starting time o$ the servie2
Waiting Time in Queue the time ta5en !y the ustomers .ait in -ueue2
Time Service Ends the time at .hih the servie to ustomers ends2
Time Customer spends the total time ta5en !y the ustomer to om+lete its servie in the system2
Idle Time of Server the time at .hih server .as in idle state2
-4-
6.
( )
( )
.ait .ho ustomers o$ num!ers total
minutes -ueue in .ait ustomers time total

minutes %ait %ho those
o$ time %aiting &'erage
7.
( )
( )
ustomers o$ num!ers total
minutes system
in the s+end ustomers time total

minutes
s#stem the in spens
customer time &'erage
Simulation Ta"le $or Queuing Example.
Clock Clock Clock
Custome
r
Interarrival
Time
(Minutes)
Arrival
Time
Service
Time
(Minutes)
Time
Service
Begins
Waiting
Time
in Queue
(Minutes)
Time
Service
Ends
Time
Custome
r
Spends
in
System
(Minutes)
Idle Time
o Server
(Minutes)
! " " # " " # # "
$ % % # % " !$ # #
& ! ' $ !$ & !# ( "
# ! !" $ !# # !) ) "
( ( !( $ !) ! !% & "
) ) $! & $! " $# & &
* ) $* ) $* " && ) &
% ! $% # && ( &* ' "
' ( && $ &* # &' ) "
!" ) &' ( &' " ## ( "
!! & #$ # ## $ #% ) "
!$ * #' & #' " ($ & !
!& $ (! ! ($ ! (& $ "
!# ! ($ # (& ! (* ( "
!( & (( # (* $ )! ) "
!) # (' $ )! $ )& # "
!* # )& # )& " )* # "
!% # )* ! )* " )% ! "
!' # *! & *! " *# & &
$" # *( & *( " *% & !
*( **# )& *'' $( %)$ %% !(
-"-
01& Coe.
(o insert the 8isual 9asi Code (ools : Maro : 8isual 9asi ;ditor
Moule.
7+tion ;<+liit
6untion Disrete/=ro! *s %ange3 8alue *s %ange1
Dim l%o.>ast3 ro. *s >ong
Dim ?++er>imit *s Dou!le3 ? *s Single
? @ %nd/1
l%o.>ast @ =ro!2%o.s2Count
6or ro. @ 1 (o l%o.>ast
?++er>imit @ =ro!2Cells/ro.3 1128alue
I$ ? A@ ?++er>imit (hen
Disrete @ 8alue2Cells/ro.3 1128alue
;<it 6untion
;nd I$
&e<t ro.
Disrete @ 0
;nd 6untion
Sheet2.
=rivate Su! %un(rialBCli5/1
Sheet12Calulate
;nd Su!
Solutions of the queries:
Average Waiting time !+$(
,ro-a-ility t.at a Customer .as to /ait "+(
,ro-a-ility o an idle Customer "+"!*#
Average Service Time (Minutes) &+!(
Average Time Bet/een Arrivals (Minutes) &+'#*
Average /aiting Time o t.ose /.o /ait (Minutes) $+(
Average time customer spends in t.e system (Minutes) #+#
-6-
Practical-02
Multi-Channel Queuing Model
Write a C/C++/Excel Program to simulate a Multi-Channel Queuing Moel -e.g. &"le
an 1a3er, %ith one o$ the ser'ers getting the higher pre$erence.
!or C/C++ Programming use the li"rar# $unctions to generate the n-igite ranom
num"ers.
!or Excel use the in-"uilt $unction to generate the n-igite ranom num"ers.
/i'en.
4nter-arri'al Distri"ution o$ cars
*e+t +ro!a!ility values $or the Inter-arrival time !et.een /1 minute - 4 minutes12
#enerate the %andom-digit assignment2
Ser'ice Distri"ution o$ &"le
*e+t +ro!a!ility values $or the Servie (ime !et.een /2 minutes - " minutes12
#enerate the %andom-digit assignment2
Ser'ice Distri"ution o$ 1a3er
*e+t +ro!a!ility values $or the Servie (ime !et.een /3 minutes - 6 minutes12
#enerate the %andom-digit assignment2
Total No. o$ Customers N()*.
Prepare a simulation ta"le an o the su"se+uent anal#sis $or )* ser'ice completions
an ans%er the $ollo%ing +ueries such as $in.
2, Percentage o$ time &"le an 1a3er ini'iuall# %here "us# o'er total
ser'ice time.
), Percentage o$ arri'als ha to %ait.
5, The a'erage %aiting time $or all the customer
6, The a'erage %aiting time $or the customer %ho ha to %ait.
Dra% the conclusion regaring the s#stem an cost o$ %aiting.
Theor#. The &"le-1a3er Carhop Pro"lem
(his e<am+le illustrates the simulation +roedure .hen there is more than one
servie hannel2
Consider a drive-in restaurant .here arho+s ta5e orders and !ring $ood to the ar2
Cars arrive in the manner sho.n in the ta!le o$ Inter-arrival Distri!ution o$ Cars2
/i'en Data.
(he time !et.een alls ranges $rom 1 to 4 minutes .ith distri!ution as sho.n in
$ollo.ing ta!leC
-7-
4nter-arri'al Time Distri"ution o$ Cars.
4nter-arri'al
Time
Pro"a"ilit# Cumulati'e
Pro"a"ilit#
1 0.25 0.25
2 0.40 0.65
3 0.20 0.85
4 0.15 1.00
(here are t.o arho+s 0 *!le and 9a5er2 *!le is !etter a!le to do the ,o! and .or5s a !it
$aster than !a5er2 * sim+li$ying rule is that *!le gets the ustomer i$ !oth
arho+s are idle2 =erha+s3 *!le has seniority2
Ser'ice Distri"ution o$ &"le.
*e+t +ro!a!ility values $or the Servie (ime !et.een /2 minutes - " minutes12
#enerate the %andom-digit assignment2
Ser'ice Distri"ution o$ 1a3er.
*e+t +ro!a!ility values $or the Servie (ime !et.een /3 minutes - 6 minutes12
#enerate the %andom-digit assignment2
(he +ro!lem is to $ind ho. .ell the urrent arrangement is .or5ing3 (his is the simulation
study $or Multi-Channel Queuing System2
Explanation o$ Simulation Ta"le $or Multi Channel Queuing s#stem.
Column Desri+tion
Caller No the ustomers in order o$ their arrival
Inter-arrival Time
the inter-arrival time o$ the ustomer at the random $ashion
Arrival Time
the arrival time o$ the +revious ustomer and the +resent ustomer
Able Available
the time .hen a!le is availa!le
a!er Available the time .hen !a5er is availa!le
Server Chosen the availa!le server hosen $or the servie
Service Time
the estimated time $or the om+letion o$ servie
Service Time Distribution
Able Baker
Service
Time
(Minutes)
Probability
Cumulative
Probability
Service
Time
(Minutes)
Probability
Cumulative
Probability
2 0.30 0.30 3 0.35 0.35
3 0.28 0.58 4 0.25 0.60
4 0.25 0.83 5 0.20 0.80
5 0.17 1.00 6 0.20
-'-
Time Service egins the starting time o$ the servie
Service-Completion
Time
the time at .hih servie is om+leted
Caller "elay
the time $or .hih the ustomer as to .ait $or servie
Simulation Ta"le $or Carhop Example .
-)-
BA Co!e"
To insert the Visual Basic Code Tools : Macro : Visual Basic Editor
Mo!ule"
Otion E!licit
"i# lCountCalls $s %on&
'unction "iscrete()ro* $s +an&e, Value $s +an&e-
"i# l+o.%ast, ro. $s %on&
"i# /er%i#it $s "ou*le, / $s 0in&le
/ 1 +nd(-
l+o.%ast 1 )ro*.+o.s.Count
'or ro. 1 1 To l+o.%ast
/er%i#it 1 )ro*.Cells(ro., 1-.Value
23 / 41 /er%i#it Then
lCountCalls 1 lCountCalls 5 1
"iscrete 1 Value.Cells(ro., 1-.Value
E!it 'unction
End 23
6e!t ro.
"iscrete 1 0
End 'unction
S#eet1"
)ri7ate 0u* +unTrial8Clic9(-
0heet1.Calculate
End 0u*
7"ser'ation.
a1 7ver the 41-minutes +eriod *!le .as !usy )"212D o$ the time2
!1 7ver the 42-minute +eriod 9a5er .as !usy 7'2"7D o$ the time2 (he seniority rule
5ee+s 9a5er less !usy /and gives *!le more ti+s12
&ine o$ the 20 arrivals i2e2 4"D had to .ait2
(he average .aiting time $or all ustomers .as a!out 122 minutes /72 seonds12
(he average .aiting time $or ustomers .ho had .ait is 3 minutes2
Conclusions.
In summary3 this system seems .ell !alaned2 7ne server annot handle all the diners3
and three servers .ould +ro!a!ly !e too many2 *dding an additional server .ould surely
-10-
redue the .aiting time2 Eo.ever3 the ost o$ .aiting .ould have to !e -uite high to
,usti$y an additional server2
Practical-0$
Inventory System
Write a C/C++/Excel Program to simulate an 4n'entor# S#stem.
-8The Ne%spaper Seller9s Pro"lem:,.
!or C/C++ Programming use the li"rar# $unctions to generate the n-igite ranom
num"ers.
!or Excel use the in-"uilt $unction to generate the n-igite ranom num"ers.
/i'en.
Distri"ution o$ Ne%spapers Demane
Deman Pro"a"ilit# Distri"ution
Deman /oo !air Poor
6* *.*5 *.2* *.66
;* *.*; *.2< *.))
=* *.2; *.6* *.2=
>* *.)* *.)* *.2)
<* *.5; *.*< *.*=
?* *.2; *.*6 *.**
2** *.*> *.** *.**
@anom igit assignment $or T#pe o$ Ne%sa#
*e+t the +ro!a!ilities $or the three ty+e o$ ne.s daysC #ood3 6air and =oor2
Prepare the simulation ta"le $or Purchase o$ >* ne%spapers an $in out the total
pro$it.
Total Pro$it ( -re'enue $rom sales, A -cost o$ ne%spapers, A
-lost pro$it $rom excess eman, + -sal'age $rom sale o$ scrap papers,
Theor#. *n im+ortant lass o$ simulation +ro!lems involves inventory systems2 (he total
ost/or total +ro$it1 o$ an inventory system is the measure o$ +er$ormane2
In the $ollo.ing e<am+le $or deiding ho. many ne.s+a+er to !uy3 only a single
time +eriod s+ei$ies length is relevant3 and only a single +rourement is made2 Inventory
remaining at the end o$ the single time +eriod is sold $or sar+ or disarded2
Example: The News Dealers Problem
* lassial inventory +ro!lem onerns the +urhase and sales o$ ne.s+a+ers2 (he
ne.sstand !uys the +a+ers $or 33 ents eah and sells them $or "0 ents eah2
&e.s+a+ers not sold at the end o$ the day are sold as sra+ $or " dents eah2 &e.s+a+ers
-11-
not sold at the end o$ the are sold as sra+ $or " ents eah2 &e. +a+ers an !e +urhased
in !undles o$ 102 (hus3 the ne.sstand an !uy "03 603 and so on2 (here are three ty+es o$
&e.sdayC FgoodGH F$airGH and F+oorGH they have the +ro!a!ilities 023"3 024"3 and 02203
res+etively2 (he distri!ution o$ ne.s+a+er demanded on eah o$ these days is given in
$ollo.ing (a!le
/i'en Data.
Distri"ution o$ Ne%spapers Demane .
(he +ro!lem is to om+ute the o+timal num!er o$ +a+ers the ne.sstand should +urhase2
(his .ill !e aom+lished simulation demands $or 20 days and reording +ro$its $rom
sales eah day2
(he +ro$its are given !y the $ollo.ing relationshi+C
Total Pro$it ( -re'enue $rom sales, A -cost o$ ne%spapers, A -Bost pro$it $rom excess
eman, + -sal'age $rom sale o$ scrap papers,
6ollo.ing ta!le +rovide the random digit assignments $or the ty+es o$ ne.sday4s and the
demands $or those ne.sdays2
@anom-Digit &ssignment $or T#pe o$ Ne%sa#.
(y+e o$ &e.sday
(y+e =ro!a!ility
Cumulative
=ro!a!ility
#ood 023" 023"
6air 024" 02'0
=oor 0220 1200
Demand =ro!a!ility Distri!ution
Demand #ood 6air =oor
40 0203 0210 0244
"0 020" 021' 0222
60 021" 0240 0216
70 0220 0220 0212
'0 023" 020' 0206
)0 021" 0204 0200
100 0207 0200 0200
-12-
@anom-Digit &ssignment $or Ne%spapers Demane.
Distri!ution o$ &e.s+a+ers Demanded
Demand
Demand =ro!a!ilities Cumulative =ro!a!ilities
#ood 6air =oor #ood 6air =oor
40 0203 0210 0244 0203 0210 0244
"0 020" 021' 0222 020' 022' 0266
60 021" 0240 0216 0223 026' 02'2
70 0220 0220 0212 0243 02'' 02)4
'0 023" 020' 0206 027' 02)6 1200
)0 021" 0204 0200 02)3 1200 1200
100 0207 0200 0200 1200 1200 1200
(o solve this +ro!lem !y simulation re-uires setting a +oliy o$ !uying a ertain num!er
o$ +a+ers eah day3 then simulating the demands $or +a+ers over the 20-day time +eriod
to determine the total +ro$it2 (he +oliy/num!er o$ ne.s+a+er +urhased1 is hanged to
other values and the simulation re+eated until the !est value is $ound2
/i'en Data.
=urhase =rie I0233
Selling =rie I02"0
Sra+ 8alue I020"
&um!er =urhased !y &e.s Dealer 70
BA Co!e"
To insert the Visual Basic Code Tools : Macro : Visual Basic Editor
Mo!ule"
Otion E!licit
"i# lCountCalls $s %on&
'unction "iscrete()ro* $s +an&e, Value $s +an&e-
"i# l+o.%ast, ro. $s %on&
"i# /er%i#it $s "ou*le, / $s 0in&le
/ 1 +nd(-
l+o.%ast 1 )ro*.+o.s.Count
'or ro. 1 1 To l+o.%ast
/er%i#it 1 )ro*.Cells(ro., 1-.Value
23 / 41 /er%i#it Then
lCountCalls 1 lCountCalls 5 1
"iscrete 1 Value.Cells(ro., 1-.Value
E!it 'unction
End 23
6e!t ro.
-13-
"iscrete 1 0
End 'unction
S#eet1"
)ri7ate 0u* +unTrial8Clic9(-
0heet1.Calculate
End 0u*
The simulation ta"le $or the ecision to purchase >* ne%spaper.
Day
Type of
Newsday Demand
Revenue
from
Sales
Lost
rof!t
from
E"#ess
Demand
Salva$e
from Sale
of S#rap
Da!ly
%ost
Da!ly
rof!t
! 0air )" 1&"+"" 1"+"" 1"+(" 1$&+!" 1*+#"
$ 0air )" 1&"+"" 1"+"" 1"+(" 1$&+!" 1*+#"
& 2ood *" 1&(+"" 1"+"" 1"+"" 1$&+!" 1!!+'"
# 0air #" 1$"+"" 1"+"" 1!+(" 1$&+!" 31!+)"
( 0air #" 1$"+"" 1"+"" 1!+(" 1$&+!" 31!+)"
) 0air )" 1&"+"" 1"+"" 1"+(" 1$&+!" 1*+#"
* 0air %" 1&(+"" 1!+*" 1"+"" 1$&+!" 1!"+$"
% 0air %" 1&(+"" 1!+*" 1"+"" 1$&+!" 1!"+$"
' ,oor #" 1$"+"" 1"+"" 1!+(" 1$&+!" 31!+)"
!" ,oor )" 1&"+"" 1"+"" 1"+(" 1$&+!" 1*+#"
!! 0air %" 1&(+"" 1!+*" 1"+"" 1$&+!" 1!"+$"
!$ ,oor #" 1$"+"" 1"+"" 1!+(" 1$&+!" 31!+)"
!& 2ood !"" 1&(+"" 1(+!" 1"+"" 1$&+!" 1)+%"
!# 0air *" 1&(+"" 1"+"" 1"+"" 1$&+!" 1!!+'"
!( 0air #" 1$"+"" 1"+"" 1!+(" 1$&+!" 31!+)"
!) 2ood )" 1&"+"" 1"+"" 1"+(" 1$&+!" 1*+#"
!* 0air )" 1&"+"" 1"+"" 1"+(" 1$&+!" 1*+#"
!% 2ood *" 1&(+"" 1"+"" 1"+"" 1$&+!" 1!!+'"
!' 0air *" 1&(+"" 1"+"" 1"+"" 1$&+!" 1!!+'"
$" 0air (" 1$(+"" 1"+"" 1!+"" 1$&+!" 1$+'"
TOTAL RO&IT ' 1!$#+&"
-14-
Practical-0%
Disrete Distri!ution
Theor#. Discrete Distri"utions
Disrete random varia!les are used to desri!e random +henomena in .hih only
integer values an our2 6our distri!utions are desri!ed in the $ollo.ing su!setions2

6.2 1ernoulli Distri"ution
Write a C/C++/Excel Program to $in the Pro"a"ilit# Mass !unction -pm$, p-C,D
mean E-C, an 0ariance 0-C,D $or the Bernoulli distribution. &ccept the
pro"a"ilit# o$ success pD the pro"a"ilit# o$ $ailure +D no. o$ trials n $rom the user an
ispla# the 'alue o$ pm$.
Theor#.
(he n 9ernoulli trials are alled a 9ernoulli +roess i$ the trials are inde+endent3 eah trial
has only t.o +ossi!le outome /suess /+1 J $ailure /-113 and the +ro!a!ility o$ suess
remains onstant $rom trial to trial2 (hus3

+
( ) #
@

'



other.ise 0
13222222n , 03 < - + 1
1323222n , 13 < +
,
,


( )
( ) +1 +/1 < 8 8ariane
+ < ; Mean

&lgorithm.
1egin
11 ;nter n !ernoulli trials2
-1"-
21 ;nter trial no2 to he5 the +ro!a!ility at2
31 ;nter the +ro!a!ility o$ suess2
41 #enerate random se-uene <KiL2
"1 i$ <KiL@1
+m$@+
else i$ <KiL@0
+m$@-
else
+m$@0
61 Mean ;/<1 @ +
71 8ariane 8/<1 @ +/1-+1
En
6.) 1inomial Distri"ution
Write a C/C++/Excel Program to $in the Pro"a"ilit# Mass !unction -pm$, p-C,D
mean E-C, an 0ariance 0-C,D $or the Binomial Distribution. &ccept the
pro"a"ilit# o$ success pD the pro"a"ilit# o$ $ailure +D no. o$ trials n $rom the user an
ispla# the 'alue o$ pm$.
Theor#. (he random varia!le M that denotes the num!er o$ suess in n 9ernoulli (rial has
a !inomial distri!ution given !y +
( ) #
.here3
+
( )
( )

'

,
_

other.ise 0
222222n 13 03 < 3
< n
-
<
+
<
n
<
Nhere3
<1O /n <O
nO
<
n

,
_

-16-
Mean ;
( ) n+ <
8ariane 8
( ) n+- <

&lgorithm.
1egin
11 ;nter the num!er o$ trials3 n
21 ;nter the suess in the trials3 <
31 ;nter the +ro!a!ility in the +roess3 +
41 -@1-+
"1 ans@PnP@ nOQ<O/n-<1O
P<P
61 +m$@+/<1@ansR+o./+3<1+o./-3n-<11
71 mean ;/<1@ nR+
'1 variane 8/<1 @ nR+R-
En
6.5 /eometric Distri"ution
Write a C/C++/Excel Program to $in the Pro"a"ilit# Mass !unction -pm$, p-C,D
mean E-C, an 0ariance 0-C,D $or the Geometric Distribution . &ccept the
pro"a"ilit# o$ success pD the pro"a"ilit# o$ $ailure +D no. o$ trials to achie'e the $irst
success is x $rom the user an ispla# the 'alue o$ pm$.
Theor#. (he geometri distri!ution is related to a se-uene o$ 9ernoulli trialsC the random
varia!le o$ interest3 M3 is de$ine to !e the num!er o$ trials to ahieve the $irst suess2 (he
distri!ution o$ M is given !y3
+
( )

'

other.ise 0
22 1323332222 < +3
1 <
-
<
-17-
Mean ;
( )
+
1
<
8ariane 8
( )
2
+
-
<
&lgorithm.
1egin
11 ;nter num!er o$ trials2
21 ;nter the trials to ahieve $irst suess2
31 ;nter the +ro!a!ility o$ suess2
41 ;valuate -@1-+2
"1 +m$@ +/<1 @ +o./-3<-11R+ $or <@132332222n
@ 0 other.ise
61 Mean ;/<1@1Q+
71 8ariane 8/<1 @-Q+R+
En
%&% Poisson Distribution
Write a C/C++/Excel Program to $in the Pro"a"ilit# Mass !unction -pm$, p-C, $or
the Poisson Distribution. &ccept the mean an 'ariance $rom the user an ispla# the
'alue o$ pm$ &lso $in the cumulati'e Poisson istri"ution ta"le.
Theor#. (he =oisson mass $untion is given !y3
-1'-
+
( )

'

other.ise 0
2 0313222222 <
<O
<
S
S
e
<
Mean ;
( ) ( ) < 8 S <
8ariane
(he umulative distri!ution is given !y /d$1
6( )

<
0 i iO
i
S
S
e
<
&lgorithm.
1egin
11 ;nter total num!er o$ trials2
21 ;nter the trial no2 at .hih the +ro!a!ility needs to !e he5ed2
31 ;nter the mean /

12
41 i$ al+ha T 0
i$ < 0 JJ < n
+m$ @+/<1@
O #
e
#


else
+m$@0
else
al+ha is invalid
"1 Cumulative Distri!utionC
6or i@0 to <
6/<1 @e<+o /-al+ha1R+o./al+ha3i1QiO
61 Mean ;/<1 @ 8ariane 8/<1@al+ha
En
-1)-
Coe.
UinludeAstdio2hT
UinludeAonio2hT
UinludeAmath2hT
UinludeAstdli!2hT
void 9ernoulliBDistri!ution/1H
void 9inomialBDistri!ution/1H
void #eometriBDistri!ution/1H
void =oissonBDistri!ution/1H
long $loat $at/int1H
void main/1
V
int hoie3$lag@1H
lrsr/1H
.hile/$lag@@11
V
+rint$/WXnXnXt 1C9ernoulli Distri!ution2W1H
+rint$/WXnXnXt 2C9inomial Distri!ution2W1H
+rint$/WXnXnXt 3C#eometri Distri!ution2W1H
+rint$/WXnXnXt 4C=oisson Distri!ution2W1H
+rint$/WXnXnXt ;nter (he Choie 7$ Distri!ution C W1H
san$/WDdW3Jhoie1H
$lag@0H
s.ith/hoie1
V
ase 1Clrsr/1H
$lag@1H
+rint$/WXtXtXtXt9;%&7?>>I DIS(%I9?(I7&XnXnW1H
9ernoulliBDistri!ution/1H
!rea5H
ase 2Clrsr/1H
$lag@1H
+rint$/WXtXtXtXt9I&7MI*> DIS(%I9?(I7&XnXnW1H
9inomialBDistri!ution/1H
!rea5H
ase 3Clrsr/1H
$lag@1H
+rint$/WXtXtXtXt#;7M;(%IC DIS(%I9?(I7&XnXnW1H
#eometriBDistri!ution/1H
!rea5H
ase 4Clrsr/1H
$lag@1H
+rint$/WXtXtXtXt=7ISS7& DIS(%I9?(I7&XnXnW1H
=oissonBDistri!ution/1H
!rea5H
-20-
De$aultC
+rint$/WXn You have entered .rong hioe2W1H
$lag@0H
e<it/01H
Z
Z
Z
void 9ernoulliBDistri!ution/1
V
$loat +3-3<K100L3+m$3aH
int i3n3,H
+rint$/WXn ;nter (he (otal num!er o$ (rials/n1 C W1H
san$/WDdW3Jn1H
+rint$/WXn ;nter the +ro!a!ility o$ suess in the e<+eriment /+1 C W1H
san$/WD$W3J+1H
-@1-+H
+rint$/WXnXn (he =ro!a!ility o$ $ailure is /-1 C D$W3-1H
randomi[e/1H
+rint$/WXnXn Dd (rials are C XnXnW3n1H
$or/i@0HiAnH\\i1
V
a@random/101H
i$/<KaL@@11
<KiL@aH
else
<KiL@aR0201H
+rint$/WD$XtW3<KiL1H
Z
+rint$/WXnXn ;nter the (rial num!er3.hih you .ant to he5 the +m$ C W1H
san$/WDdW3J,1H
i$/<K,L@@11
+m$@+H
else i$/<K,L@@01
+m$@-H
else
+m$@0H
+rint$/WXnXn %;S?>( CW1H
+rint$/WXnXn (he =M6 is C D$W3+m$1H
+rint$/WXnXn (he mean o$ the (rial is K;/<1L C D$W3+1H
+rint$/WXnXn (he 8ariane o$ the (rial is K8/<1L C D$W3/+R-11H
Z
void 9inomialBDistri!ution/1
V
$loat +3-H
-21-
int i3n3<H
long $loat ans3+m$@0H
+rint$/WXnXn;nter (he &um!er o$ (rial in ;<+eriments /n1 C W1H
san$/WDdW3Jn1H
+rint$/WXnXn ;nter (he num!er to he5 the =ro!a!ility $or /<1 C W1H
san$/WDdW3J<1H
+rint$/WXnXn ;nter (he =ro!a!ility o$ suess in the e<+eriment /+1 C W1H
san$/WD$W3J+1H
-@1-+H
+rint$/WXnXn(he =ro!a!ility o$ $ailure in the e<+eriment is /-1 C D$W3-1H
$or/i@0HiA@<H\\i1
V
i$/i@@01
ans@1H
else
ans@/long $loat1/$at/n1Q/$at/i1R$at/n-i111H
QQ+rint$/WXn ans C Dl$W3ans1H
+m$@+m$\/long $loat1//ans1R/+o./+3i11R/+o./-3/n-i1111H
Z
+rint$/WXnXn %;S?>( CW1H
+rint$/WXnXn (he =M6 is C Dl$W3+m$1H
+rint$/WXnXn (he mean o$ the (rial is K;/<1L C D$W3nR+1H
+rint$/WXnXn (he 8ariane o$ the (rial is K8/<1L C D$W3/nR+R-11H
Z
void #eometriBDistri!ution/1
V
$loat +3-3+m$H
int i3n3<H
+rint$/WXnXn ;nter (he &um!er o$ trial to get $irst suess in ;<+eriments C W1H
san$/WDdW3J<1H
+rint$/WXnXn ;nter (he =ro!a!ility o$ Suess in (he e<+eriments/+1 C W1H
san$/WD$W3J+1H
-@1-+H
+rint$/WXnXn (he =ro!a!ility o$ $ailure is C D$W3-1H
i$/<T@11
+m$@/$loat1/+o./-3<-11R+1H
else
+m$@0H
+rint$/WXnXn %;S?>( CW1H
+rint$/WXnXn (he =M6 is C D$W3+m$1H
+rint$/WXnXn (he mean o$ the (rial is K;/<1L C D$W3/1Q+11H
+rint$/WXnXn (he 8ariane o$ the (rial is K8/<1L C D$W3/-Q/+R+111H
Z
void =oissonBDistri!ution/1
-22-
V
long $loat +m$3d$@03$at<3e<+o3al+ha+o.3$ati3al+haiH
$loat al+haH
int i3<H
+rint$/WXnXn ;nter (he (rial you .ant to he5 $or /<1 C W1H
san$/WDdW3J<1H
+rint$/WXnXn ;nter (he mean $or the trial /al+ha1 C W1H
san$/WD$W3Jal+ha1H
i$/<T@0 JJ al+haT01
V
$at<@$at/<1H
e<+o@e<+/-/al+ha11H
al+ha+o.@+o./al+ha3<1H
+m$@///e<+o1R/al+ha+o.11Q$at<1H
+rint$/WXnXn=M6 is D23l$W3+m$1H
$or/i@0HiA@<H\\i1
V
$ati@$at/i1H
al+hai@+o./al+ha3i1H
d$@d$\///e<+o1R/al+hai11Q$ati1H
Z
+rint$/WXnXn CD6 is C Dl$W3d$1H
Z
else
+m$@0H
+rint$/WXnXn (he mean and variane o$ =oisson Distri!ution is C D$W3al+ha1H
Z
long $loat $at/int n1
V
int iH
long $loat $@1H
$or/i@1HiA@nH\\i1
V
$@$RiH
Z
return/$1H
Z
-23-
7utput.
QR
O-----------------------------------------------------------------------------------------O
DISC%;;( DIS(%I9?(I7&
1C9ernoulli Distri!ution2
2C9inomial Distri!ution2
3C#eometri Distri!ution2
4C=oisson Distri!ution2
;nter (he Choie 7$ Distri!ution C1
1E@N7EBB4 D4ST@41ET47N


;nter (he (otal num!er o$ (rials/n1 C 20

;nter the +ro!a!ility o$ suess in the e<+eriment /+1 C 0204


(he =ro!a!ility o$ $ailure is /-1 C 02)60000

20 (rials are C

020)0000 020"0000 020"0000 020)0000 02010000
02070000 02030000 02010000 02060000 02000000
02040000 02070000 02070000 02000000 02070000
02030000 020"0000 02060000 02000000 02010000


;nter the (rial num!er3.hih you .ant to he5 the +m$ C )


%;S?>( C

(he =M6 is C 02)60000

(he mean o$ the (rial is K;/<1L C 02040000

(he 8ariane o$ the (rial is K8/<1L C 0203'400

1C9ernoulli Distri!ution2
2C9inomial Distri!ution2
3C#eometri Distri!ution2
-24-
4C=oisson Distri!ution2
;nter (he Choie 7$ Distri!ution C2
14N7M4&B D4ST@41ET47N



;nter (he &um!er o$ (rial in ;<+eriments /n1 C "0


;nter (he num!er to he5 the =ro!a!ility $or /<1 C 2


;nter (he =ro!a!ility o$ suess in the e<+eriment /+1 C 0202


(he =ro!a!ility o$ $ailure in the e<+eriment is /-1 C 02)'0000

%;S?>( C

(he =M6 is C 02)21"73

(he mean o$ the (rial is K;/<1L C 12000000

(he 8ariane o$ the (rial is K8/<1L C 02)'0000

1C9ernoulli Distri!ution2

2C9inomial Distri!ution2

3C#eometri Distri!ution2

4C=oisson Distri!ution2
;nter (he Choie 7$ Distri!ution C 3
/E7MET@4C D4ST@41ET47N



;nter (he &um!er o$ trial to get $irst suess in ;<+eriments C 3


;nter (he =ro!a!ility o$ Suess in (he e<+eriments/+1 C 026


(he =ro!a!ility o$ $ailure is C 02400000

%;S?>( C

(he =M6 is C 020)6000

-2"-
(he mean o$ the (rial is K;/<1L C 12666667

(he 8ariane o$ the (rial is K8/<1L C 12111111

1C9ernoulli Distri!ution2

2C9inomial Distri!ution2

3C#eometri Distri!ution2

4C=oisson Distri!ution2

;nter (he Choie 7$ Distri!ution C 4
/E7MET@4C D4ST@41ET47N



;nter (he &um!er o$ trial to get $irst suess in ;<+eriments C 3


;nter (he =ro!a!ility o$ Suess in (he e<+eriments/+1 C 026


(he =ro!a!ility o$ $ailure is C 02400000
%;S?>( C
(he =M6 is C 020)6000
(he mean o$ the (rial is K;/<1L C 12666667
(he 8ariane o$ the (rial is K8/<1L C 12111111
1C9ernoulli Distri!ution2
2C9inomial Distri!ution2
3C#eometri Distri!ution2
4C=oisson Distri!ution2
;nter (he Choie 7$ Distri!ution C 0
RQ
-26-
Practical-0'
Continuous Distri"utions
Theor#. Continuous Distri"utions.
Continuous random varia!les an !e used to desri!e random +henomena
in .hih the varia!le o$ interest an ta5e on any value in some interval2 Seven
distri!utions are desri!ed in $ollo.ing su!setions2
;.2 Eni$orm Distri"ution.
Nrite a CQC\\Q;<el =rogram to $ind =ro!a!ility Distri!ution 6untion /+d$1 and
Cumulative Distri!ution 6untion /d$1 $or ?ni$orm Distri!ution *e+t the +arameters a
and ! $rom the user $or the random varia!le M .hih is distri!uted uni$ormly !et.een a
and !2
Theor#. * random varia!le M is uni$ormly distri!uted on the interval /a3!1 i$ its +d$ is
given !y 3and d$ is given !y
f ( )

'

other.ise 03
! < a 3
a !
1
<
$( )

'

<

<

! < 13
! < a
a !
a <
a < 0
<
(he Mean and the variane is givne !y
;
( )
2
! a
<
+

8( )
12
2
a1 /!
<

-27-
;.) Exponential Distri"ution
Nrite a CQC\\Q;<el =rogram to $ind =ro!a!ility Distri!ution 6untion /+d$1 and
umulative Distri!ution 6untion /d$1 $or ;<+onential Distri!ution2 *e+t $rom the
user the +arameter o$ distri!ution T 02
Theor#. * random varia!le M is said to e<+onentially distri!uted .ith +arameter T0
J its +d$ J d$ is given !y
$
( )

'

other.ise 03
0 <
< ]
e ]
<
6
( )

'

<

0 <
]<
e 1
0 < 03
<
(he Mean J 8ariane given !y
;
( )
]
1
<
8
( )
2
]
1
<
-2'-
;.5 Erlang Distri"ution
Nrite a CQC\\Q;<el =rogram to $ind =ro!a!ility Distri!ution 6untion /+d$1 and
umulative Distri!ution 6untion /d$1 $or ;rlang Distri!ution *e+t the order 5
/Nhen @ 51 o$ the distri!ution and the +arameter 5 $rom the user2
Theor#. (he +d$ given !elo. is o$ten re$erred to as ;rlang distri!ution o$ order 5 .hen
@ 53 an integer2 (he mean J variane o$ gamma variane3 are valid regardless o$ value
o$ 2 (he e<+eted value o$ the sum o$ the random3 varia!le is the sum o$ the e<+eted
value o$ eah random varia!le2 (hus3
( ) ( ) ( ) ( ) ( )
^
M 22; 2222222222
3
M ;
2
M ;
1
M ; M ; + + +
(he e<+eted value o$ the e<+onentially distri!uted M % are eah given !y 1Q52 (hus3
( )
_
1
5_
1
22 2222222222
5_
1
5_
1
M ; + + +
I$ the random varia!le M % are inde+endent3 the variane o$ their sum is the sum o$ the
variane3 or
( )
2
5_
1
2
/5_5
1
22222222
2
/5_5
1
2
/5_5
1
M 8 + +
Nhen @ 53 a +ositive integer3 the d$ is given !y
( )
( )

'

>

0 < 03
0 < 3
iO
i
1 5
o i
5__
5_
e
1
< 6
-2)-
;.6 Normal Distri"ution.
Nrite a CQC\\Q;<el =rogram to $ind =ro!a!ility Distri!ution 6untion /+d$1 and
Cumulative Distri!ution 6untion /d$1 $or Normal "istribution *e+t mean 3 variane
2

and the trans$ormation varia!le [ @ t - Q 2
Theor#. * random varia!le M .ith mean /
< < #
1 and the variane
2
T 0
has a normal distri!ution i$ has a +d$
( ) 3
2
`
a <
2
1
e<+
2b `
1
< $
1
1
]
1

,
_


< < <
&lgorithm.
1egin
11 %ead the randon varia!le <3mean3variane2
21 i$ variane T 0
sigma@s-rt/variane1
+d$@/1Q/sigmaRs-rt/2R32142111Re<+//-1Q21R/+o.//<-
mean1Qsigma32111H
&ote C Its not +ossi!le to evaluate d$ in lose $orm
En
-30-
;.; Wei"ull Distri"ution
Nrite a CQC\\Q;<el =rogram to $ind =ro!a!ility Distri!ution 6untion /+d$1 and umulative
Distri!ution 6untion /d$1 $or Nei!ull Distri!ution *e+t $or a random varia!le M .ith the
loation +arameter 3 sale +arameter T 03 and the sha+e +arameter T 0 $rom the user2
Theor#. (he random varia!le M has a .ei!ull distri!ution i$ its +d$ has the $orm
( )

'

1
1
]
1

,
_

,
_

other.ise 03
v < 3
c
S
v <
e<+
1 c
S
v <
S
c
< $
(he three +arameters o$ the .ei!ull distri!ution are
12 v /
< < v
1 the loation +arameterH
22 / T 01 the sale +arameter2
32 / T 01 - the sha+e +arameter2
Nhen the v@03 Nei!ull distri!ution !eomes
( )

'

1
1
]
1

,
_

,
_

other&ise
#
# #
# f
3 0
0 3 e<+
1

Nhen v @ 0 and @ 12 >etting @ 1 the Nei!ull Distri!ution are given !y the $ollo.ing
e<+ression2
-31-
( )

'

other.ise 0
0 <
S
<
e
S
1
< $
(he mean J variane o$ the Nei!ull are given !y the $ollo.ing e<+ression C

( )

,
_

+ + 1
c
1
d S v < ;

( )
1
1
]
1

1
]
1

,
_

,
_

+ +
2
1
c
1
d 1
c
2
d
2
S < 8
Nhere

( ) ( )O 1 c c d
&lgorithm.
1egin
11 %ead the random varia!le <2
21 %ead the loation +arameter v2
31 %ead the sale +arameter al+ha
41 %ead the sha+e +arameter !eta2
"1 i$ al+ha T0 JJ !eta T0
i$ < T v PP v@@0
+d$@/!etaQal+ha1R/+o.//<-v1Qal+ha3!eta-11Re<+/+o./-//<-
v1Qal+ha13!eta111H
else
i$ v @@ 0 JJ al+ha @@ 1 JJ < T@ 0
+d$@/1Qal+ha1Re<+/-/<Qal+ha11H
else
+d$@0
i$ < T@ v
d$@1-e<+/-/+o.//<-v1Qal+ha3!eta111H
else
d$@0
En
;.= Triangular Distri"ution
Nrite a CQC\\Q;<el =rogram to $ind =ro!a!ility Distri!ution 6untion /+d$1 and
Cumulative Distri!ution 6untion /d$1 $or (riangular Distri!ution *e+t +arameters a3!3
.here a ! $rom the user2
-32-
Theor#. & random varia!le M has a triangular distri!ution i$ its +d$ is given !y
( )
( )
( ) ( )
( )
( ) ( )

'

<

else.here 0
< ! 3
a !
< 2
! < a 3
a a !
a < 2
< $
(he mode ours at < @ !2 (he +arameters / a3 !3 1 an !e related2 (he d$ is given !y
( )
( )
( ) ( )
( )
( ) ( )

'

>
<

<

< 13
< !
a !
2
<
1
! < a
a a !
2
a <
a < 0
< 6
(he mean
( )
3
! a
< ;
+ +

;.> Bognormal Distri"ution


Nrite a CQC\\Q;<el =rogram to $ind =ro!a!ility Distri!ution 6untion /+d$1 and
Cumulative Distri!ution 6untion /d$1 $or >ognormal Distri!ution *e+t +arameters mean
and variane
2
$rom the user2
Theor#. * random varia!le M has a >ognormal Distri!ution i$ its +d$ is given !y
-33-
( )
( )

'

1
1
]
1

>

other.ise 03
0 < 3
2
` 2
2
a < ln
e<+
< ` 2b
1
< $
Nhere
2
T 02 (he mean and variane o$ lognormal random varia!le are
( )
Q2
2
` a
e < ;
+

( ) 11
2
`
/e
2
` a 2
e < 8
+

(he +arameters
2
J ome $rom the $at that .hen ' has N (
2
3 ) distri!ution3
then M @ e
Y
has a lognormal distri!ution .ith +arametes
2
J 2 I$ the mean J
variane o$ the lognormal are 5no. to !e
2
J
* *
3 res+etively3 then the +arameters
2
J are given !y

,
_

2
>
`
2
>
a
2
>
a
ln a

,
_

2
>
a
2
>
`
2
>
a
ln `
Coe.
UinludeAstdio2hT
UinludeAonio2hT
UinludeAmath2hT
UinludeAstdli!2hT
void uni$ormBdistri!ution/1H
void e<+onentialBdistri!ution/1H
void .ei!ullBdistri!ution/1H
void erlangBdistri!ution/1H
void normalBdistri!ution/1H
void triangularBdistri!ution/1H
void lognormalBdistri!ution/1H
long $at/int1H
void main/1
V
int hoie3$lag@1H
lrsr/1H
.hile/$lag@@11
V
+rint$/WXnXtXtXt Continuous Distri!ution2W1H
-34-
+rint$/WXnXn12 ?ni$orm Distri!ution2W1H
+rint$/WXn22 ;<+onential Distri!ution2W1H
+rint$/WXn32 ;rlang Distri!ution2W1H
+rint$/WXn42 &ormal Distri!ution2W1H
+rint$/WXn"2 Nei!ull Distri!ution2W1H
+rint$/WXn62 (riangular Distri!ution2W1H
+rint$/WXn72 >ognormal Distri!ution2W1H
+rint$/WXnXnXnSelet *ny 7ne 7$ (he 7+tions C W1H
san$/WDdW3Jhoie1H
$lag@0H
Z
s.ith/hoie1
V
ase 1C
lrsr/1H
uni$ormBdistri!ution/1H
!rea5H
ase 2C
lrsr/1H
e<+onentialBdistri!ution/1H
!rea5H
ase 3C
lrsr/1H
erlangBdistri!ution/1H
!rea5H
ase 4C
lrsr/1H
normalBdistri!ution/1H
!rea5H
ase "C
lrsr/1H
.ei!ullBdistri!ution/1H
!rea5H
ase 6C
lrsr/1H
triangularBdistri!ution/1H
!rea5H
ase 7C
lrsr/1H
lognormalBdistri!ution/1H
!rea5H
de$aultC
!rea5H
Z
geth/1H
Z
void uni$ormBdistri!ution/1
V
$loat a3!3<3+d$3d$3mean3varianeH
$loat $K10LH
-3"-
+rint$/WXtXtXt C7&(I&I7?S DIS(%I9?(I7&W1H
+rint$/WXnXnXtXtXt ?ni$orm Distri!ution W1H
+rint$/WXn;nter a @ W1H
san$/WD$W3Ja1H
+rint$/WXn;nter ! @ W1H
san$/WD$W3J!1H
+rint$/WXn;nter %andom 8aria!le/<1 @ W1H
san$/WD$W3J<1H
i$/aA@< JJ <A@!1
V
+d$@1Q/!-a1H
+rint$/WXn=D6 is D23$2W3+d$1H
Z
else
V
+d$@0H
+rint$/WXn=D6 is D23$2W3+d$1H
Z
i$/<Aa1
V
+rint$/WXnCD6 is 02W1H
Z
else i$/aA@< JJ <A!1
V
d$@/<-a1Q/!-a1H
+rint$/WXnCD6 is D23$2W3d$1H
Z
else i$/<T@!1
V
+rint$/WXnCD6 is 12W1H
Z
mean@/a\!1Q2H
variane@+o.//!-a1321Q12H
+rint$/WXnXnMean ;/<1 @ D23$2W3mean1H
+rint$/WXn8ariane 8/<1 @ D23$2W3variane1H
geth/1H
Z
void e<+onentialBdistri!ution/1
V
$loat lam!da3<3+d$3d$3mean3varianeH
+rint$/WXtXtXt C7&(I&I7?S DIS(%I9?(I7&W1H
+rint$/WXnXnXtXtXt ;<+onential Distri!utionW1H
+rint$/WXnXn;nter random varia!le/<1 @ W1H
san$/WD$W3J<1H
+rint$/WXn;nter +arameter/lam!da1 @ W1H
san$/WD$W3Jlam!da1H
i$/lam!da A 01
V
+rint$/WXn;rror C lamda should !e greater than 0W1H
e<it/01H
-36-
Z
else
V
i$/<T@01
V
+d$@lam!daR/e<+/-lam!daR<11H
+rint$/WXn=D6 is D23$W3+d$1H
d$@1-/e<+/-lam!daR<11H
+rint$/WXnCD6 is D23$W3d$1H
Z
else
V
<@0H
+rint$/WXn =D6 is 0W1H
+rint$/WXn CD6 is 0W1H
Z
Z
mean@1Qlam!daH
variane@1Q+o./lam!da321H
+rint$/WXnXnMean ;/<1 @ D$W3mean1H
+rint$/WXn8ariane 8/<1 @ D$W3variane1H
geth/1H
Z
void erlangBdistri!ution/1 QQhas only d$ no +d$
V
$loat theta353d$3sum3<3mean3varianeH
int i3$lag@0H
+rint$/WXtXtXt C7&(I&I7?S DIS(%I9?(I7&W1H
+rint$/WXnXnXtXtXt ;rlang Distri!utionW1H
+rint$/WXnXn;nter the Sha+e +arameter/9eta1@ W1H
san$/WD$W3J51H
.hile/$lag@@01
V
i$/ 5 A@ 01
V
+rint$/WXn;rror C 9eta should !e greater than [ero2W1H
$lag@0H
Z
else
$lag@1H
Z
+rint$/WXn;nter the sale +arameter/theta1@ W1H
san$/WD$W3Jtheta1H
+rint$/WXn;nter the random varia!le/<1 @ W1H
san$/WD$W3J<1H
i$/<T01
V
$or/i@0HiA5Hi\\1
V
sum@sum\///e<+/-5RthetaR<11R+o./5RthetaR<3i11Q$at/i11H
d$@1-sumH
-37-
Z
+rint$/WXnCD6 @ D24$W3d$1H
Z
else
+rint$/WXnCD6 @ 0W1H
mean@+o./theta3-11H
variane@1Q/5R+o./theta3211H
+rint$/WXnXnMean @ D23$W3mean1H
+rint$/WXn8ariane @ D23$W3variane1H
geth/1H
Z
void normalBdistri!ution/1
V
$loat variane3sigma3mean3<3+d$H
+rint$/WXtXtXt C7&(I&I7?S DIS(%I9?(I7&W1H
+rint$/WXnXnXtXtXt &ormal Distri!utionXnW1H
+rint$/WXn;nter random varia!le/<1@ W1H
san$/WD$W3J<1H
+rint$/WXn;nter the mean@ W1H
san$/WD$W3Jmean1H
+rint$/WXn;nter (he variane/sigmae21@ W1H
san$/WD$W3Jvariane1H
i$/varianeA01
V
+rint$/WXnXn;rror C 8ariane should !e greater than [ero2W1H
e<it/01H
Z
sigma@s-rt/variane1H
+d$@/1Q/sigmaRs-rt/2R32142111Re<+//-1Q21R/+o.//<-mean1Qsigma32111H
+rint$/WXn=D6 is D23$W3+d$1H
+rint$/WXnMean is D23$W3mean1H
+rint$/WXn8ariane is D23$W3variane1H
geth/1H
Z
void .ei!ullBdistri!ution/1
V
$loat <@03al+ha@03!eta@03v@03mean@03variane@03ans@0H
$loat +d$@03d$@03ans1@0H
int $lag@0H
+rint$/WXtXtXt C7&(I&I7?S DIS(%I9?(I7&W1H
+rint$/WXnXnXtXtXt Nei!ull Distri!utionXnW1H
+rint$/WXnXn;nter the random varia!le/<1@ W1H
san$/WD$W3J<1H
.hile/$lag@@01
V
+rint$/WXn;nter the value $or sha+e +aramater/!eta1@ W1H
san$/WD$W3J!eta1H
+rint$/WXn;nter the value $or sale +arameter/al+ha1@ W1H
san$/WD$W3Jal+ha1H
i$/al+haT0 JJ !etaT01
-3'-
$lag@1H
else
V
+rint$/WXn;rror C 8alue o$ al+ha and !eta should !e greater than
[eroW1H
$lag@0H
Z
Z
+rint$/WXn;nter value $or loation +arameter/v1@ W1H
san$/WD$W3Jv1H
i$/<T@v PP v@@01
V
ans1@/<-v1Qal+haH
+d$@/!etaQal+ha1R+o./ans13!eta-11Re<+/+o./-ans13!eta11H
+rint$/WXnXn%esults C W1H
+rint$/WXn=D6 is D23$W3+d$1H
Z
else
i$/v@@0 JJ al+ha@@1 JJ <T@01
V
+d$@/1Qal+ha1Re<+/-/<Qal+ha11H
+rint$/WXnXn%esults CW1H
+rint$/WXn=D6 is D23$W3+d$1H
Z
else
+rint$/WXn=D6 is 02W1H
i$/<T@v1
V
d$@1-e<+/-/+o./ //<-v1Qal+ha13!eta111H
+rint$/WXnCD6 is D23$W3d$1H
Z
else
V
+rint$/WXnCD6 is 0W1H
Z
mean@/$loat1v\/ al+ha R $at/1Q!eta11H
ans@$at/2Q!eta1-+o./$at/1Q!eta1321H
variane@/$loat1+o./al+ha321RansH
+rint$/WXnXnMean ;/M1 @ D20$W3mean1H
+rint$/WXnXn(he variane 8/M1 @ D20$W3variane1H
geth/1H
Z
void triangularBdistri!ution/1
V
$loat a3!33<3d$3+d$3r13mean3var3modeH
int $lag@1H
+rint$/WXtXtXt C7&(I&I7?S DIS(%I9?(I7&W1H
+rint$/WXnXnXtXtXt (riangular Distri!utionW1H
+rint$/WXnXn;nter the random varia!le < CW1H
-3)-
san$/WD$W3J<1H
+rint$/WXn;nter the +arameter values suh that aA@!A@ CW1H
.hile/$lag@@11
V
+rint$/WXn;nter a @ W1H
san$/WD$W3Ja1H
+rint$/WXn;nter ! @ W1H
san$/WD$W3J!1H
+rint$/WXn;nter @ W1H
san$/WD$W3J1H
i$/aA@! JJ !A@1
$lag@0H
else
V
+rint$/WXn;rror C (he values should !e as aA@!A@XnW1H
$lag@1H
Z
Z
i$/aA@< JJ <A@!1
V
+d$@/2R/<-a11Q//!-a1R/-a11H
Z
else
V
i$/!A< JJ <A@1
V
+d$@/2R/-<11Q//-!1R/-a11H
Z
else
+d$@0H
Z
i$/< A@ a1
d$@0H
i$/a A < JJ < A@ !1
V
d$@//<-a1R/<-a11Q//!-a1R/-a11H
Z
i$/! A < JJ < A@ 1
V
d$@ 1 - ///-<1R/-<11Q//-!1R/-a111H
Z
i$/< T 1
V
d$@1H
Z
mean@/a\!\1Q3H
mode@/3Rmean1-/a\1H
+rint$/WXnXn%esults C W1H
+rint$/WXn=D6 is D23$W3+d$1H
+rint$/WXnCD6 is D23$W3d$1H
-40-
+rint$/WXnMean is D23$W3mean1H
+rint$/WXn(he mode is D23$W3mode1H
geth/1H
Z
void lognormalBdistri!ution/1
V
$loat <3mu3sigma3mul3sl3+d$3d$3mean3variane3ans13ans2H
+rint$/WXtXtXt C7&(I&I7?S DIS(%I9?(I7&W1H
+rint$/WXnXnXtXtXt >ognormal Distri!utionW1H
+rint$/WXnXn;nter the random varia!le/<1@ W1H
san$/WD$W3J<1H
+rint$/WXn;nter the value $or /Mue1> @ W1H
san$/WD$W3Jmul1H
+rint$/WXnXn;nter the value $or /Sigma1>e2 @ W1H
san$/WD$W3Jsl1H
mu@log//mulRmul1Q/s-rt//mulRmul1\/sl1111H
sigma@log///mulRmul1\/sl11Q/mulRmul11H
ans1@1Q/s-rt/2R321421 R s-rt/sigma1 R <1H
ans2@e<+/-/+o./log/<1-mu321Q/2R+o./sigma321111H
i$/<T01
V
+d$@ans1Rans2H
Z
else
V
+d$@0H
Z
mean@e<+/mu\//sigmaRsigma1Q211H
variane@e<+//2Rmu1\/sigma11 R /e<+/sigma1-11H
+rint$/WXnXn%esults CW1H
+rint$/WXn=D6 is D23$W3+d$1H
+rint$/WXnCD6 is D23$W3d$1H
+rint$/WXn(he meu is D23$W3mu1H
+rint$/WXn(he sigma is D23$W3sigma1H
+rint$/WXn(he mean is D23$W3mean1H
+rint$/WXn(he variane is D23$W3variane1H
Z
long $at/int num1
V
long $@1H
int iH
$or/i@numHiT@1Hi--1
$@$RiH
return/$1H
Z
7utput .
QR
-41-
C7&(I&I7?S DIS(%I9?(I7&
Eni$orm Distri"ution
;nter a @ 1
;nter ! @ 2
;nter %andom 8aria!le < @ 123
=D6 is 120002
CD6 is 023002
Mean ;/<1 @ 12"002
8ariane 8/<1 @ 020'32
Exponential Distri"ution
;nter < @ 2
;nter +arameter lam!da @ 02333
=D6 is 02171
CD6 is 024'6
Mean ;/<1 @ 32003003
8ariane 8/<1 @ )201'026
Erlang Distri"ution
;nter the Sha+e +arameter 9eta C 3
;nter the Sale +arameter theta @ 020166

;nter the random varia!le < @ "0

CD6 @ 024"36
Mean @ 602241
8ariane @ 120)26"'
Normal Distri"ution

;nter random varia!le < C "6

;nter the mean @ "0

;nter (he variane i2e sigmae2 C)

=D6 is 02133
-42-
Mean is "02000
8ariane is )2000
Wei"ull Distri"ution


;nter the random varia!le < C2000

;nter the value $or sha+e +aramater !eta @ 02333

;nter the value $or sale +arameter al+ha @ 200
;nter value $or loation +arameter v @ 0
%esults C
=D6 is 02000
CD6 is 02''4
Mean ;/M1 @ 1200
(he variane 8/M1 @ 27360000
Triangular Distri"ution

;nter the random varia!le < C22"

;nter the +arameter values suh that aA@!A@ C
;nter a @ 020"

;nter ! @ 121
;nter @ 62"
%esults C
=D6 is 02230
CD6 is 02"41
Mean is 22""0
(he mode is 12100
Bognormal Distri"ution
;nter the random varia!le < @ 2
;nter the value $or /Mue1> @ 20

;nter the value $or /Sigma1> @ 2"


%esults C
=D6 is 02000
-43-
CD6 is 02000
(he meu is 22)6"
(he sigma is 02061
(he mean is 1)243)
(he variane is 2"2000
O---------------------------------------------------------------------------------------O
RQ
Practical-0(
#eneration o$ %andom &um!ers
Write a C/C++/Excel Program to generate @anom Num"ers using.
Binear Congruential Metho. &ccept constant multiplier aD increment cD
moulus m an see Co $rom the user
Com"ine Binear Congruential Metho. &ccept constant multiplier aD
increment cD moulus m an see Co $rom the user @epeat the proceure $or
ne% see 'alue.
Theor#.
@anom Num"er /eneration
%andom num!ers are neessary !asi ingredient in the simulation o$ almost all disrete
system2 Most om+uter languages have a su!routine or $untion that .ill generate a
random num!er2
Techni+ues $or /enerating @anom Num"ers
-44-
=.2 Binear Congruential Metho . (he liner ongruential method +rodues a se-uene o$
random integers
22222 3 3
3 2 1
+ + +
!et.een [ero J m 0 1 aording to the $ollo.ing
reursive relationshi+s
( ) 2 2322222222 13 03 i m3 mod
i
aM
1 i
M +
+
(he initial vale M
o
is alled the seed3 a is alled the onstant multi+lier3 is the inrement3
and m is the modulus2 I$ not e-ual to [ero3 the $orm is alled the mi<ed ongruential
method2 Nhen is e-ual to [ero3 the $orm is alled as multi+liative ongruential method2
&lgorthim.
1egin
12 %ead the onstant multi+lier a3 inremental $ator 3 value o$ modulus m3
seed <03 &um!er o$ random num!ers to !e generated2
22 $or i@0 to n
<Ki\1L@/aR<KiL\1mod m
rKi\1L@/<Ki\1LQm1
&ote C I $ @0 then it is 5no.n as multi+liative ongruential method
i$ O@0 then it is 5no.n as mived ongruential method2
En
=.) Com"ine Congruential Metho. I$ 5 3 i
222222222N 3
2 3 i
N 3
31 i
N
are inde+endent3
disrete-valued random varia!les3 !ut one o$ them say 1 3 i
W
3 is uni$ormly distri!uted on
the integer 1 to m-13 then
1
1
m mod
^
1 ,
, 3 i
N
i
N

,
_

Is uni$ormly distri!uted on the integer 0 to m


1
-22 (he ,th generator is +roduing integer M
% i3
that are a++ro<imately uni$ormly distri!uted on 1 to m % -13 and
1
, 3 i
M ,
3 i
N
is
a++ro<imately uni$ormly distri!uted on 0 to m % -22 (hus the suggested om!ined generator
o$ the $orm
( ) 1
1
m mod
, 3 i
M
5
1 ,
1 ,
1
i
M

,
_

.ith
-4"-
%i @

'

>
0
i
M
1
m
1
1
m
0
i
M
1
m
i
M
Coe .
UinludeAstdio2hT
UinludeAmath2hT
UinludeAonio2hT
UinludeAstdli!2hT
void linearBongruential/1H
void om!inedBlinearBongruential/1H
void main/1
V
int $lag@13hoieH
lrsr/1H
.hile/$lag@@11
V
+rint$/WXnXnXtXtXt %andom &um!er #enerationW1H
+rint$/WXnXn12 >inear Congruential Method2W1H
+rint$/WXn22 Com!ined >inear Congruential Method2W1H
-46-
+rint$/WXnXn;nter your hoie @W1H
san$/WDdW3Jhoie1H
$lag@0H
Z
s.ith/hoie1
V
ase 1C
lrsr/1H
linearBongruential/1H
!rea5H
ase 2C
lrsr/1H
om!inedBlinearBongruential/1H
!rea5H
de$aultC
e<it/01H
Z
geth/1H
Z
void linearBongruential/1
V
int a33m3<K"0L3n3iH
$loat rK"0LH
+rint$/WXnXnXtXtXt %andom &um!er #enerationW1H
+rint$/WXnXnXtXtXt >inear Congruential MethodW1H
+rint$/WXnXnXn;nter the value $or onstant multi+lier a C W1H
san$/WDdW3Ja1H
+rint$/WXn;nter the value $or inrement C W1H
san$/WDdW3J1H
+rint$/WXn;nter the value $or modulus m C W1H
san$/WDdW3Jm1H
+rint$/WXn;nter the value $or seed <0 C W1H
san$/WDdW3J<K0L1H
+rint$/WXnXnEo. many random num!ers do you .ant to !e generated C W1H
san$/WDdW3Jn1H
$or/i@0HiAnHi\\1
V
<Ki\1L@/aR<KiL\1DmH
rKi\1L@/$loat1<Ki\1LQmH
Z
+rint$/WXnXn%andom IntegersXtXt%andom &um!ersXnXnW1H
$or/i@1HiA@nHi\\1
V
+rint$/WDdW3<KiL1H
+rint$/WXtXtXtD023$W3rKiL1H
+rint$/WXnW1H
Z
geth/1H
Z
-47-
void om!inedBlinearBongruential/1
V
long <K20L3<1K20LK20L3mK"L3sum3rg3n3aK"L3i3,3tem+H
dou!le rK20LH
+rint$/WXnXnXtXtXt %andom &um!er #enerationW1H
+rint$/WXnXnXtXt Com!ined >inear Congruential MethodW1H
+rint$/WXnXnXn;nter num!er o$ random no2 generators you .ant @ W1H
san$/WDldW3Jrg1H
+rint$/WXnXn;nter ho. many random num!ers you .ant to generate @ W1H
san$/WDldW3Jn1H
$or /i@0HiArgHi\\1
V
+rint$/WXnXn#enerator Dd CW3i\11H
+rint$/WXnXn;nter the value o$ onstant multi+lier a C W1H
san$/WDldW3JaKiL1H
+rint$/WXn;nter the value o$ modulus m C W1H
san$/WDldW3JmKiL1H
+rint$/WXn;nter the Seed value <0 C W1H
san$/WDldW3J<1KiLK0L1H
Z
+rint$/WXnXn%andom num!ers are C XnXnXnW1H
+rint$/W%andom IntegerW1H
+rint$/WXt%andom &um!erXnXnXnW1H
$or /,@0H,ArgH,\\1
V
$or /i@0HiAnHi\\1
V
<1K,LKi\1L@/aK,LR<1K,LKiL1DmK,LH
Z
Z
$or /i@0HiAnHi\\1
V
sum@0H
$or /,@0H,ArgH,\\1
V
tem+@+o.//-113,1H
sum@sum\//tem+1R/<1K,LKiL11H
Z
<KiL@sumD/mK0L-11H
i$ /<KiLT01
V
rKiL@/dou!le1<KiLQmK0LH
Z
else i$/<KiL@@01
V
rKiL@/dou!le1/mK0L-11QmK0LH
Z
+rint$/WD23ldW3<KiL1H
+rint$/WXtD23l$W3rKiL1H
+rint$/WXnW1H
Z
-4'-
geth/1H
Z
QR
7utput
@anom Num"er /eneration
Binear Congruential Metho

;nter the value $or onstant multi+lier a C 16

;nter the value $or inrement C 21

;nter the value $or modulus m C 100

;nter the value $or seed <0 C1'


Eo. many random num!ers do you .ant to !e generated C "


%andom Integers %andom &um!ers

) 020)0
6" 026"0
61 02610
)7 02)70
73 02730
O-----------------------------------------------------------------------------------------O
Com"ine Binear Congruential Metho
;nter num!er o$ random no2 generators you .ant @ 3
;nter ho. many random num!ers you .ant to generate @ 6
#enerator 1 C

;nter the value o$ onstant multi+lier a C 2"

;nter the value o$ modulus m C 200

;nter the Seed value <0 C 23


#enerator 2 C

;nter the value o$ onstant multi+lier a C 21

-4)-
;nter the value o$ modulus m C "4

;nter the Seed value <0 C 10


#enerator 3 C

;nter the value o$ onstant multi+lier a C "2

;nter the value o$ modulus m C 100

;nter the Seed value <0 C "6


%andom num!ers are C


%andom Integer %andom &um!er


003 0212"
004 02167
004 02167
01' 027"0
004 02167
017 0270'

RQ

Practical-0)
+ andom &um!ers (ests
Write a Menu-ri'en C/C++ Program to test the @anom Num"ers using
!re+uenc# Test
Chi-S+uare Test. &ccept n ranom num"ersD le'el o$ signi$icance D num"er o$
inter'als nD set o$ o"ser'e 'alues an set o$ estimate 'alues.
Folmogoro'-Smirno' Test. &ccept n ranom num"ersD num"er o$ o"ser'ation
ND the set o$ o"ser'ation -@i, %here 4 i N
@uns Test. &ccept n ranom num"ers an le'el o$ signi$icance to reGect or
accept the gi'en set o$ ranom num"ers
@uns up an @uns Do%n Test. &ccept the total num"er o$ runs a to $in the
mean an 'ariance o$ a
-"0-
@uns "elo% an a"o'e mean test. &ccept the num"er o$ ini'iual o"ser'ations
a"o'e an "elo% the mean as N2 an N)D the total num"er o$ runs as " to $in
the mean an 'ariance $or "
&utocorrelation Test. &ccept N ranom num"ersD le'el o$ signi$icance D the lag
mD the starting num"er iD M such that i+-M+2,mH(N
/ap Test. &ccept N ranom num"ers le'el o$ signi$icance D !in the num"er o$
gaps $or all igits occurring in the ranom num"er se+uence
Theor#. Test $or @anom Num"ers
(he desira!le +ro+erties o$ random num!ers are uni$ormity and independence+
>.2 !re+uenc# Test
(his is a test $or he5ing uni$ormity3 here3
- Eo C %i f ?K031L
- E1 C %i f ?K031L
(a) The kolmogorov-simirnov test :
&lgorithm.
Step2 . %an5 the data $rom smallest to largest2 >et %/i1 denote the ith smallest
o!servation3 so that
( ) ( ) ( ) N
, , , 2 2222222222
2 1

Step) . Com+ute
( ) i
N i
,
N
i
"

'


+
1
ma<
( )

'


N
i
, "
i
N i
1
ma<
1
Step5. Com+ute " @ ma< / "
-
."
-
)/
Step6. Determine the ritial value3 "
0
3 $rom (a!le *2' $or the s+ei$ied signi$iane
the level S and the given sam+le si[e &
Step;. I$ the sam+le statisti " is greater than the ritial value "03 the null
-"1-
hy+othesis that the data are a sam+le $rom the uni$orm distri!ution is re,eted2
I$ D D S3 onlude that no di$$erene has !een deteted !et.een the true
distri!ution o$ V ( ) ( ) ( ) N
, , , 22 3222222222 3
2 1 Z and the uni$orm distri!ution
>.) @un Test.
4un 5 A run is deined as succession o similar events preceded and
ollo/ed -y a dierent even
@uns test . (his is a test $or he5ing inde+endene EoC %i f inde+endently Ei C %i f
inde+endently2
*e+t n random num!ers and level o$ signi$iane to re,et or ae+t the given set o$
random num!ers
(a) uns up and uns down:
Eere3 .e are onerned .ith num!er o$ runs2 (oo $e. or too many runs .ould indiate
non-random !ehavior o$ data2
*n u+ run is a se-uene o$ num!ers eah o$ .hih is sueeded !y a large num!er2 *
do.n run is se-uene o$ num!ers eah o$ .hih is sueeded !y a smaller num!er2 *
4\4/gB41 sign .ill indiate an o!servation .hih is $allo.ed !y a larger /smaller1 num!er2
%uns u+ and %uns Do.n (estC *e+t the total num!er o$ runs a to $ind the mean and
variane o$ a

(he runs test e<amines the arrangement o$ num!ers in a se-uene to test the
hy+othesis o$ inde+endene2 * run is de$ined as a suession o$ similar events +reeded
$ollo.ed !y a di$$erent run2 (he length o$ the run is the num!er o$ events that our in the
run22
I$ a is the total num!er o$ runs in a truly random se-uene3 the mean ans the variane
o$ a are given !y
3
1 2

N
a

)0
2) 16
2

6or & T 20 the distri!ution o$ a is reasona!ly a++ro<imated !y a normal distri!ution3


( )
2
3
a a
N 2 (hat is3 the statisti is
a
a
a
1

0
-"2-
(b) uns abo!e and below the mean :
A 678 sign /ill -e used to denote an o-servation a-ove mean9 and a 6:8
sign /ill denote an o-servation -elo/ t.e mean+
%uns !elo. and a!ove mean testC *e+t the num!er o$ individual o!servations a!ove and
!elo. the mean as &1 and &23 the total num!er o$ runs as ! to $ind the mean and variane
$or !
(he test $or runs u+ and do.n is not om+letely ade-uate to assess the inde+endene o$ a
grou+ o$ num!ers2 >et n1 and n2 !e the individual o!servation a!ove and !elo. the mean
and >et ! !e the total num!ers o$ runs2 (he ma<imum num!er o$ runs is & @ n1 \ n2 and the
minimum num!er o$ run is one2 #iven n1 J n2 the mean and variane are give !y3
2
1
2
2 1
+
N
n n
b

and3
( )
1 1 /
2 1 2 2
2
2 1
2

N N
N n n n n
b

6or either n1 or n2 greater than 203 ! is a++ro<imately normally distri!uted2 (he test statisti
an !e $ormed !y su!trating the mean $rom the num!er o$ runs J diving !y the standard
deviation3 or
a
a
a
1

0
(c) "utocorrelation Test
(he tests $or autoorrelation are onerned .ith the de+endene !et.een num!ers in
a se-uene 2 (he test re-uires the om+utation o$ autoorrelation !.t.een every m num!ers
/ m is also 5no.n as the lag 1 starting .ith the i th num!er2 (hus3 the autoorrelation m i


!et.een the $ollo.ing num!ers .ould !e o$ the interestC
( ) m 2 i m i m i i
, , , ,
1 2
2222 3222222222 3 3
+ + + + 2 (he value M is the largest integer suh that i \
/M\11 m
N
3 .here & is the total num!er o$ values in a se-uene2 (he $ormula $or
m i
e

is
given !y
m i
e

@
( )
2" 2 0
1
1
0
1

1
]
1

+ + +
2
!
m ! i !m i
, ,
2
and
-"3-
( ) 1 12
7 13
+
+

2
2
m i

Coe.
UinludeAstdio2hT
UinludeAonio2hT
UinludeAstdli!2hT
UinludeAmath2hT
$loat ma< /$loat3$loat1H
void 5sBtest/1H
void run?+BrunDo.n/1H
void run*!oveMeanBrun9elo.Mean/1H
void autoBorrelation/1H
void main/1
V
int $lag@13hoieH
lrsr/1H
.hile/$lag@@11
V
+rint$/WXtXtXtXt%*&D7M &?M9;% (;S(XnW1H
-"4-
+rint$/WXnXn11 ^olmogorov-Simrnov (estW1H
+rint$/WXnXnXnXtXtXtXt%?& (;S(W1H
+rint$/WXnXn21 %uns u+ and runs do.n2 W1H
+rint$/WXn31 %uns a!ove the mean J !elo. the meanW1H
+rint$/WXn41 (est $or *utoorrelationW1H
+rint$/WXnXn;nter your hoie C W1H
san$/WDdW3Jhoie1H
$lag@0H
Z
s.ith/hoie1
V
ase 1C
lrsr/1H
5sBtest/1H
!rea5H
ase 2C
lrsr/1H
run?+BrunDo.n/1H
!rea5H
ase 3C
lrsr/1H
run*!oveMeanBrun9elo.Mean/1H
!rea5H
ase 4C
lrsr/1H
autoBorrelation/1H
!rea5H
de$aultC
e<it/01H
Z
geth/1H
Z
void 5sBtest/1
V
$loat rK100L3tem+@03aK100L3!K100L3K100L3tem+1@03ma<B!3ma<B3ma<Bd3al+ha3dBritialH
int i@03,@03&@0HQQ$lag1@1H
har !131H
+rint$/WXtXtXtXt 6%;Q?;&CY (;S(W1H
+rint$/WXnXnXtXtXt ^olmogorov-Simrnov (est W1H
+rint$/WXnXn;nter the num!er o$ random num!ers to !e generated C W1H
san$/WDdW3J&1H
+rint$/WXnXn&ote C Sini$iane level al+ha should !e $rom C 0210 020" 0201W1H
.hile/$lag1@@11
V
+rint$/WXn;nter the signi$iane level al+ha C W1H
san$/WD$W3Jal+ha1H
i$/al+haO@/$loat10210 PP al+haO@/$loat1020" PP al+haO@/$loat102011
V
+rint$/WXn;rror CInorret 8alue o$ al+haW1H
-""-
al+ha@0H
$lag1@1H
Z
else
$lag1@0H
Z
+rint$/WXnXn;nter the ritial value o$ D $or al+ha@D$ at &@Dd C W3al+ha3&1H
san$/WD$W3JdBritial1H
randomi[e/1H
$or/i@1HiA@&Hi\\1
V
rKiL@random/1001R/02011H
i$/ rKiL @@ 0200 1
rKiL@random/101R/0211H
Z
QQSte+ 1 C ran5 the random num!ers in asending order
$or/i@1HiA@&Hi\\1
V
$or/,@i\1H,A@&H,\\1
V
i$/ rKiL T rK,L 1
V
tem+@rKiLH
rKiL@rK,LH
rK,L@tem+H
Z
Z
Z
+rint$/WXnXn%KiLXtXt iQ&XtXt /iQ&-%KiL1 %KiL-/i-11Q&W1H
$or/i@1HiA@&Hi\\1
V
aKiL@/$loat1iQ&H
!KiL@aKiL-rKiLH
tem+1@/$loat1/i-11Q&H
KiL@rKiL-tem+1H
i$/!KiL A 01
V
!1@h hH
+rint$/WXnD22$XtXt D22$XtXt DXt XtD22$W3rKiL3aKiL3!13KiL1H
Z
else i$/KiL A 01
V
1@h hH
+rint$/WXnD22$XtXtD22$XtXt D2$Xt D W3rKiL3aKiL3!KiL311H
Z
else
+rint$/WXnD22$XtXtD22$XtXt D22$Xt D23$ W3rKiL3aKiL3!KiL3KiL1H
Z
QQ(o $ind the ma<
ma<B!@!K1LH
ma<B@K1LH
-"6-
$or/i@1HiA&Hi\\1
V
ma<B!@/$loat1ma</!Ki\1L3ma<B!1H
ma<B@/$loat1ma</Ki\1L3ma<B1H
Z
+rint$/WXnXnXnD\ @ ma<V /iQ&1-%/i1 Z $or 1 A@ i A@ &W1H
+rint$/WXnXnMa< V iQ&-%/i1 /D\1 Z @D23$W3ma<B!1H
+rint$/WXnXnXnD- @ ma< V /%/i1-/i-11Q&1 Z $or 1 A@ i A@ &W1H
+rint$/WXnXnMa< V %/i1-/i-11Q& Z @D23$W3ma<B1H
ma<Bd@ma</ma<B!3ma<B1H
+rint$/WXnXnXnD @ Ma</D\3D-1 @ D23$W3ma<Bd1H
+rint$/WXnXn%esult CW1H
i$/ma<Bd A dBritial1
V
+rint$/WXnXnSine the om+uted value o$ D@D23$ is less than given
D@D23$W3ma<Bd3dBritial1H
+rint$/WXnthe hy+othesis o$ no di$$erene !et.een the distri!ution o$
generated num!erW1H
+rint$/WXnJ the uni$orm distri!ution is not re,etedW1H
Z
else
V
+rint$/WXnXnSine the om+uted value o$ D@D$ is greater than given
D@D$ 3W3dBritial1H
+rint$/WXnthe hy+othesis o$ no di$$erene !et.een the distri!ution o$
generated num!erW1H
+rint$/WXnJ the uni$orm distri!ution is re,etedW1H
Z
geth/1H
Z
void run?+BrunDo.n/1
V
$loat rK100L3meuBa@03sigmaBa@03a@03i@03al+ha@0202"3aBritial@12)6H
har runsK100LH
int &@03i@03$lag@13tr1@03tr2@0H
+rint$/WXtXtXtXt %?& (;S(W1H
+rint$/WXnXnXtXtXt %uns u+ runs Do.n (est W1H
+rint$/WXnXn;nter the num!er o$ random num!ers to !e generated C W1H
san$/WDdW3J&1H
+rint$/WXnXnW1H
QQ+rint$/WXnXn;nter the signi$iane level /al+ha1@ W1H
QQsan$/WD$W3Jal+ha1H
randomi[e/1H
+rint$/WXnXnXn%andom &um!ers C XnW1H
$or/i@1HiA@&Hi\\1
V
rKiL@random/1001R/02011H
i$/ rKiL @@ 0200 1
rKiL@random/101R/0211H
+rint$/WD22$ W3rKiL1H
Z
-"7-
meuBa@/$loat1/2R&-11Q3H
sigmaBa@/$loat1/16R&-2)1Q)0H
$or/i@1HiA&Hi\\1
V
i$/rKiL A rKi\1L1
V
runsKiL@h\hH
Z
else
V
runsKiL@h-hH
Z
Z
+rint$/WXnXnXn W1H
QQCalulates the num!er o$ length o$ runs2
$or/i@0HiA&-1Hi\\1
V
i$/runsKiL@@runsKi\1L1
V
.hile/runsKiL@@runsKi\1L1
V
i@i\1H
Z
tr1@tr1\1H
QQagain i is inremented $rom the $or loo+s
Z
else
tr2@tr2\1H
Z
a@tr1\tr2H
i@/$loat1//a-meuBa1Qs-rt/sigmaBa11H
+rint$/WXnXn%unsC XnXnW1H
$or/i@1HiA&Hi\\1
V
+rint$/WD W3runsKiL1H
Z
+rint$/WXnXnXnMean /mue1 @ D23$ W3meuBa1H
+rint$/WXnXn8ariane /sigma1 @ D23$ W3sigmaBa1H
+rint$/WXnXn7!served num!er o$ runs /a1@ D23$W3a1H
+rint$/WXnXni@ D23$W3i1H
+rint$/WXnXnXnXn%esult CW1H
i$/ i A aBritial1
V
+rint$/WXnXnSine3 the ritial value o$ i @ D23$ less that
i/D23$1@D23$W 3i3al+ha3aBritial1H
+rint$/W the inde+endene annot !e re,etedW1H
Z
else
V
+rint$/WXnXnSine3 the ritial value o$ i @ D23$ not less than
-"'-
i/D23$1@D23$3W 3i3al+ha3aBritial1H
+rint$/WXnthe inde+endene is re,etedW1H
Z
geth/1H
Z
void run*!oveMeanBrun9elo.Mean/1
V
$loat rK100L3meuB!@03sigmaB!@03!@03i@03al+ha@0202"H
$loat aBritial@12)63+1@03+2@03+3@0H
har runsK100LH
int &@03i@03n1@03n2@03tr1@03tr2@0H
+rint$/WXtXtXtXt %?& (;S(W1H
+rint$/WXnXnXtXtXt %uns *!ove J !elo. the meanW1H
+rint$/WXnXn;nter the num!er o$ random num!ers to !e generated C W1H
san$/WDdW3J&1H
+rint$/WXnXnW1H
QQ+rint$/WXnXn;nter the signi$iane level /al+ha1@ W1H
QQsan$/WD$W3Jal+ha1H
randomi[e/1H
+rint$/WXnXnXn%andom &um!ers C XnW1H
$or/i@1HiA@&Hi\\1
V
rKiL@random/1001R/02011H
i$/ rKiL @@ 0200 1
rKiL@random/101R/0211H
+rint$/WD22$ W3rKiL1H
Z
$or/i@1HiA&Hi\\1
V
i$/rKiL T 024)"1
V
runsKiL@h\hH
Z
else
V
runsKiL@h-hH
Z
Z
+rint$/WXnXn%uns CXnXnW1H
$or/i@1HiA&Hi\\1
V
+rint$/WD W3runsKiL1H
Z
$or/i@1HiA&Hi\\1
V
i$/runsKiL @@ h\h1
n1\\H
else
n2\\H
Z
+rint$/WXnXnn1@DdW3n11H
-")-
+rint$/WXnXnn2@DdW3n21H
meuB!@/$loat1/2Rn1Rn2Q&1\02"H
+1@2Rn1Rn2H
+2@+1R/+1-&1H
+3@+o./&331-&H
sigmaB!@/$loat1/+2Q+31H
$or/i@0HiA&-1Hi\\1
V
i$/runsKiL@@runsKi\1L1
V
.hile/runsKiL@@runsKi\1L1
V
i@i\1H
Z
tr1@tr1\1H
QQagain i is inremented $rom the $or loo+s
Z
else
tr2@tr2\1H
Z
!@tr1\tr2H
i$/n1 T 20 PP n2 T 201
V
i@/$loat1/!-meuB!1Qs-rt/sigmaB!1H
Z
+rint$/WXnXnXnMean /mue1 @ D23$ W3meuB!1H
+rint$/WXnXn8ariane /sigma1 @ D23$ W3sigmaB!1H
+rint$/WXnXn7!served num!er o$ runs /!1@ D23$W3!1H
+rint$/WXnXni@ D23$W3i1H
+rint$/WXnXnXn%esult C W1H
i$/ i A aBritial1
V
+rint$/WXnXnSine3 the ritial value o$ i @ D23$ less that i/D23$1@
D23$3XnW3i3al+ha3aBritial1H
+rint$/Wthe inde+endene annot !e re,etedW1H
Z
else
V
+rint$/WXnXnSine3 the ritial value o$ i @ D23$ not less than i/D23$1@
D23$XnW3i3al+ha3aBritial1H
+rint$/WXnthe inde+endene is re,etedW1H
Z
geth/1H
Z
void autoBorrelation/1
V
$loat rK100L3meuBa@03sigmaBa@03al+ha@0202"3aBritial@12)63ans@03rho@03sigma@03i@0H
int &@03,@03$lag@13i@03M@03m@0H
+rint$/WXtXtXtXt (;S( 76 *?(7 C7%%;>*(I7&W1H
+rint$/WXnXnXn;nter the num!er o$ random num!ers to !e generated C W1H
san$/WDdW3J&1H
-60-
+rint$/WXnXnW1H
QQ+rint$/WXnXn;nter the signi$iane level /al+ha1@ W1H
QQsan$/WD$W3Jal+ha1H
randomi[e/1H
QQ*e+t J +rints %andom &um!ers
+rint$/WXnXn%andom &um!ers C XnXnW1H
$or/,@1H,A@&H,\\1
V
rK,L@random/1001R/02011H
i$/ rK,L @@ 0200 1
rK,L@random/101R/0211H
+rint$/WD22$ W3rK,L1H
Z
+rint$/WXnXn;nter the lag m /every m num!ers1@ W1H
san$/WDdW3Jm1H
+rint$/WXnXn;nter the ga+ to test i /starting $rom ihth num!er1 @ W1H
san$/WDdW3Ji1H
+rint$/WXnXn&ote C ;nter the 8alue o$ M suh that i\/M-11Rm A@ & XnXnW1H
.hile/$lag@@11
V
+rint$/W;nter M /largest integer1@ W1H
san$/WDdW3JM1H
i$/i\/M\11Rm T@ &1
V
+rint$/WXnXnInorret 8alue o$ MXnXnW1H
$lag@1H
Z
else
V
$lag@0H
Z
Z
$or/,@0H,A@MH,\\1
V
ans@ans\rKi\,RmLRrKi\/,\11RmLH
Z
rho@/+o.//M\113-111Rans-022"H
$loat s1@03s2@0H
s1@/$loat1s-rt//13RM1\71H
s2@/$loat112R/M\11H
sigma@/$loat1s1Qs2H
i@rhoQsigmaH
+rint$/WXnXnrho/Dd1/Dd1 @ D23$W3i3m3rho1H
+rint$/WXnXnsigma @ D23$W3sigma1H
+rint$/WXnXni/D23$1/Dd1 @ D23$ W3al+ha3&3i1H
+rint$/WXnXnXn%esult C XnXnW1H
i$/ i A aBritial1
V
+rint$/WXnXSine3 the ritial value o$ i @ D23$ less that
i/D23$1@D23$3XnW3i3al+ha3aBritial1H
+rint$/Wthe inde+endene annot !e re,etedW1H
-61-
Z
else
V
+rint$/WXnXnSine3 the ritial value o$ i @ D23$ not less than
i/D23$1@D23$XnW3i3al+ha3aBritial1H
+rint$/WXnthe inde+endene is re,etedW1H
Z
geth/1H
Z
$loat ma</$loat value13 $loat value21
V
return / /value1 T value21 j value1 C value21H
Z
-62-
7utput.
QR
O-----------------------------------------------------------------------------------------O
!@EQEENCI TEST
Folmogoro'-Simrno' Test
;nter the num!er o$ random num!ers to !e generated C 6
&ote C Sini$iane level al+ha should !e $rom C 0210 020" 0201
;nter the signi$iane level al+ha C 020"
;nter the ritial value o$ D $or al+ha@020"0000 at &@6 C 02"6"
%KiL iQ& /iQ&-%KiL1 %KiL-/i-11Q&
0241 0217 0241
0243 0233 0226
02"' 02"0 022"
026) 0267 021)
026) 02'3 0214 02023
02'6 1200 0214 02027
D\ @ ma<V /iQ&1-%/i1 Z $or 1 A@ i A@ &
Ma< V iQ&-%/i1 /D\1 Z@ 02143
D- @ ma< V /%/i1-/i-11Q&1 Z $or 1 A@ i A@ &
Ma< V %/i1-/i-11Q& Z@ 02410
D @ Ma</D\3D-1@ 02410
%esult C
Sine the om+uted value o$ D@02410 is less than given D@02"6" the hy+othesis o$ no di$$erene
!et.een the distri!ution o$ generated num!er
J the uni$orm distri!ution is not re,eted
O-----------------------------------------------------------------------------------------O
-63-
O-----------------------------------------------------------------------------------------O
@EN TEST
@uns up runs Do%n Test
;nter the num!er o$ random num!ers to !e generated C "0
%andom &um!ers C
02"3 0234 021) 022' 0221 02"0 02"3 02"2
02"' 02"" 0220 02'7 02"" 024' 02"' 0243
0260 0271 0213 0221 02)2 0260 0264 020)
02)1 0201 02)1 02)3 021" 022' 023) 024)
021" 0244 0226 0213 02)7 02)7 022" 0200
020" 02)6 0277 0246 0247 02'6 0240 026'
022' 0266
%unsC
- - \ - \ \ - \ - - \ - - \ - \ \ - \ \ - \ - \ - \ \ - \ \ \ - \ - - \ - - - \
\ - - \ \ - \ - \
Mean /mue1 @ 332000
8ariane /sigma1 @ '2"67
7!served num!er o$ runs /a1@ 342000
i@ 02342
%esult C
Sine3 the ritial value o$ i @ 02342 less that i/0202"1@12)60 the inde+endene
annot !e re,eted
O-----------------------------------------------------------------------------------------O
@EN TEST
@uns &"o'e J "elo% the mean
;nter the num!er o$ random num!ers to !e generated C "0
%andom &um!ers C
02'4 021" 027) 02"2 02"6 024' 02'0 0263
0221 027' 0262 027' 02'3 02"7 0270 0227
021) 02"7 0237 02"0 027" 0243 0217 0211
-64-
021" 0273 0233 0267 0271 0274 0204 026)
026) 023) 026' 0260 0271 02)2 02"" 0247
021' 0267 0217 0224 0201 02"2 0274 02"0
023) 0202
%uns C
\ - \ \ \ - \ \ - \ \ \ \ \ \ - - \ - \ \ - - - - \ - \ \ \ - \ \ - \ \ \ \ \ -
- \ - - - \ \ \ -
n1@30
n2@1)
Mean /mue1 @ 222"00
8ariane /sigma1 @ )2)4"
7!served num!er o$ runs /!1@ 242000
i@ 02476
%esult C
Sine3 the ritial value o$ i @ 02476 less that i/0202"1@12)603 the inde+endene annot !e re,eted
O-----------------------------------------------------------------------------------------O
TEST 7! &ET7 C7@@EB&T47N
;nter the num!er o$ random num!ers to !e generated C 30
%andom &um!ers C
024" 0276 0200 0226 024" 023" 02'4 024'
0226 0247 0261 023' 0274 02)3 02)4 0236
022) 02'3 0207 0242 020' 022" 0213 026"
0217 021) 0216 02'4 026" 0234
;nter the lag m /every m num!ers1@ 3
;nter the ga+ to test i /starting $rom ihth num!er1 @ 3
&ote C ;nter the 8alue o$ M suh that i\/M-11Rm A@ &
;nter M /largest integer1@ 4
-6"-
rho/31/31 @ 0201"
sigma @ 0212'
i/0202"1/301 @ 02121
%esult C
Sine3 the ritial value o$ i @ 02121 less that i/0202"1@12)603 the inde+endene annot !e re,eted
O-----------------------------------------------------------------------------------------O
RQ
-66-
Practical-0*
&cceptance-@eGection Techni+ue
Write a C/C++/Excel Program to implement "cceptance#e$ection Techni%ue $or a
gi'en Distri"ution- Poisson or /amma istri"ution,.
Theor#.
&cceptance . @eGection techni+ue
Su++ose that an analyst needed to devise a method $or generating random
varia!les M uni$ormly distri!uted !et.een k J 12
(he ste+s used area-
Ste+ 1- #enerate a random no2 %
Ste+ 2- a1 o$ % T k3 ae+t M @ %3 then go to ste+ 32
!1 7$ % A k3 re,et % J return to ste+ 12
Ste+ 3- 7$ another uni$orm random varia!le on K1Q43 1L is needed re+eat the +roedure
!eginning at ste+ 13 or not sto+2
<.2 Poisson Distri"ution. * =oisson random varia!le3 &3 .ith mean S T 0 has +m$
( ) ( ) 22222 0313232222 n
O n
n
2S
S
e
n & = n +


& an !e inter+reted as the num!er o$ arrivals $rom the =oisson arrival +roess in one unit o$
time2
&lgorithim.
Ste+1 . n@03 =@1
Ste+2 . #enerate a random num!er % 1 + n and re+lae = !y =2 % 1 + n
Ste+3 . i$ + A e
-S
3 then ae+t & @ n2 7ther.ise3 re,et the surrent n3 inrease n
!y one3 and retuen to ste+ 22
<.) /amma Distri"ution .
&lgorithm .
Ste+1 . Com+ute a @ ( )


1
4 ln 2 3 1 2 2
1
+ b
Ste+2 . #enerate %1 and %22
Ste+3 . Com+ute M @

1
]
1

1
1
1 ,
,
Ste+4a . i$ M ( )3 ln
2
2
1
, , b use M as the desired variate2 (he generated variates
$rom ste+ 4a .ill have mean J variane !oth e-ual to c2
Ste+4! . i$ M T ( )3 ln
2
2
1
, , b re,et J return to ste+ 22
-67-
Coe .
QQ*e+tane-re,etion (ehni-ue
UinludeAstdio2hT
UinludeAonio2hT
UinludeAstdli!2hT
UinludeAmath2hT
void +oissonBdistri!ution/1H
void gammaBdistri!ution/1H
void main/1
V
int hoieH
lrsr/1H
<C
+rint$/WXnXn *e+tane-%e,etion (ehin-ueW1H
+rint$/WXn 1C =oisson Distri!utionW1H
+rint$/WXn 2C #amma Distri!utionW1H
+rint$/WXn 3C ;<itW1H
+rint$/WXn ;nter Choie C W1H
san$/WDdW3Jhoie1H
s.ith/hoie1
V
ase 1C
lrsr/1H
+oissonBdistri!ution/1H
goto <H
ase 2C
lrsr/1H
gammaBdistri!ution/1H
goto <H
ase 3C
e<it/01H
Z
geth/1H
Z
void +oissonBdistri!ution/1
V
$loat n@03=@13%K20L3al+ha3-H
int <3ount@03&@0H
+rint$/WXnXnXtXtXt =oisson Distri!utionW1H
-6'-
+rint$/WXnXn ;nter the num!er o$ =oisson variates C W1H
san$/WDdW3J<1H
+rint$/WXnXn ;nter the mean al+ha C W1H
san$/WD$W3Jal+ha1H
QQalulating e e<+ -al+ha
-@e<+/-/al+ha11H
randomi[e/1H
QQ+rinting olumn values
+rint$/WXn n Xt %Kn\1L Xt = Xt *e+tQ%e,et Xt %esultW1H
+rint$/WXn--------------------------------------------------------------W1H
.hile/ountA<1
V
QQ#enerating random &um!er
%Kn\1L@random/1001R/02011H
QQ%e+lae = !y =R%Kn\1L
=@=R%Kn\1LH
i$/=A-1
V
&@nH
ount\\H
QQ+rint the values in ta!le .ith W*e+tW
+rint$/WXn DdW3n1H
+rint$/WXt D23$W3%Kn\1L1H
+rint$/WXtXt D23$W3=1H
+rint$/WXt *e+tW1H
+rint$/WXtXtXt DdW3&1H
=@1H
Z
else
V
QQ+rint the values in ta!le .ith W%e,etW
+rint$/WXn DdW3n1H
+rint$/WXt D23$W3%Kn\1L1H
+rint$/WXtXt D23$W3=1H
+rint$/WXt %e,etW1H
+rint$/WXtXtXt DdW3&1H
n\\H
Z
Z
geth/1H
Z
-6)-
void gammaBdistri!ution/1
V
$loat a3!3!eta3%13%2383M3Y3theta3iH
int $lag@1H
+rint$/WXnXnXtXt #amma Distri!utionW1H
+rint$/WXnXn ;nter the value o$ 9eta C W1H
san$/WD$W3J!eta1H
+rint$/WXnXn ;nter the value o$ (heta C W1H
san$/WD$W3Jtheta1H
a@1Q+o.///2R!eta1-11302"1H
!@/!eta1-/log/411H
.hile/$lag@@11
V
%1@rand/1D100Q/$loat1100H
%2@rand/1D100Q/$loat1100H
8@%1Q/1-%11H
M@!etaR/+o./83a11H
i@//%1R%11R%21H
Y@!\ / /!etaRa1\11 R / log/81 1 - / log /i1 1 H
+rint$/WXnXn %1@D$W3%11H
+rint$/WXnXn %2@D$W3%21H
+rint$/WXnXn 8@D$W381H
+rint$/WXnXn M@D$W3M1H
+rint$/WXnXn Y@D$W3Y1H
i$ /MTY1
V
+rint$/WXnXn M@D$ has !een re,eted as D$TD$W3M3M3Y1H
$lag@1H
Z
else
V
+rint$/WXnXn M@D$ has !een ae+ted as D$A@D$W3M3M3Y1H
M@MQ/!etaRtheta1H
+rint$/WXnXn (he ae+ted value o$ M a$ter using the $ormula KMQ
/!etaRtheta1L is D$ W3M1H
$lag@0H
Z
Z
geth/1H
Z
-70-
7ETPET .

Poisson Distri"ution

;nter the num!er o$ =oisson variates C 6


;nter the mean al+ha C 022

n %Kn\1L = *e+tQ%e,et %esult
--------------------------------------------------------------
0 02300 02300 *e+t 0
0 02400 02400 *e+t 0
0 02)40 02)40 %e,et 0
0 02100 020)4 *e+t 1
0 02'10 02'10 *e+t 1
0 02310 02310 *e+t 1
0 02'60 02'60 %e,et 1
0 020'0 0206) *e+t 2
*e+tane-%e,etion (ehin-ue
1C =oisson Distri!ution
2C #amma Distri!ution
3C ;<it
;nter Choie C 2
/amma Distri"ution
;nter the value o$ 9eta C 3214
;nter the value o$ (heta C 02"62
%1@02460000
%2@02300000
8@02'"1'"2
M@22)2'360
Y@421312'4
M@22)2'360 has !een ae+ted as 22)2'360A@421312'4
(he ae+ted value o$ M a$ter using the $ormula KMQ/!etaRtheta1L is 126")42)
-71-

You might also like