0% found this document useful (0 votes)
50 views19 pages

System Modelling and Simulation

This document discusses system modeling and simulation assignments. It includes generating random numbers using Monte Carlo simulation to calculate Pi, using a linear congruential generator to generate random number sequences, estimating the periodicity of an LCG, developing an original LCG, and performing randomness tests like the Kolmogorov–Smirnov test, runs test, and poker test on random number sequences.

Uploaded by

tve21ie060
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views19 pages

System Modelling and Simulation

This document discusses system modeling and simulation assignments. It includes generating random numbers using Monte Carlo simulation to calculate Pi, using a linear congruential generator to generate random number sequences, estimating the periodicity of an LCG, developing an original LCG, and performing randomness tests like the Kolmogorov–Smirnov test, runs test, and poker test on random number sequences.

Uploaded by

tve21ie060
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

SYSTEM MODELLING AND

SIMULATION

ASSIGNMENTS

SUBMITTED BY:
Sidhanth S Nair
Roll no: 51
TVE21IE060
ASSIGNMENT NO.1

Q. To Detemine the value of Pi using Monte Carlo Simulation

STEPS TO BE FOLLOWED
1.Open a new excel worksheet
2. Generate two sets of 100 random numbers namely X and Y
3. Formulate the condition to be satisfies as below
=IF(A2^2+B2^2<=1,1,0)

4. To count the number of accepted pairs use the formulation


=COUNTIF(C2:C101,1)

5. Calculate the value of Pi using the formula …4*n/N


X Y F(X)
0.09805 0.93497
8 9 1
0.92723
9 0.06964 1 CALCULATIONS
0.65933 0.94502
2 3 0
0.30755 Number of random pairs
7 0.31309 1 generated= 100 10
0.46024 0.64695
3 8 1 (N)
0.02489
0.7323 1 1
0.94486 0.61711 Number of random pairs
2 6 0 accepted = 79 7
0.67632 0.90531
7 5 0 (n)
0.69346 0.94169
3 1 0
0.85808 0.66837
2 2 0
0.02415
0.57184 7 1 Value of Pi = 4*n/N
0.08342 0.55336
8 4 1
0.39267 0.60774 4*79/10
1 8 1 = 0
0.58111
0.2603 3 1
0.53462 0.10719
9 1 1 = 3.16
0.99106 0.17302
7 1 0
0.11058 0.83396
1 5 1
0.01596
0.5417 9 1
0.31537 0.43562
1 4 1
0.31148
0.72436 3 1
0.19293 0.14972
3 5 1
0.72843 0.11812
3 9 1
0.69909
0.13585 8 1
0.59394 0.63516
9 5 1
0.78082 0.92654
4 5 0
0.04586 0.24448
2 8 1
0.54690 0.32471
8 7 1
0.89418 0.55928
2 5 0
0.06950 0.29190
3 2 1
0.65631 0.36999
2 1 1
0.86058 0.78182
9 2 0
0.61310 0.05505
2 2 1
0.28164 0.59102
7 4 1
0.61854 0.12890
3 7 1
0.16215 0.05990
9 7 1
0.60100 0.14018
6 9 1
0.70131 0.01012
5 3 1
0.65435
0.78416 1 0
0.24299 0.15444
3 2 1
0.95932 0.36507
8 7 0
0.78036 0.05491
2 6 1
0.35468 0.23977
4 6 1
0.74461 0.26172
2 8 1
0.30249
7 0.01006 1
0.43386 0.17876
2 1 1
0.59726 0.84162
3 2 0
0.95499 0.24264
4 3 1
0.99262 0.45677
5 9 0
0.64467
4 0.03665 1
0.13019 0.36219
2 4 1
0.99442 0.04947
1 1 1
0.22814
1 0.66983 1
0.04637 0.12144
3 3 1
0.00235 0.83990
6 5 1
0.14631 0.07751
7 6 1
0.45325
6 0.36929 1
0.14961 0.14330
7 6 1
0.25086 0.38784
3 7 1
0.87817 0.28233
3 1 1
0.04637 0.25826
6 9 1
0.21423 0.34791
9 4 1
0.34175 0.93096
9 2 1
0.02609 0.46260
9 3 1
0.07302 0.31617
5 5 1
0.32614 0.10298
2 9 1
0.00735 0.73264
2 7 1
0.47635 0.85010
9 5 1
0.01881 0.85255
4 6 1
0.09012
6 0.46126 1
0.95030
4 0.70308 0
0.98106 0.15421
7 8 1
0.61152 0.98218
4 2 0
0.41156 0.05045
8 9 1
0.71422
4 0.02656 1
0.84615 0.03859
3 2 1
0.59395 0.13681
4 7 1
0.66258 0.03054
9 7 1
0.71860 0.19574
9 5 1
0.27826 0.13165
5 4 1
0.34070 0.66111
4 9 1
0.08043
1 0.63466 1
0.65743 0.80816
2 3 0
0.99947 0.17976
6 4 0
0.96425 0.82165
1 7 0
0.07770 0.73290
4 4 1
0.93319 0.29036
4 3 1
0.00486 0.69714
5 1 1
0.46477 0.58658 1
0.13207 0.13429
2 1 1
0.70704 0.72299
4 4 0
0.13394
2 0.83361 1
0.57404 0.04225
8 7 1
0.44348 0.38508
2 8 1
0.87678 0.27625
3 1 1
0.81631 0.36804
3 5 1
0.50529 0.09223
6 7 1
0.32491 0.52786
6 2 1
0.53385
8 0.97919 0
0.77404 0.67637
3 3 0
0.66832 0.74312
6 6 1

ASSIGNMENT NO:2
Q1. Use LCG to generate a sequence of 100 Random numbers with
a=19,m=100,c=0 and Xo=63
Steps to be followed:
1. Open Dev C++ and code as given below.

2. Compile and Run the code


3. The set of 100 random numbers is generated as given below
Q2. Use LCG to generate a sequence of 100 Random numbers with
a=7^5 ,m=2^31 -1 , c=0 and take Xo=123457.Can you estimate the periodicity
before working out ?

To estimate the periodicity:


 From the research finding (3) we get the result that ,For m a prime
number and c=0 the longest possible period is P=m -1
 Here m=2^31-1
 Hence the longest possible period P= (2^31-1) -1

= 2^31 – 2

=2147483646

Steps to be followed:
1. Open excel and create a new worksheet.
2. In cell B1 ,enter intial value Xo =123457
3. In cell B2, enter the formula to generate the next value in the
sequence using the linear congruential method .The formula used
is

=MOD(7^5*B1,2^31-1)

4. Now click on cell B2 and drag down the fill handle upto the
desired number of cells
5. After completing these steps cells B2 to B101 will contain the
sequence of 100 random numbers generated using LCG
technique.
ASSIGNMENT NO:3
Q1. Develop a LCG of your Own and find the periodicity of that generator.

Steps to be followed:
1. Write a generalised C++ program as given below
2. The generated random numbers are as follows

From the observations we get that the periodicity of the generator is 5


ASSIGNMENT NO:4

Q1. K-S test

Q2. RUNS test above and below the mean

Steps to be followed:

 Perform the requisite operations using MS EXCEL to


obtain the specific results regarding the random
number to be generated.
ASSIGNMENT NO:5

Q1. POKER TEST

Steps to be followed:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy